Re: [PATCH] xfs: clarify sb_qflags locking in xfs_qm_mount_quotas
From: Carlos Maiolino
Date: Mon Jun 29 2026 - 06:06:01 EST
On Sat, Jun 27, 2026 at 06:39:10PM -0400, Tsu-chieh Chen wrote:
> xfs_qm_mount_quotas() is only called from the mount path, so
> m_sb_lock is not needed for serialization when updating sb_qflags.
>
> The code still takes m_sb_lock around the sb_qflags update. Replace the
> old XXX comment with an explanation that the lock is taken to keep the
> mount-time update consistent with the runtime quota update paths.
>
> No functional change.
>
> Signed-off-by: Tsu-chieh Chen <tsuchieh.chen@xxxxxxxxx>
> ---
> fs/xfs/xfs_qm.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/fs/xfs/xfs_qm.c b/fs/xfs/xfs_qm.c
> index aa0d2976f1c3..c2bab12643d3 100644
> --- a/fs/xfs/xfs_qm.c
> +++ b/fs/xfs/xfs_qm.c
> @@ -1663,8 +1663,9 @@ xfs_qm_mount_quotas(
>
> write_changes:
> /*
> - * We actually don't have to acquire the m_sb_lock at all.
> - * This can only be called from mount, and that's single threaded. XXX
> + * Mount is single-threaded, so this does not need m_sb_lock for
> + * serialization. Take it anyway to keep sb_qflags updates consistent
> + * with the runtime quota update paths.
Why? What's the actual clarification this change makes? Indeed the XXX
does not need to be there but I don't see any improvement in this change
comment-wise. XXX removal could be embedded on any other patch that
touches code around it.
> */
> spin_lock(&mp->m_sb_lock);
> sbf = mp->m_sb.sb_qflags;
>
> base-commit: 804826eac53cff44f88f42989fcc601c2612c0ed
> --
> 2.43.0
>
>