* [PATCH 2/2] /block/ioctl.c and /fs/partition/check.c
@ 2008-05-13 20:02 Abdel Benamrouche
0 siblings, 0 replies; only message in thread
From: Abdel Benamrouche @ 2008-05-13 20:02 UTC (permalink / raw)
To: akpm; +Cc: linux-kernel, trivial, Abdel Benamrouche
check value returned by add_partion()
Signed-off-by: Abdel Benamrouche <draconux@gmail.com>
---
block/ioctl.c | 5 +++--
fs/partitions/check.c | 8 +++++++-
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/block/ioctl.c b/block/ioctl.c
index 52d6385..77185e5 100644
--- a/block/ioctl.c
+++ b/block/ioctl.c
@@ -17,6 +17,7 @@ static int blkpg_ioctl(struct block_device *bdev, struct blkpg_ioctl_arg __user
long long start, length;
int part;
int i;
+ int err;
if (!capable(CAP_SYS_ADMIN))
return -EACCES;
@@ -61,9 +62,9 @@ static int blkpg_ioctl(struct block_device *bdev, struct blkpg_ioctl_arg __user
}
}
/* all seems OK */
- add_partition(disk, part, start, length, ADDPART_FLAG_NONE);
+ err = add_partition(disk, part, start, length, ADDPART_FLAG_NONE);
mutex_unlock(&bdev->bd_mutex);
- return 0;
+ return err;
case BLKPG_DEL_PARTITION:
if (!disk->part[part-1])
return -ENXIO;
diff --git a/fs/partitions/check.c b/fs/partitions/check.c
index a1396a9..94f4e3c 100644
--- a/fs/partitions/check.c
+++ b/fs/partitions/check.c
@@ -500,8 +500,14 @@ int rescan_partitions(struct gendisk *disk, struct block_device *bdev)
if (from + size > get_capacity(disk)) {
printk(" %s: p%d exceeds device capacity\n",
disk->disk_name, p);
+ continue;
+ }
+ res = add_partition(disk, p, from, size, state->parts[p].flags);
+ if (res) {
+ printk(" %s: p%d could not be added. got error %d\n",
+ disk->disk_name, p, -res);
+ continue;
}
- add_partition(disk, p, from, size, state->parts[p].flags);
#ifdef CONFIG_BLK_DEV_MD
if (state->parts[p].flags & ADDPART_FLAG_RAID)
md_autodetect_dev(bdev->bd_dev+p);
--
1.5.4.3
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2008-05-13 20:03 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-05-13 20:02 [PATCH 2/2] /block/ioctl.c and /fs/partition/check.c Abdel Benamrouche
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome