From: suzuki Date: Fri, 16 Mar 2007 21:38:25 +0000 (-0800) Subject: [PATCH] fix rescan_partitions to return errors properly X-Git-Tag: v2.6.21-rc5~88 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b74a2f0913694556a027795d2954d30523fac4c5;p=linux-2.6 [PATCH] fix rescan_partitions to return errors properly The only error code which comes from the partition checkers is -1, when they finds an EIO. As per the discussion, ENOMEM values were ignored, as they might scare the users. So, with the current code, we end up returning -1 and not EIO for the ioctl() calls. Which doesn't give any clue to the user of what went wrong. Signed-off-by: Suzuki K P Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/fs/partitions/check.c b/fs/partitions/check.c index e46d237b10..8a7d0035ad 100644 --- a/fs/partitions/check.c +++ b/fs/partitions/check.c @@ -541,7 +541,7 @@ int rescan_partitions(struct gendisk *disk, struct block_device *bdev) if (!get_capacity(disk) || !(state = check_partition(disk, bdev))) return 0; if (IS_ERR(state)) /* I/O error reading the partition table */ - return PTR_ERR(state); + return -EIO; for (p = 1; p < state->limit; p++) { sector_t size = state->parts[p].size; sector_t from = state->parts[p].from;