linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Tejun Heo <tj@kernel.org>
Cc: Asias He <asias@redhat.com>, Jens Axboe <axboe@kernel.dk>,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	Christoph Hellwig <hch@infradead.org>
Subject: Re: [PATCH] block: Fix lock unbalance caused by lock disconnect
Date: Fri, 1 Jun 2012 12:28:32 +0300	[thread overview]
Message-ID: <20120601092832.GA20346@redhat.com> (raw)
In-Reply-To: <20120528102055.GA15202@dhcp-172-17-108-109.mtv.corp.google.com>

On Mon, May 28, 2012 at 07:20:55PM +0900, Tejun Heo wrote:
> Hello, Asias.
> 
> On Mon, May 28, 2012 at 10:15:18AM +0800, Asias He wrote:
> > >I don't think the patch description is correct.  The lock switcihng is
> > >inherently broken and the patch doesn't really fix the problem
> > >although it *might* make the problem less likely.  Trying to switch
> > >locks while there are other accessors of the lock is simply broken, it
> > >can never work without outer synchronization.
> > 
> > Since the lock switching is broken, is it a good idea to force all
> > the drivers to use the block layer provided lock? i.e. Change the
> > API from
> > blk_init_queue(rfn, driver_lock) to blk_init_queue(rfn). Any reason
> > not to use the block layer provided one.
> 
> I think hch tried to do that a while ago.  Dunno what happened to the
> patches.  IIRC, the whole external lock thing was about sharing a
> single lock across different request_queues.  Not sure whether it's
> actually beneficial enough or just a crazy broken optimization.

Looks like almost all drivers get it wrong.  And it's likely
something like a floppy driver doesn't need an optimization:
drivers/block/floppy.c:	disks[dr]->queue = blk_init_queue(do_fd_request, &floppy_lock);

The obvious use of this API is wrong. So how about introducing
a correct one, deprecating the broken one so we can start
slowly converting users?

Then if someone sees a real reason for the internal lock,
he will complain.




> > >Your patch might make
> > >the problem somewhat less likely simply because queue draining makes a
> > >lot of request_queue users go away.
> > 
> > Who will use the request_queue after blk_cleanup_queue()?
> 
> Anyone who still holds a ref might try to issue a new request on a
> dead queue.  ie. blkdev with filesystem mounted goes away and the FS
> issues a new read request after blk_cleanup_queue() finishes drainig.
> 
> Thanks.
> 
> -- 
> tejun
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
> 

  parent reply	other threads:[~2012-06-01  9:28 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-25  2:10 [PATCH] block: Fix lock unbalance caused by lock disconnect Asias He
2012-05-28  0:07 ` Tejun Heo
2012-05-28  2:15   ` Asias He
2012-05-28 10:20     ` Tejun Heo
2012-05-29  1:49       ` Asias He
2012-06-01  9:28       ` Michael S. Tsirkin [this message]
2012-05-28  2:20   ` [PATCH v2] block: Mitigate " Asias He
2012-05-28 10:22     ` Tejun Heo
2012-05-29  1:39       ` [PATCH V3] block: Mitigate lock unbalance caused by lock switching Asias He
2012-05-29  1:39         ` [PATCH] " Asias He
2012-05-29  1:41         ` [PATCH V3] " Tejun Heo
2012-05-29 13:45         ` Tim Gardner
2012-05-30  6:28           ` Asias He
2012-05-30  6:28             ` Tejun Heo
2012-05-30  6:50               ` Asias He
2012-06-01  9:31               ` Jens Axboe
2012-06-06  2:12                 ` Asias He

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=20120601092832.GA20346@redhat.com \
    --to=mst@redhat.com \
    --cc=asias@redhat.com \
    --cc=axboe@kernel.dk \
    --cc=hch@infradead.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tj@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;
as well as URLs for NNTP newsgroup(s).