[RFC] PATCH to fix rescan_partitions to return errors properly -take 2

From: Suzuki Kp
Date: Thu Oct 05 2006 - 16:33:00 EST


Erik,


Erik Mouw wrote:
On Wed, Oct 04, 2006 at 10:37:49AM -0700, Suzuki Kp wrote:

Erik Mouw wrote:

I disagree. It's perfectly valid for a disk not to have a partition
table (for example: components of a RAID5 MD device) and we shouldn't
scare users about that. Also an unrecognised partition table format
(DEC VMS, Novell Netware, etc.) is not a reason to throw an error, it's
just unrecognised and as far as the kernel knows it's unpartioned.


[...]


Thank you very much for the inputs.

As per the discussion I have made the changes to the patch.

This change needs to be implemented in some of the partition checkers which doesn't do that already.

Btw, do you think it is a good idea to let the other partition checkers run, even if one of them has failed ?

Right now, the check_partition runs the partition checkers in a sequential manner, until it finds a success or an error.


Comments ?

Thanks,

Suzuki


* Fix rescan_partition to propagate the low level I/O error.



Signed Off by: Suzuki K P <suzuki@xxxxxxxxxx>

Index: linux-2.6.18/fs/partitions/check.c
===================================================================
--- linux-2.6.18.orig/fs/partitions/check.c 2006-09-26 04:41:55.000000000 +0530
+++ linux-2.6.18/fs/partitions/check.c 2006-10-06 01:22:06.000000000 +0530
@@ -177,7 +177,7 @@
else if (warn_no_part)
printk(" unable to read partition table\n");
kfree(state);
- return NULL;
+ return ERR_PTR(res);
}

/*
@@ -460,6 +460,9 @@
disk->fops->revalidate_disk(disk);
if (!get_capacity(disk) || !(state = check_partition(disk, bdev)))
return 0;
+ if (IS_ERR(state))
+ /* I/O error reading the partition table */
+ return -EIO;
for (p = 1; p < state->limit; p++) {
sector_t size = state->parts[p].size;
sector_t from = state->parts[p].from;