public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <jens.axboe@oracle.com>
To: Geoff Levand <geoffrey.levand@am.sony.com>
Cc: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: blk: queue cleanup at device shutdown
Date: Thu, 18 Sep 2008 06:31:15 +0200	[thread overview]
Message-ID: <20080918043114.GG20055@kernel.dk> (raw)
In-Reply-To: <48C97CD9.8000808@am.sony.com>

On Thu, Sep 11 2008, Geoff Levand wrote:
> Hi Jens,
> 
> I'm wondering about what is needed in ps3disk_remove(), to clean
> up the request_queue (priv->queue) the driver uses.
> ps3disk_remove() is called from the main device_shutdown()
> routine via the ps3_system_bus remove routine.
> 
> The current code follows, and as can be seen, there is no check
> or handling of the queue before blk_cleanup_queue() is called.
> Can it be assumed that the queue is empty at this point,
> or is something else needed here?

The queue should be empty, at least there should be no one else
submitting IO for the device given the contet in which it is called. But
I suppose we could have pending IO (given the kexec context you
explained to me in person), so the below patch could be needed. It may
actually be a good idea to put this into blk_cleanup_queue(), since we
should have process context there anyway.

diff --git a/drivers/block/ps3disk.c b/drivers/block/ps3disk.c
index d797e20..dce64d0 100644
--- a/drivers/block/ps3disk.c
+++ b/drivers/block/ps3disk.c
@@ -537,6 +537,8 @@ static int ps3disk_remove(struct ps3_system_bus_device *_dev)
 	struct ps3_storage_device *dev = to_ps3_storage_device(&_dev->core);
 	struct ps3disk_private *priv = dev->sbd.core.driver_data;
 
+	blk_sync_queue(priv->queue);
+
 	mutex_lock(&ps3disk_mask_mutex);
 	__clear_bit(priv->gendisk->first_minor / PS3DISK_MINORS,
 		    &ps3disk_mask);

-- 
Jens Axboe


      reply	other threads:[~2008-09-18  4:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-11 20:17 blk: queue cleanup at device shutdown Geoff Levand
2008-09-18  4:31 ` Jens Axboe [this message]

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=20080918043114.GG20055@kernel.dk \
    --to=jens.axboe@oracle.com \
    --cc=Geert.Uytterhoeven@sonycom.com \
    --cc=geoffrey.levand@am.sony.com \
    --cc=linux-kernel@vger.kernel.org \
    /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