tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Replace lockmgr for vnodes

On Sat Mar 01 2008 at 07:01:53 +0000, David Holland wrote:
> On Thu, Feb 28, 2008 at 10:44:14PM -0800, Jason Thorpe wrote:
>  > On Feb 28, 2008, at 10:15 PM, David Holland wrote:
>  > >I am still not convinced of this, for two reasons: first, I don't
>  > >think layers are going to work unless locks are exported and shared;
>  > >and second, if every fs does its own locking, it gives every fs the
>  > >opportunity to do it wrong, and there'll furthermore tend to be a lot
>  > >of cut&paste code with all the attendant problems.
>  > 
>  > The reason file systems can get it so wrong is because of the nutty  
>  > rules that we currently have.

I don't buy the "nutty rules" argument.  The only really troublesome
part was lookup, and that was whacked into submission by chs.  You can
generally divide the ops into a few categories: lookup, creaters,
removers, rename (and link), symmetric locking, inactive.  And of those
inactive could be made symmetric now that it doesn't try to recycle itself
(and I even have a diff for that somewhere).

The only real fun part left is namei flags and . insanity.

> Yes and no. What you say is perfectly true, and the mess that
> currently exists should not be allowed to contine.
> That said, by "get it wrong" I mean things like ufs_rename(), or
> worse, msdosfs_rename(), rename being particularly difficult to get
> right - things where the per-fs code gets locks in the wrong order, or
> gets the wrong locks, or doesn't bother getting them at all, or drops
> things on the floor when it's halfway done, or whatever other creative
> lossage someone manages to invent.

I don't buy that either.  You need to manipulate locks inside the fs
for rename anyway.  That's the hard part.  Complying with the locking
protocol is trivial compared to that.

> If the locking is provided in fs-independent code, then it only needs
> to be debugged once.

And I don't buy that either.  I think there are more locking problems
outside of file systems than in them (because of namei).

That said, if all approaches suck, why not let the file system decide.
It should know best what kind of locking it needs.  Well, that's my
opinion for the current mess.  If you're going to propose something
wildly different, I'm all ears.

Antti Kantee <>                     Of course he runs 
    "la qualité la plus indispensable du cuisinier est l'exactitude"

Home | Main Index | Thread Index | Old Index