Re: Re: [PATCH] Fix Null pointer Exception

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Alasdair G Kergon wrote:
> On Tue, Oct 07, 2008 at 10:18:40PM +0100, Alasdair G Kergon wrote:
>> Meanwhile I will not be applying that patch, though I may take a patch
>> to provide clean diagnostics should a situation like this occur again.
> 
> I'm thinking of something like this:
> 
> 
> From: Alasdair G Kergon <agk@xxxxxxxxxx>
> 
> Detect and report buggy drivers that destroy their request_queue.
> 
> Signed-off-by: Alasdair G Kergon <agk@xxxxxxxxxx>
> Cc: Stefan Raspl <raspl@xxxxxxxxxxxxxxxxxx>
> Cc: Jens Axboe <jens.axboe@xxxxxxxxxx>
> Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
> 
> ---
>  drivers/md/dm-table.c |   24 ++++++++++++++++++++++--
>  1 files changed, 22 insertions(+), 2 deletions(-)
> 
> Index: linux-2.6.27-rc8/drivers/md/dm-table.c
> ===================================================================
> --- linux-2.6.27-rc8.orig/drivers/md/dm-table.c	2008-10-09 14:53:35.000000000 +0100
> +++ linux-2.6.27-rc8/drivers/md/dm-table.c	2008-10-09 14:56:26.000000000 +0100
> @@ -478,6 +478,13 @@ void dm_set_device_limits(struct dm_targ
>  {
>  	struct request_queue *q = bdev_get_queue(bdev);
>  	struct io_restrictions *rs = &ti->limits;
> +	char b[BDEVNAME_SIZE];
> +
> +	if (unlikely(!q)) {
> +		DMWARN("%s: Cannot set limits for nonexistent device %s",
> +		       dm_device_name(ti->table->md), bdevname(bdev, b));
> +		return;
> +	}
> 
>  	/*
>  	 * Combine the device limits low.
> @@ -943,7 +950,14 @@ int dm_table_any_congested(struct dm_tab
> 
>  	list_for_each_entry(dd, devices, list) {
>  		struct request_queue *q = bdev_get_queue(dd->bdev);
> -		r |= bdi_congested(&q->backing_dev_info, bdi_bits);
> +		char b[BDEVNAME_SIZE];
> +
> +		if (likely(q))
> +			r |= bdi_congested(&q->backing_dev_info, bdi_bits);
> +		else
> +			DMWARN_LIMIT("%s: any_congested: nonexistent device %s",
> +				     dm_device_name(t->md),
> +				     bdevname(dd->bdev, b));
>  	}
> 
>  	return r;
> @@ -956,8 +970,14 @@ void dm_table_unplug_all(struct dm_table
> 
>  	list_for_each_entry(dd, devices, list) {
>  		struct request_queue *q = bdev_get_queue(dd->bdev);
> +		char b[BDEVNAME_SIZE];
> 
> -		blk_unplug(q);
> +		if (likely(q))
> +			blk_unplug(q);
> +		else
> +			DMWARN_LIMIT("%s: Cannot unplug nonexistent device %s",
> +				     dm_device_name(t->md),
> +				     bdevname(dd->bdev, b));
>  	}
>  }
> 

Looks good to me!

Ciao,
Stefan


-- 
Linux on System z
IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Martin Jetter
Geschäftsführer: Erich Baier
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294

--
dm-devel mailing list
dm-devel@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/dm-devel

[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux