All of lore.kernel.org
 help / color / mirror / Atom feed
From: "J. Bruce Fields" <bfields@fieldses.org>
To: Matthew Wilcox <matthew@wil.cx>
Cc: Oleg Drokin <Oleg.Drokin@Sun.COM>, linux-fsdevel@vger.kernel.org
Subject: Re: file locks: Use wait_event_interruptible_timeout()
Date: Tue, 15 Jan 2008 13:54:48 -0500	[thread overview]
Message-ID: <20080115185448.GL17937@fieldses.org> (raw)
In-Reply-To: <20080115150447.GZ18741@parisc-linux.org>

On Tue, Jan 15, 2008 at 08:04:47AM -0700, Matthew Wilcox wrote:
> On Tue, Jan 15, 2008 at 09:48:51AM -0500, J. Bruce Fields wrote:
> > On Mon, Jan 14, 2008 at 09:28:30PM -0700, Matthew Wilcox wrote:
> > > interruptible_sleep_on_locked() is just an open-coded
> > > wait_event_interruptible_timeout() with a few assumptions since we know
> > > we hold the BKL.  locks_block_on_timeout() is only used in one place, so
> > > it's actually simpler to inline it into its caller.
> > 
> > Makes sense, thanks.  So the assumption we were depending on the BKL for
> > was that we could count on the wake-up not coming till after we block,
> > so we could skip a check ->fl_next that's normally needed to resolve the
> > usual sleeping-on-some-condition race?
> 
> That's right.

OK, thanks, applied just with the "few assumptions" replaced by a
description of that particular problem:

	"interruptible_sleep_on_locked() is just an open-coded
	wait_event_interruptible_timeout(), with the one difference that
	interruptible_sleep_on_locked() doesn't bother to check the
	condition on which it waits, depending instead on the BKL to
	avoid the case where it blocks after the wakeup has already been
	called.

	locks_block_on_timeout() is only used in one place, so it's
	actually simpler to inline it into its caller."

Pending locks patches available from:

	git://linux-nfs.org/~bfields/linux.git locks


--b.

  reply	other threads:[~2008-01-15 18:54 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-29 18:46 Leak in nlmsvc_testlock for async GETFL case Oleg Drokin
2007-11-29 19:08 ` J. Bruce Fields
2008-01-12  2:57   ` Oleg Drokin
2008-01-14 20:44     ` J. Bruce Fields
2008-01-15  4:26       ` Matthew Wilcox
2008-01-15  4:28         ` file locks: Use wait_event_interruptible_timeout() Matthew Wilcox
2008-01-15 14:48           ` J. Bruce Fields
2008-01-15 15:04             ` Matthew Wilcox
2008-01-15 18:54               ` J. Bruce Fields [this message]
2008-01-15  4:29         ` file locks: Split flock_find_conflict out of flock_lock_file Matthew Wilcox
2008-01-15 18:50           ` J. Bruce Fields
2008-01-15 14:42         ` Leak in nlmsvc_testlock for async GETFL case J. Bruce Fields
2007-12-03 17:00 ` Felix Blyakher
2007-12-03 17:49   ` Oleg Drokin

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=20080115185448.GL17937@fieldses.org \
    --to=bfields@fieldses.org \
    --cc=Oleg.Drokin@Sun.COM \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=matthew@wil.cx \
    /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.