FreeBSD: incorporate changes to the VFS_QUOTACTL(9) KPI

VFS_QUOTACTL(9) has been updated to allow each filesystem to indicate
whether it has changed the busy state of the mount.  The filesystem
may still assume that its .vfs_quotactl entrypoint is always called
with the mount busied, but only needs to unbusy the mount (and clear
*mp_busy) if it does something that actually requires the mount to be
unbusied.  It no longer needs to blindly copy-paste the UFS protocol
for calling vfs_unbusy(9) for the Q_QUOTAOFF and Q_QUOTAON commands.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Signed-off-by: Jason Harmening <jason.harmening@gmail.com>
Closes #12052
This commit is contained in:
jharmening 2021-06-04 13:11:08 -07:00 committed by GitHub
parent 1f8e5b6cb8
commit 8dddb25d2c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 0 deletions

View File

@ -102,7 +102,12 @@ SYSCTL_INT(_vfs_zfs_version, OID_AUTO, zpl, CTLFLAG_RD, &zfs_version_zpl, 0,
"ZPL_VERSION"); "ZPL_VERSION");
/* END CSTYLED */ /* END CSTYLED */
#if __FreeBSD_version >= 1400018
static int zfs_quotactl(vfs_t *vfsp, int cmds, uid_t id, void *arg,
bool *mp_busy);
#else
static int zfs_quotactl(vfs_t *vfsp, int cmds, uid_t id, void *arg); static int zfs_quotactl(vfs_t *vfsp, int cmds, uid_t id, void *arg);
#endif
static int zfs_mount(vfs_t *vfsp); static int zfs_mount(vfs_t *vfsp);
static int zfs_umount(vfs_t *vfsp, int fflag); static int zfs_umount(vfs_t *vfsp, int fflag);
static int zfs_root(vfs_t *vfsp, int flags, vnode_t **vpp); static int zfs_root(vfs_t *vfsp, int flags, vnode_t **vpp);
@ -267,7 +272,11 @@ done:
} }
static int static int
#if __FreeBSD_version >= 1400018
zfs_quotactl(vfs_t *vfsp, int cmds, uid_t id, void *arg, bool *mp_busy)
#else
zfs_quotactl(vfs_t *vfsp, int cmds, uid_t id, void *arg) zfs_quotactl(vfs_t *vfsp, int cmds, uid_t id, void *arg)
#endif
{ {
zfsvfs_t *zfsvfs = vfsp->vfs_data; zfsvfs_t *zfsvfs = vfsp->vfs_data;
struct thread *td; struct thread *td;
@ -291,8 +300,10 @@ zfs_quotactl(vfs_t *vfsp, int cmds, uid_t id, void *arg)
break; break;
default: default:
error = EINVAL; error = EINVAL;
#if __FreeBSD_version < 1400018
if (cmd == Q_QUOTAON || cmd == Q_QUOTAOFF) if (cmd == Q_QUOTAON || cmd == Q_QUOTAOFF)
vfs_unbusy(vfsp); vfs_unbusy(vfsp);
#endif
goto done; goto done;
} }
} }
@ -351,11 +362,15 @@ zfs_quotactl(vfs_t *vfsp, int cmds, uid_t id, void *arg)
case Q_QUOTAON: case Q_QUOTAON:
// As far as I can tell, you can't turn quotas on or off on zfs // As far as I can tell, you can't turn quotas on or off on zfs
error = 0; error = 0;
#if __FreeBSD_version < 1400018
vfs_unbusy(vfsp); vfs_unbusy(vfsp);
#endif
break; break;
case Q_QUOTAOFF: case Q_QUOTAOFF:
error = ENOTSUP; error = ENOTSUP;
#if __FreeBSD_version < 1400018
vfs_unbusy(vfsp); vfs_unbusy(vfsp);
#endif
break; break;
case Q_SETQUOTA: case Q_SETQUOTA:
error = copyin(arg, &dqblk, sizeof (dqblk)); error = copyin(arg, &dqblk, sizeof (dqblk));