public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Brian Foster <bfoster@redhat.com>
To: xfs@oss.sgi.com
Subject: [PATCH] xfs: only reset sb_quotaino when both group/proj in-core inos are null
Date: Fri,  9 Jan 2015 15:36:31 -0500	[thread overview]
Message-ID: <1420835791-26895-1-git-send-email-bfoster@redhat.com> (raw)

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@redhat.com>
---
 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

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

                 reply	other threads:[~2015-01-09 20:36 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1420835791-26895-1-git-send-email-bfoster@redhat.com \
    --to=bfoster@redhat.com \
    --cc=xfs@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox