提交 c008f1d3 编写于 作者: N NeilBrown

md: don't return 0 from array_state_store

Returning zero from a 'store' function is bad.
The return value should be either len length of the string
or an error.

So use 'len' if 'err' is zero.

Fixes: 6791875e ("md: make reconfig_mutex optional for writes to md sysfs files.")
Signed-off-by: NNeilBrown <neilb@suse.de>
Cc: stable@vger.kernel (v4.0+)
上级 c65b99f0
...@@ -3834,7 +3834,7 @@ array_state_store(struct mddev *mddev, const char *buf, size_t len) ...@@ -3834,7 +3834,7 @@ array_state_store(struct mddev *mddev, const char *buf, size_t len)
err = -EBUSY; err = -EBUSY;
} }
spin_unlock(&mddev->lock); spin_unlock(&mddev->lock);
return err; return err ?: len;
} }
err = mddev_lock(mddev); err = mddev_lock(mddev);
if (err) if (err)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册