提交 ba2746b0 编写于 作者: N NeilBrown

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: Nkbuild test robot <fengguang.wu@intel.com>
Signed-off-by: NNeilBrown <neilb@suse.com>
上级 c2a06c38
...@@ -847,20 +847,21 @@ static int metadata_update_finish(struct mddev *mddev) ...@@ -847,20 +847,21 @@ static int metadata_update_finish(struct mddev *mddev)
struct cluster_msg cmsg; struct cluster_msg cmsg;
struct md_rdev *rdev; struct md_rdev *rdev;
int ret = 0; int ret = 0;
int raid_slot = -1;
memset(&cmsg, 0, sizeof(cmsg)); memset(&cmsg, 0, sizeof(cmsg));
cmsg.type = cpu_to_le32(METADATA_UPDATED); cmsg.type = cpu_to_le32(METADATA_UPDATED);
cmsg.raid_slot = -1;
/* Pick up a good active device number to send. /* Pick up a good active device number to send.
*/ */
rdev_for_each(rdev, mddev) rdev_for_each(rdev, mddev)
if (rdev->raid_disk > -1 && !test_bit(Faulty, &rdev->flags)) { 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; break;
} }
if (cmsg.raid_slot >= 0) if (raid_slot >= 0) {
cmsg.raid_slot = cpu_to_le32(raid_slot);
ret = __sendmsg(cinfo, &cmsg); ret = __sendmsg(cinfo, &cmsg);
else } else
pr_warn("md-cluster: No good device id found to send\n"); pr_warn("md-cluster: No good device id found to send\n");
unlock_comm(cinfo); unlock_comm(cinfo);
return ret; return ret;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册