Re: [PATCH] vfs: Release semaphore before returning in lock_mount().

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

 



On Sun, Jun 24, 2012 at 02:48:35PM +0530, santosh nayak wrote:
> From: Santosh Nayak <santoshprasadnayak@xxxxxxxxx>
> 
> There is a missing "up_write()" here. Semaphore should be released
> before returning.

Even in a function called lock_<something> with the main effect being
to grab that semaphore (and a mutex, while we are at it)? ;-)

The whole point of lock_mount() is to get us the situation when
	1) path->{mnt,dentry} isn't overmounted by anything
	2) path->dentry is known to be alive
	3) we are guaranteed that these conditions will hold until
we do unlock_mount().
(1) is preserved by ->i_mutex; (2) - by namespace_sem.  Retry loop in
there is for handling the case when someone has raced with us and
mounted something on top of path after we'd looked it up and before
we got namespace_sem.  unlock_mount() right next to it drops both
->i_mutex and namespace_sem; these two are paired in all callers
(easily verified, since they are static in file; only 4 callers
of each in there), so we are OK.

IOW, NAK.
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux