linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC] PATCH to fix rescan_partitions to return errors properly
@ 2006-10-04  1:00 Suzuki Kp
  2006-10-04 13:09 ` Erik Mouw
  0 siblings, 1 reply; 13+ messages in thread
From: Suzuki Kp @ 2006-10-04  1:00 UTC (permalink / raw)
  To: lkml, linux-fsdevel; +Cc: Andrew Morton

[resending]

Hi,

Currently the rescan_partition returns 0 (success), even if it is unable
to rescan the partition information ( may be due to disks offline, I/O
error reading the table or unknown partition ). This would make ioctl()
calls succeed for BLKRRPART requests even if partitions were not scanned
properly, which is not a good thing to do.

Attached here is patch to fix the issue. The patch makes
rescan_partition to return -EINVAL for unknown partitions and -EIO for
disk I/O errors ( or when disks are offline ).

Comments ?

Thanks,

Suzuki K P <suzuki@in.ibm.com>
Linux Technology Centre,
IBM Systems & Technology Labs.




* Fix recscan_partitions to return error when the partition is unknown
or there is an I/O error reading the partition information.


Signed Off by : Suzuki K P <suzuki@in.ibm.com>

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-09-26 05:09:29.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);
  }

  /*
@@ -458,8 +458,13 @@
                 delete_partition(disk, p);
         if (disk->fops->revalidate_disk)
                 disk->fops->revalidate_disk(disk);
-       if (!get_capacity(disk) || !(state = check_partition(disk, bdev)))
-               return 0;
+       if (!get_capacity(disk))
+               return -EINVAL;
+       state = check_partition(disk, bdev);
+       if (!state)
+               return -EINVAL;
+       if (IS_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;

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2006-10-07  2:46 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-04  1:00 [RFC] PATCH to fix rescan_partitions to return errors properly Suzuki Kp
2006-10-04 13:09 ` Erik Mouw
2006-10-04 16:50   ` Suzuki Kp
2006-10-04 17:08     ` Erik Mouw
2006-10-04 17:37       ` Suzuki Kp
2006-10-05 10:40         ` Erik Mouw
2006-10-05 20:32           ` [RFC] PATCH to fix rescan_partitions to return errors properly - take 2 Suzuki Kp
2006-10-05 22:07             ` Andrew Morton
2006-10-06 12:53             ` Erik Mouw
2006-10-06 17:43               ` Suzuki K P
2006-10-06 21:07                 ` Erik Mouw
2006-10-07  1:46                   ` [RFC] Fix check_partition routines ( was Re: [RFC] PATCH to fix rescan_partitions to return errors properly - take 2) Suzuki K P
2006-10-07  2:45                     ` Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).