md: improve errno return when setting array_size
authorNeilBrown <neilb@suse.de>
Mon, 25 May 2009 23:41:17 +0000 (09:41 +1000)
committerNeilBrown <neilb@suse.de>
Mon, 25 May 2009 23:41:17 +0000 (09:41 +1000)
Instead of always returns EINVAL if anything goes wrong
when setting the array size, add the option of
  E2BIG
if the size requested is too large.  This makes it easier
for user-space to be sure what went wrong.

Signed-off-by: NeilBrown <neilb@suse.de>
drivers/md/md.c

index aa79d55875f051eacbc24a0fec4ae46e9795549b..58e0b02a74c225bc5320a897e5c64a961ebed195 100644 (file)
@@ -3683,7 +3683,7 @@ array_size_store(mddev_t *mddev, const char *buf, size_t len)
                if (strict_blocks_to_sectors(buf, &sectors) < 0)
                        return -EINVAL;
                if (mddev->pers && mddev->pers->size(mddev, 0, 0) < sectors)
-                       return -EINVAL;
+                       return -E2BIG;
 
                mddev->external_size = 1;
        }