[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20070527022502.GB10867@fieldses.org>
Date: Sat, 26 May 2007 22:25:02 -0400
From: "J. Bruce Fields" <bfields@...ldses.org>
To: David Howells <dhowells@...hat.com>
Cc: akpm@...l.org, linux-kernel@...r.kernel.org,
linux-fsdevel@...r.kernel.org
Subject: Re: [PATCH] AFS: Implement file locking
On Sun, May 27, 2007 at 12:55:30AM +0100, David Howells wrote:
> J. Bruce Fields <bfields@...ldses.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.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists