linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jerome Marchand <jmarchan@redhat.com>
To: Jens Axboe <jaxboe@fusionio.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Maxim Levitsky <maximlevitsky@gmail.com>,
	Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>,
	Vivek Goyal <vgoyal@redhat.com>
Subject: Re: [GIT PULL] Revert of the IO stat fix
Date: Tue, 30 Nov 2010 18:01:18 +0100	[thread overview]
Message-ID: <4CF52DDE.4070407@redhat.com> (raw)
In-Reply-To: <4CC49AAB.5090809@fusionio.com>

On 10/24/2010 10:44 PM, Jens Axboe wrote:
> diff --git a/block/genhd.c b/block/genhd.c
> index a8adf96..7d4d860 100644
> --- a/block/genhd.c
> +++ b/block/genhd.c
> @@ -930,14 +930,9 @@ static void disk_free_ptbl_rcu_cb(struct rcu_head *head)
>  	struct disk_part_tbl *ptbl =
>  		container_of(head, struct disk_part_tbl, rcu_head);
>  	struct gendisk *disk = ptbl->disk;
> -	struct request_queue *q = disk->queue;
> -	unsigned long flags;
>  
>  	kfree(ptbl);
> -
> -	spin_lock_irqsave(q->queue_lock, flags);
> -	elv_quiesce_end(q);
> -	spin_unlock_irqrestore(q->queue_lock, flags);
> +	elv_quiesce_end(disk->queue);

Here, the queue may be already gone. We should check it is still here and alive:

static void disk_free_ptbl_rcu_cb(struct rcu_head *head)
{
	struct disk_part_tbl *ptbl =
		container_of(head, struct disk_part_tbl, rcu_head);
	struct gendisk *disk = ptbl->disk;
	struct request_queue *q = disk->queue;

	kfree(ptbl);
	if (q && !test_bit(QUEUE_FLAG_DEAD, &q->queue_flags))
		elv_quiesce_end(q);
}


>  }
>  
>  /**
> @@ -962,10 +957,7 @@ static void disk_replace_part_tbl(struct gendisk *disk,
>  	if (old_ptbl) {
>  		rcu_assign_pointer(old_ptbl->last_lookup, NULL);
>  
> -		spin_lock_irq(q->queue_lock);
>  		elv_quiesce_start(q);

Same as above.

I'm not sure that is enough, but on my test machine these changes fix the crash
at USB key device removal.

Regards,
Jerome

> -		spin_unlock_irq(q->queue_lock);
> -
>  		call_rcu(&old_ptbl->rcu_head, disk_free_ptbl_rcu_cb);
>  	}
>  }

  parent reply	other threads:[~2010-11-30 17:01 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-24 20:09 [GIT PULL] Revert of the IO stat fix Jens Axboe
2010-10-24 20:35 ` Linus Torvalds
2010-10-24 20:42   ` Jens Axboe
2010-10-24 20:44     ` Jens Axboe
2010-10-24 20:53       ` Linus Torvalds
2010-11-23 10:01       ` Jerome Marchand
2010-11-30 17:01       ` Jerome Marchand [this message]
2010-10-24 22:03     ` Maxim Levitsky
2010-10-25  0:07       ` Linus Torvalds
2010-10-25  0:55         ` Maxim Levitsky
2010-10-25  1:30           ` Maxim Levitsky
2010-10-25 19:24   ` Vivek Goyal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4CF52DDE.4070407@redhat.com \
    --to=jmarchan@redhat.com \
    --cc=isimatu.yasuaki@jp.fujitsu.com \
    --cc=jaxboe@fusionio.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maximlevitsky@gmail.com \
    --cc=torvalds@linux-foundation.org \
    --cc=vgoyal@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).