xfs
[Top] [All Lists]

[PATCH] xfs: only reset sb_quotaino when both group/proj in-core inos ar

To: xfs@xxxxxxxxxxx
Subject: [PATCH] xfs: only reset sb_quotaino when both group/proj in-core inos are null
From: Brian Foster <bfoster@xxxxxxxxxx>
Date: Fri, 9 Jan 2015 15:36:31 -0500
Delivered-to: xfs@xxxxxxxxxxx
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.

Signed-off-by: Brian Foster <bfoster@xxxxxxxxxx>
---
 fs/xfs/libxfs/xfs_sb.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/fs/xfs/libxfs/xfs_sb.c b/fs/xfs/libxfs/xfs_sb.c
index b440839..bacbb83 100644
--- a/fs/xfs/libxfs/xfs_sb.c
+++ b/fs/xfs/libxfs/xfs_sb.c
@@ -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;
 }
-- 
1.8.3.1

<Prev in Thread] Current Thread [Next in Thread>
  • [PATCH] xfs: only reset sb_quotaino when both group/proj in-core inos are null, Brian Foster <=