aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSuzuki Kp <suzuki@in.ibm.com>2006-12-06 23:35:14 -0500
committerLinus Torvalds <torvalds@woody.osdl.org>2006-12-07 11:39:30 -0500
commit5127d002f9769ba6b1691de78dd3a5c14635e183 (patch)
tree479d47c850f5f10b9aa7e2d5ec6e9743820bc781
parent1ecb9c0f3c9ef6af77c39a9f584940691847ccf4 (diff)
[PATCH] fix rescan_partitions to return errors properly
The current rescan_partition implementation ignores the errors that comes from the lower layer. It reports success for unknown partitions as well as I/O error cases while reading the partition information. The unknown partition is not (and will not be) considered as an error in the kernel, since there are legal users of it (e.g, members of a RAID5 MD Device or a new disk which is not partitioned at all ). Changing this behaviour would scare the user about a serious problem with their disk and is not recommended. Thus for both "unknown partitions" to the Linux (eg., DEC VMS,Novell Netware) and the legal users of NULL partition, would still be reported as "SUCCESS". The patch attached here, scares the user about something which he does need to worry about. i.e, returning -EIO on disk I/O errors while reading the partition information. Signed-off-by: Suzuki K P <suzuki@in.ibm.com> Cc: Erik Mouw <erik@harddisk-recovery.com> Cc: Christoph Hellwig <hch@lst.de> Cc: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--fs/partitions/check.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/partitions/check.c b/fs/partitions/check.c
index 6fb4b6150d77..0b6113ba3b79 100644
--- a/fs/partitions/check.c
+++ b/fs/partitions/check.c
@@ -177,7 +177,7 @@ check_partition(struct gendisk *hd, struct block_device *bdev)
177 else if (warn_no_part) 177 else if (warn_no_part)
178 printk(" unable to read partition table\n"); 178 printk(" unable to read partition table\n");
179 kfree(state); 179 kfree(state);
180 return NULL; 180 return ERR_PTR(res);
181} 181}
182 182
183/* 183/*
@@ -494,6 +494,8 @@ int rescan_partitions(struct gendisk *disk, struct block_device *bdev)
494 disk->fops->revalidate_disk(disk); 494 disk->fops->revalidate_disk(disk);
495 if (!get_capacity(disk) || !(state = check_partition(disk, bdev))) 495 if (!get_capacity(disk) || !(state = check_partition(disk, bdev)))
496 return 0; 496 return 0;
497 if (IS_ERR(state)) /* I/O error reading the partition table */
498 return PTR_ERR(state);
497 for (p = 1; p < state->limit; p++) { 499 for (p = 1; p < state->limit; p++) {
498 sector_t size = state->parts[p].size; 500 sector_t size = state->parts[p].size;
499 sector_t from = state->parts[p].from; 501 sector_t from = state->parts[p].from;