]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
ufs: do not leave non-reclaimed vnodes with zero i_mode around.
authorkib <kib@FreeBSD.org>
Fri, 27 Dec 2019 16:43:34 +0000 (16:43 +0000)
committerkib <kib@FreeBSD.org>
Fri, 27 Dec 2019 16:43:34 +0000 (16:43 +0000)
commit47566a8355de3342f0227f7110db45db8d54517a
treed90f7d6f94d83dc75a87461afce6ccb443311f67
parente40fd5fd5984f6860d1bf1aada40358ae0b034f3
ufs: do not leave non-reclaimed vnodes with zero i_mode around.

After a recent change, vput() relocks even the exclusively locked
vnode before inactivating it.  Before that, UFS could safely
instantiate a vnode for cleared inode, then the last vput() after
ffs_vgetf() noted that ip->i_mode == 0 and recycled.  Now, it is
possible for other threads to note the half-constructed vnode, e.g. to
insert it into hash, which makes other threads to use it despite mode
is zero, before inactivation and reclaim.

Handle the found cases in SU code, by explicitly doing reclaim.
Assert that other places get fully constructed inode from ffs_vgetf(),
which cannot be cleared before dependencies are resolved.

Reported and tested by: pho
Reviewed by: mckusick
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
sys/ufs/ffs/ffs_softdep.c