Skip to contentSkip to conversation

xfs: clarify sb_qflags locking in xfs_qm_mount_quotas

PATCH In review Tsu-chieh Chen 2 participants 2 messages Jun 27 – Jun 29 XFS filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfs: clarify sb_qflags locking in xfs_qm_mount_quotas

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.

---
 fs/xfs/xfs_qm.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
fs/xfs/xfs_qm.c +3 -2
index aa0d2976f1c3..c2bab12643d3 100644
@@ -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.
 	 */
 	spin_lock(&mp->m_sb_lock);
 	sbf = mp->m_sb.sb_qflags;

base-commit: 804826eac53cff44f88f42989fcc601c2612c0ed

Signature · 1 line
2.43.0
maintainer
#1 lore raw
Quoted 19 lines · Tsu-chieh Chen

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.

---
 fs/xfs/xfs_qm.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
fs/xfs/xfs_qm.c +0 -0
index aa0d2976f1c3..c2bab12643d3 100644

fs/xfs/xfs_qm.c xfs_qm_mount_quotas( · line 1668

Quoted 8 lines
fs/xfs/xfs_qm.c +3 -2
@@ -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.

Quoted 9 lines
fs/xfs/xfs_qm.c +0 -0
 	 */
 	spin_lock(&mp->m_sb_lock);
 	sbf = mp->m_sb.sb_qflags;

base-commit: 804826eac53cff44f88f42989fcc601c2612c0ed

Signature · 1 line
2.43.0