diff options
author | Kirk McKusick <mckusick@FreeBSD.org> | 2021-04-14 22:22:12 +0000 |
---|---|---|
committer | Kirk McKusick <mckusick@FreeBSD.org> | 2021-04-14 22:25:08 +0000 |
commit | 14d0cd7225e250015eb6d9c79a7eb4e944211b23 (patch) | |
tree | 4239a21534557b7b528e3b7c87bbdb03ead9eca9 /sys/ufs | |
parent | 8e84712d01eb150f57dfe2244cd0c09b756fe40c (diff) | |
download | src-14d0cd7225e250015eb6d9c79a7eb4e944211b23.tar.gz src-14d0cd7225e250015eb6d9c79a7eb4e944211b23.zip |
Ensure that the mount command shows "with quotas" when quotas are enabled.
When quotas are enabled with the quotaon(8) command, it sets the
MNT_QUOTA flag in the mount structure mnt_flag field. The mount
structure holds a cached copy of the filesystem statfs structure
in mnt_stat that includes a copy of the mnt_flag field in
mnt_stat.f_flags. The mnt_stat structure may not be updated for
hours. Since the mount command requests mount details using the
MNT_NOWAIT option, it gets the mount's mnt_stat statfs structure
whose f_flags field does not yet show the MNT_QUOTA flag being set
in mnt_flag.
The fix is to have quotaon(8) set the MNT_QUOTA flag in both mnt_flag
and in mnt_stat.f_flags so that it will be immediately visible to
callers of statfs(2).
Reported by: Christos Chatzaras
Tested by: Christos Chatzaras
PR: 254682
MFC after: 3 days
Sponsored by: Netflix
Diffstat (limited to 'sys/ufs')
-rw-r--r-- | sys/ufs/ufs/ufs_quota.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/sys/ufs/ufs/ufs_quota.c b/sys/ufs/ufs/ufs_quota.c index 47c8133adc11..4dff74f75945 100644 --- a/sys/ufs/ufs/ufs_quota.c +++ b/sys/ufs/ufs/ufs_quota.c @@ -562,6 +562,7 @@ quotaon(struct thread *td, struct mount *mp, int type, void *fname) VOP_UNLOCK(vp); MNT_ILOCK(mp); mp->mnt_flag |= MNT_QUOTA; + mp->mnt_stat.f_flags |= MNT_QUOTA; MNT_IUNLOCK(mp); vpp = &ump->um_quotas[type]; @@ -764,6 +765,7 @@ quotaoff_inchange(struct thread *td, struct mount *mp, int type) if (i == MAXQUOTAS) { MNT_ILOCK(mp); mp->mnt_flag &= ~MNT_QUOTA; + mp->mnt_stat.f_flags &= ~MNT_QUOTA; MNT_IUNLOCK(mp); } UFS_UNLOCK(ump); |