]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Fix state of dquot-less vnodes after failed quotaoff.
authorkib <kib@FreeBSD.org>
Wed, 19 Sep 2018 14:36:57 +0000 (14:36 +0000)
committerkib <kib@FreeBSD.org>
Wed, 19 Sep 2018 14:36:57 +0000 (14:36 +0000)
commit610ca65f57a112751a2051ab6626dfc571d7ca2e
tree4f6472299d7beb72cfe2f3590fff68a228e94213
parente6bae3b6e7c57b8dcd3e50b883d885382116a491
Fix state of dquot-less vnodes after failed quotaoff.

UFS quotaoff iterates over all mp vnodes, and derefences and clears
the pointers to corresponding dquots. If SU work items transiently
reference some of dquots,quotaoff() would eventually fail, but all
processed vnodes are already stripped from dquots.  The state is
problematic, since quotas are left enabled, but there is no dquots
where blocks and inodes can be accounted.  The result is assertion
failures and NULL pointer dereferences.

Fix it by suspending writes around quotaoff() call.  Since the
filesystem is synced, no dandling references to dquots from SU
workitems can left behind, which means that quotaoff succeeds.

The complication there is that quotaoff VFS op is performed with the
mount point busied, while to suspend, we need to start write on the
mp.  If vn_start_write() is called on busied mp, system might deadlock
against parallel unmount request.  Handle this by unbusy-ing mp before
starting write, which in turn requires changing the quotaoff()
interface to return with the mount point not busied, same as was done
for quotaon().

Reviewed by: mckusick
Reported and tested by: pho
Sponsored by: The FreeBSD Foundation
Approved by: re (gjb)
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D17208
sys/kern/vfs_syscalls.c
sys/ufs/ufs/ufs_quota.c
sys/ufs/ufs/ufs_vfsops.c