[dm-devel] [PATCH 5/7] md: use block_device name vsprintf helper

Jan Kara jack at suse.cz
Tue Apr 14 09:43:15 UTC 2015


On Mon 13-04-15 16:31:38, Dmitry Monakhov wrote:
> 
> Signed-off-by: Dmitry Monakhov <dmonakhov at openvz.org>
...
> @@ -2610,7 +2597,6 @@ static void handle_read_error(struct mddev *mddev, struct r10bio *r10_bio)
>  	struct bio *bio;
>  	struct r10conf *conf = mddev->private;
>  	struct md_rdev *rdev = r10_bio->devs[slot].rdev;
> -	char b[BDEVNAME_SIZE];
>  	unsigned long do_sync;
>  	int max_sectors;
>  
> @@ -2623,7 +2609,6 @@ static void handle_read_error(struct mddev *mddev, struct r10bio *r10_bio)
>  	 * frozen.
>  	 */
>  	bio = r10_bio->devs[slot].bio;
> -	bdevname(bio->bi_bdev, b);
>  	bio_put(bio);
>  	r10_bio->devs[slot].bio = NULL;
>  
> @@ -2639,9 +2624,9 @@ static void handle_read_error(struct mddev *mddev, struct r10bio *r10_bio)
>  read_more:
>  	rdev = read_balance(conf, r10_bio, &max_sectors);
>  	if (rdev == NULL) {
> -		printk(KERN_ALERT "md/raid10:%s: %s: unrecoverable I/O"
> +		printk(KERN_ALERT "md/raid10:%s: %pg: unrecoverable I/O"
>  		       " read error for block %llu\n",
> -		       mdname(mddev), b,
> +		       mdname(mddev), bio->bi_bdev,
>  		       (unsigned long long)r10_bio->sector);
>  		raid_end_bio_io(r10_bio);
>  		return;
  So it seems to me that in the above, you'll reference bio->bi_bdev of an
already free bio since the code does bio_put() just after calling
bdevname()...

								Honza
-- 
Jan Kara <jack at suse.cz>
SUSE Labs, CR




More information about the dm-devel mailing list