On 09/29/2017 02:45 AM, Liu Bo wrote:
On Thu, Sep 28, 2017 at 09:57:41AM +0800, Guoqing Jiang wrote:
On 09/28/2017 06:13 AM, Liu Bo wrote:
MD's rdev_set_badblocks() expects that badblocks_set() returns 1 if
badblocks are disabled, otherwise, rdev_set_badblocks() will record
superblock changes and return success in that case and md will fail to
report an IO error which it should.
This bug has existed since badblocks were introduced in commit
9e0e252a048b ("badblocks: Add core badblock management code").
I don't think we need to change it since it originally was return 0 in
original
commit.
The difference is that the original md_set_badblocks() returns 0 for
both "being disabled" and "no room", while now badblocks_set() returns
1 for "no room" as a failure but 0 for "being disabled".
Thanks for point it out, you are right, and the below comments said:
* Return:
* 0: success
* 1: failed to set badblocks (out of space)
Maybe it is better to add "badblocks are disabled" to above comment.
Anyway, Acked-by: Guoqing Jiang <gqjiang@xxxxxxxx>
Regards,
Guoqing