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)
Thu, Nov 7, 5:26 PM
Unknown Object (File)
Thu, Oct 24, 2:59 PM
Unknown Object (File)
Thu, Oct 24, 2:59 PM
Unknown Object (File)
Thu, Oct 24, 2:59 PM
Unknown Object (File)
Thu, Oct 24, 2:41 PM
Unknown Object (File)
Sep 17 2024, 3:29 PM
Unknown Object (File)
Sep 13 2024, 7:26 PM
Unknown Object (File)
Sep 10 2024, 8:37 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.