Page MenuHomeFreeBSD

Fix state of dquot-less vnodes after failed quotaoff.
ClosedPublic

Authored by kib on Sep 17 2018, 7:59 PM.
Tags
None
Referenced Files
Unknown Object (File)
Dec 31 2023, 5:31 PM
Unknown Object (File)
Nov 8 2023, 12:47 PM
Unknown Object (File)
Sep 25 2023, 12:34 PM
Unknown Object (File)
Sep 16 2023, 7:34 AM
Unknown Object (File)
Sep 5 2023, 6:40 PM
Unknown Object (File)
Dec 27 2022, 12:11 PM
Unknown Object (File)
Nov 27 2022, 3:59 PM

Details

Summary

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 quotaon().

Also fix ZFS VFS op quotactl to follow busy protocol.

Reported and tested by: pho (previous version)

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

This seems like the correct approach to me.

This revision is now accepted and ready to land.Sep 18 2018, 2:41 PM

ZFS part looks good to me.

This revision was automatically updated to reflect the committed changes.