[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20071030080742.GE4993@kernel.dk>
Date: Tue, 30 Oct 2007 09:07:42 +0100
From: Jens Axboe <jens.axboe@...cle.com>
To: Dirk Hohndel <hohndel@...ux.intel.com>
Cc: Cornelia Huck <cornelia.huck@...ibm.com>,
Andries Brouwer <aeb@....nl>, Al Viro <viro@....linux.org.uk>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] add_partition silently ignored errors
On Mon, Oct 29 2007, Dirk Hohndel wrote:
> diff --git a/block/ioctl.c b/block/ioctl.c
> index 52d6385..bb3933e 100644
> --- a/block/ioctl.c
> +++ b/block/ioctl.c
> @@ -61,7 +61,10 @@ 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);
> + if (add_partition(disk, part, start, length, ADDPART_FLAG_NONE)) {
> + mutex_unlock(&bdev->bd_mutex);
> + return -EBUSY;
> + }
> mutex_unlock(&bdev->bd_mutex);
> return 0;
> case BLKPG_DEL_PARTITION:
> diff --git a/fs/partitions/check.c b/fs/partitions/check.c
> index 722e12e..cd92471 100644
> --- a/fs/partitions/check.c
> +++ b/fs/partitions/check.c
> @@ -368,13 +368,13 @@ void delete_partition(struct gendisk *disk, int part)
> kobject_put(&p->kobj);
> }
>
> -void add_partition(struct gendisk *disk, int part, sector_t start, sector_t len, int flags)
> +int add_partition(struct gendisk *disk, int part, sector_t start, sector_t len, int flags)
> {
> struct hd_struct *p;
>
> p = kzalloc(sizeof(*p), GFP_KERNEL);
> if (!p)
> - return;
> + return -1;
Why not return the 'correct' error codes, instead of always -1 and
making that -EBUSY at the caller? This one should be -ENOMEM.
IIRC, Al recently vetoed a similar patch. As far as I'm concerned, with
the correct return values, the patch then looks fine to me.
--
Jens Axboe
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists