提交 5127d002 编写于 作者: S Suzuki Kp 提交者: Linus Torvalds

[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: NSuzuki 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: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 1ecb9c0f
...@@ -177,7 +177,7 @@ check_partition(struct gendisk *hd, struct block_device *bdev) ...@@ -177,7 +177,7 @@ check_partition(struct gendisk *hd, struct block_device *bdev)
else if (warn_no_part) else if (warn_no_part)
printk(" unable to read partition table\n"); printk(" unable to read partition table\n");
kfree(state); kfree(state);
return NULL; return ERR_PTR(res);
} }
/* /*
...@@ -494,6 +494,8 @@ int rescan_partitions(struct gendisk *disk, struct block_device *bdev) ...@@ -494,6 +494,8 @@ int rescan_partitions(struct gendisk *disk, struct block_device *bdev)
disk->fops->revalidate_disk(disk); disk->fops->revalidate_disk(disk);
if (!get_capacity(disk) || !(state = check_partition(disk, bdev))) if (!get_capacity(disk) || !(state = check_partition(disk, bdev)))
return 0; return 0;
if (IS_ERR(state)) /* I/O error reading the partition table */
return PTR_ERR(state);
for (p = 1; p < state->limit; p++) { for (p = 1; p < state->limit; p++) {
sector_t size = state->parts[p].size; sector_t size = state->parts[p].size;
sector_t from = state->parts[p].from; sector_t from = state->parts[p].from;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册