Skip to contentSkip to conversation

xfs: only reset sb_quotaino when both group/proj in-core inos are null

PATCH New Brian Foster 1 participant 1 message Jan 9, 2015 XFS filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfs: only reset sb_quotaino when both group/proj in-core inos are null

Several xfstests tests report disconnected quota inodes on the post-test xfs_repair check on v4 filesystems. These include tests generic/232, xfs/007, xfs/108 and xfs/199. This occurs due to the sb_gquotaino field being reset to NULLFSINO when quota is not enabled. To reproduce:

	$ mkfs.xfs -f <dev>
	$ mount <dev> /mnt -o gquota; umount /mnt
	$ mount <dev> /mnt; umount /mnt
	$ xfs_repair -n <dev>
	...
	disconnected inode 131, would move to lost+found
	...

This problem was a regression due to pquotaino work and originally fixed by the following commit:

xfs: null unused quota inodes when quota is on

... and then reintroduced by the more recent work to kill per-field superblock logging:

xfs: remove bitfield based superblock updates

Fix it up again as it was fixed the first time. On v4 filesystems, only reset the sb_quotaino field on-disk if both the in-core group and project inode fields are null.

---
 fs/xfs/libxfs/xfs_sb.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
fs/xfs/libxfs/xfs_sb.c +10 -2
index b440839..bacbb83 100644
@@ -442,8 +442,16 @@ xfs_sb_quota_to_disk(
 		to->sb_gquotino = cpu_to_be64(from->sb_gquotino);
 	else if (from->sb_qflags & XFS_PQUOTA_ACCT)
 		to->sb_gquotino = cpu_to_be64(from->sb_pquotino);
-	else
-		to->sb_gquotino = cpu_to_be64(NULLFSINO);
+	else {
+		/*
+		 * Only write NULLFSINO if quotas are not actually enabled.
+		 * Hence only write NULLFSINO if both in-core quota inodes are
+		 * NULL.
+		 */
+		if (from->sb_gquotino == NULLFSINO &&
+		    from->sb_pquotino == NULLFSINO)
+			to->sb_gquotino = cpu_to_be64(NULLFSINO);
+	}
 
 	to->sb_pquotino = 0;
 }
Signature · 6 lines
1.8.3.1

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs