md: don't return 0 from array_state_store
authorNeilBrown <neilb@suse.de>
Fri, 12 Jun 2015 09:46:44 +0000 (19:46 +1000)
committerNeilBrown <neilb@suse.de>
Fri, 12 Jun 2015 10:16:16 +0000 (20:16 +1000)
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: 6791875e2e53 ("md: make reconfig_mutex optional for writes to md sysfs files.")
Signed-off-by: NeilBrown <neilb@suse.de>
Cc: stable@vger.kernel (v4.0+)
drivers/md/md.c

index 27506302eb7aa42557bfc01547274957ccbace50..dd59d71ade2f525f84a9494d74697d93e28c1329 100644 (file)
@@ -3834,7 +3834,7 @@ array_state_store(struct mddev *mddev, const char *buf, size_t len)
                                err = -EBUSY;
                }
                spin_unlock(&mddev->lock);
-               return err;
+               return err ?: len;
        }
        err = mddev_lock(mddev);
        if (err)