From mboxrd@z Thu Jan 1 00:00:00 1970 From: "J. Bruce Fields" Subject: Re: file locks: Use wait_event_interruptible_timeout() Date: Tue, 15 Jan 2008 13:54:48 -0500 Message-ID: <20080115185448.GL17937@fieldses.org> References: <48611B2F-1587-48C5-9F30-8DCFA1121CF6@Sun.COM> <20071129190848.GA17907@fieldses.org> <71BCABE5-52AD-4573-8DC0-5C57152A397B@Sun.COM> <20080114204419.GD16926@fieldses.org> <20080115042605.GT18741@parisc-linux.org> <20080115042830.GU18741@parisc-linux.org> <20080115144851.GB10971@fieldses.org> <20080115150447.GZ18741@parisc-linux.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Oleg Drokin , linux-fsdevel@vger.kernel.org To: Matthew Wilcox Return-path: Received: from mail.fieldses.org ([66.93.2.214]:53295 "EHLO fieldses.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750801AbYAOSyu (ORCPT ); Tue, 15 Jan 2008 13:54:50 -0500 Content-Disposition: inline In-Reply-To: <20080115150447.GZ18741@parisc-linux.org> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: 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.