summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.com>2015-10-16 05:48:35 +0300
committerNeilBrown <neilb@suse.com>2015-10-16 05:48:35 +0300
commitba2746b0facf83c62bebf8aed8f0a3fd446de612 (patch)
tree241b5ede4129cc5145c6c37d1eb4bddeb0247edf
parentc2a06c38d92d044a69a3eae0138ab95ff0788030 (diff)
downloadlinux-ba2746b0facf83c62bebf8aed8f0a3fd446de612.tar.xz
md-cluster: metadata_update_finish: consistently use cmsg.raid_slot as le32
As cmsg.raid_slot is le32, comparing for >0 is not meaningful. So introduce cpu-endian 'raid_slot' and only assign to cmsg.raid_slot when we know value is valid. Reported-by: kbuild test robot <fengguang.wu@intel.com> Signed-off-by: NeilBrown <neilb@suse.com>
-rw-r--r--drivers/md/md-cluster.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/md/md-cluster.c b/drivers/md/md-cluster.c
index 35ac2e8cb7f1..aad5e7cda523 100644
--- a/drivers/md/md-cluster.c
+++ b/drivers/md/md-cluster.c
@@ -847,20 +847,21 @@ static int metadata_update_finish(struct mddev *mddev)
struct cluster_msg cmsg;
struct md_rdev *rdev;
int ret = 0;
+ int raid_slot = -1;
memset(&cmsg, 0, sizeof(cmsg));
cmsg.type = cpu_to_le32(METADATA_UPDATED);
- cmsg.raid_slot = -1;
/* Pick up a good active device number to send.
*/
rdev_for_each(rdev, mddev)
if (rdev->raid_disk > -1 && !test_bit(Faulty, &rdev->flags)) {
- cmsg.raid_slot = cpu_to_le32(rdev->desc_nr);
+ raid_slot = rdev->desc_nr;
break;
}
- if (cmsg.raid_slot >= 0)
+ if (raid_slot >= 0) {
+ cmsg.raid_slot = cpu_to_le32(raid_slot);
ret = __sendmsg(cinfo, &cmsg);
- else
+ } else
pr_warn("md-cluster: No good device id found to send\n");
unlock_comm(cinfo);
return ret;