All of lore.kernel.org
 help / color / mirror / Atom feed
From: "J. Bruce Fields" <bfields@fieldses.org>
To: David Howells <dhowells@redhat.com>
Cc: akpm@osdl.org, linux-kernel@vger.kernel.org,
	linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH] AFS: Implement file locking
Date: Sat, 26 May 2007 22:25:02 -0400	[thread overview]
Message-ID: <20070527022502.GB10867@fieldses.org> (raw)
In-Reply-To: <7436.1180223730@redhat.com>

On Sun, May 27, 2007 at 12:55:30AM +0100, David Howells wrote:
> J. Bruce Fields <bfields@fieldses.org> wrote:
> 
> > > +	if (!afs_lock_manager) {
> > > +		afs_lock_manager = create_singlethread_workqueue("kafs_lockd");
> > > +		if (!afs_lock_manager)
> > > +			return -ENOMEM;
> > > +	}
> > > +	return 0;
> > 
> > Doesn't this need some locking?
> 
> Oops.  Yes.  It used to be inside the lock_kernel() section, but has since
> escaped.

The BKL wouldn't help, since create_singlethread_workqueue() can sleep.
Or am I missing something?

> > Do you allow upgrades and downgrades?  (Just curious.)
> 
> AFS does not, as far as I know.

So if I request a write lock while holding a read lock, my request will
be denied?

> > > +		/* if we've already got a readlock on the server and no waiting
> > > +		 * writelocks, then we might be able to instantly grant another
> > 
> > Is that comment correct?  (You don't really test for "waiting
> > writelocks", do you?)
> 
> Locally, yes.  'if (list_empty(&vnode->pending_locks))' covers it quite
> handily.

Oops, right, I was overlooking that check.

This is a little strange, though--if there's somebody waiting for a
write lock on an inode (because somebody else already holds a read lock
on it), that shouldn't block requests for read locks.

--b.

  reply	other threads:[~2007-05-27  2:25 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-24 16:55 [PATCH] AFS: Implement file locking David Howells
2007-05-25  7:31 ` Jiri Slaby
2007-05-26  2:23 ` J. Bruce Fields
2007-05-26  3:11   ` Kyle Moffett
2007-05-27  0:12     ` David Howells
2007-05-26 23:55   ` David Howells
2007-05-27  2:25     ` J. Bruce Fields [this message]
2007-05-27  8:51       ` David Howells
2007-05-27 16:12         ` J. Bruce Fields
2007-05-29  9:34           ` David Howells
2007-05-29 20:08             ` J. Bruce Fields
2007-05-29 12:43           ` David Howells

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=20070527022502.GB10867@fieldses.org \
    --to=bfields@fieldses.org \
    --cc=akpm@osdl.org \
    --cc=dhowells@redhat.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --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 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.