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

Re: bug in/triggered by rename() (was :Re: dpkg-source -x *****s system



Mark Kettenis <kettenis@wins.uva.nl> writes:

> The diskfs_lookup() call locks TNP, but in the case of TNP == FNP it
> is never unlocked.  However I'm not sure what is the best way to do
> it.  Thomas, Roland, should we use diskfs_nput() instead of
> diskfs_nrele() or should we just put in an explicit mutex_unlock
> (&tnp->lock) ?

No, diskfs_nput is the right thing to do.

diskfs_nput is almost but not quite the same thing as doing an unlock
and nrele separately.  If you hold the last reference locked, you must
use diskfs_nput to get rid of it, because you are not allowed to nrele
the last reference without holding the lock, and you are not allowed
to do an unlock while holding no references.  If you look in diskfs.h
you can see the slightly different shenanigans that nput goes through
so it works right.

(In this particular case, we know that it isn't the last reference,
but that's not something we should actually be counting on, for the
sake of form.)

I've checked in a patch.

Thomas


Reply to: