All of lore.kernel.org
 help / color / mirror / Atom feed
From: James Smart <james.smart@emulex.com>
To: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: "linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
	"michaelc@cs.wisc.edu" <michaelc@cs.wisc.edu>
Subject: Re: [PATCH 5/7] lpfc 8.3.13: BSG management fixes
Date: Wed, 19 May 2010 14:35:29 -0400	[thread overview]
Message-ID: <4BF42F71.2020106@emulex.com> (raw)
In-Reply-To: <20100517152627C.fujita.tomonori@lab.ntt.co.jp>



FUJITA Tomonori wrote:
> The tricky part is, when a sas LLD frees a remote port, there might be
> some user-space applications that still open a bsg device. So you
> can't call blk_cleanup_queue() at that time.
> 
> You might hit the similar problem to the commit
> 93c20a59af4624aedf53f8320606b355aa951bc1. The following fix works?

It is similar to this problem....   There is an application with the bsg 
device open, but no request outstanding, when a request is made to the driver 
to unload.  The driver detaches, with the transport calling 
bsg_unregister_queue() (which succeeds happily) and the driver fully unloads.

But, at some point the app does do a bsg request.

However - things are all messed up at this point...   the bd->queue is no 
longer valid as the owner of the queue (the transport) has returned the memory 
to the kernel. Depending on what else is allocating, it may be used by 
something else.  Thus you get extremely weird/bad behavior when the queue is 
referenced later in the bsg request processing.

I don't know how the patch, which changes when blk_cleanup_queue() is done, 
would fix things, as the larger issue of the queue structure possibly being 
realloc'd by someone else is the killer.  I did test it in our scenario, and 
it failed too.

If I have identified this issue properly (agree ?) I see a couple of options:
a) Set bd->queue pointer to NULL on bsg_unregister_queue(). Then add checks in 
the file op calls.

b) Track opens against the queue, and fail the deregister if open count > 0. 
Rather ugly as the interface is a void right now, and the callers need to deal 
with it too. I know in the fc_transport, we're ill equipped to deal with the 
deregister failing and trying to remove it sometime later.

c) Is all we need to do is take another parent reference in bsg_open, and 
remove it in bsg_release ?  Given the multiple pieces that must play well on 
this, I'm not sure it really works.

Insight appreciated...

-- james s


  reply	other threads:[~2010-05-19 18:35 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-12 13:32 [PATCH 5/7] lpfc 8.3.13: BSG management fixes James Smart
2010-05-12 17:38 ` Mike Christie
2010-05-12 19:00   ` James Smart
2010-05-14  9:29 ` FUJITA Tomonori
2010-05-14 13:46   ` James Smart
2010-05-14 14:30     ` James Smart
2010-05-17  6:24       ` FUJITA Tomonori
2010-05-19 18:35         ` James Smart [this message]
2010-05-20 11:41           ` FUJITA Tomonori

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=4BF42F71.2020106@emulex.com \
    --to=james.smart@emulex.com \
    --cc=fujita.tomonori@lab.ntt.co.jp \
    --cc=linux-scsi@vger.kernel.org \
    --cc=michaelc@cs.wisc.edu \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.