Blame SOURCES/xfsprogs-4.5.0-xfs_repair-quota-inodes.patch

e59f31
[PATCH] xfs_repair: don't call xfs_sb_quota_from_disk twice
e59f31
e59f31
kernel commit 5ef828c4
e59f31
xfs: avoid false quotacheck after unclean shutdown
e59f31
e59f31
made xfs_sb_from_disk() also call xfs_sb_quota_from_disk
e59f31
by default.
e59f31
e59f31
However, when this was merged to libxfs, existing separate
e59f31
calls to libxfs_sb_quota_from_disk remained, and calling it
e59f31
twice in a row on a V4 superblock leads to issues, because:
e59f31
e59f31
e59f31
        if (sbp->sb_qflags & XFS_PQUOTA_ACCT)  {
e59f31
...
e59f31
                sbp->sb_pquotino = sbp->sb_gquotino;
e59f31
                sbp->sb_gquotino = NULLFSINO;
e59f31
e59f31
and after the second call, we have set both pquotino and gquotino
e59f31
to NULLFSINO.
e59f31
e59f31
Fix this by making it safe to call twice, and also remove the extra
e59f31
calls to libxfs_sb_quota_from_disk.
e59f31
e59f31
This is only spotted when running xfstests with "-m crc=0" because
e59f31
the sb_from_disk change came about after V5 became default, and
e59f31
the above behavior only exists on a V4 superblock.
e59f31
e59f31
Reported-by: Eryu Guan <eguan@redhat.com>
e59f31
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
e59f31
---
e59f31
e59f31
e59f31
diff --git a/libxfs/xfs_sb.c b/libxfs/xfs_sb.c
e59f31
index 45db6ae..44f3e3e 100644
e59f31
--- a/libxfs/xfs_sb.c
e59f31
+++ b/libxfs/xfs_sb.c
e59f31
@@ -316,13 +316,16 @@ xfs_sb_quota_from_disk(struct xfs_sb *sbp)
e59f31
 					XFS_PQUOTA_CHKD : XFS_GQUOTA_CHKD;
e59f31
 	sbp->sb_qflags &= ~(XFS_OQUOTA_ENFD | XFS_OQUOTA_CHKD);
e59f31
 
e59f31
-	if (sbp->sb_qflags & XFS_PQUOTA_ACCT)  {
e59f31
+	if (sbp->sb_qflags & XFS_PQUOTA_ACCT &&
e59f31
+	    sbp->sb_gquotino != NULLFSINO)  {
e59f31
 		/*
e59f31
 		 * In older version of superblock, on-disk superblock only
e59f31
 		 * has sb_gquotino, and in-core superblock has both sb_gquotino
e59f31
 		 * and sb_pquotino. But, only one of them is supported at any
e59f31
 		 * point of time. So, if PQUOTA is set in disk superblock,
e59f31
-		 * copy over sb_gquotino to sb_pquotino.
e59f31
+		 * copy over sb_gquotino to sb_pquotino.  The NULLFSINO test
e59f31
+		 * above is to make sure we don't do this twice and wipe them
e59f31
+		 * both out!
e59f31
 		 */
e59f31
 		sbp->sb_pquotino = sbp->sb_gquotino;
e59f31
 		sbp->sb_gquotino = NULLFSINO;
e59f31
diff --git a/repair/sb.c b/repair/sb.c
e59f31
index 3965953..8087242 100644
e59f31
--- a/repair/sb.c
e59f31
+++ b/repair/sb.c
e59f31
@@ -155,7 +155,6 @@ __find_secondary_sb(
e59f31
 		for (i = 0; !done && i < bsize; i += BBSIZE)  {
e59f31
 			c_bufsb = (char *)sb + i;
e59f31
 			libxfs_sb_from_disk(&bufsb, (xfs_dsb_t *)c_bufsb);
e59f31
-			libxfs_sb_quota_from_disk(&bufsb);
e59f31
 
e59f31
 			if (verify_sb(c_bufsb, &bufsb, 0) != XR_OK)
e59f31
 				continue;
e59f31
@@ -568,7 +567,6 @@ get_sb(xfs_sb_t *sbp, xfs_off_t off, int size, xfs_agnumber_t agno)
e59f31
 		do_error("%s\n", strerror(error));
e59f31
 	}
e59f31
 	libxfs_sb_from_disk(sbp, buf);
e59f31
-	libxfs_sb_quota_from_disk(sbp);
e59f31
 
e59f31
 	rval = verify_sb((char *)buf, sbp, agno == 0);
e59f31
 	free(buf);
e59f31
diff --git a/repair/scan.c b/repair/scan.c
e59f31
index 964ff06..366ce16 100644
e59f31
--- a/repair/scan.c
e59f31
+++ b/repair/scan.c
e59f31
@@ -1622,7 +1622,6 @@ scan_ag(
e59f31
 		goto out_free_sb;
e59f31
 	}
e59f31
 	libxfs_sb_from_disk(sb, XFS_BUF_TO_SBP(sbbuf));
e59f31
-	libxfs_sb_quota_from_disk(sb);
e59f31
 
e59f31
 	agfbuf = libxfs_readbuf(mp->m_dev,
e59f31
 			XFS_AG_DADDR(mp, agno, XFS_AGF_DADDR(mp)),
e59f31
e59f31
_______________________________________________
e59f31
xfs mailing list
e59f31
xfs@oss.sgi.com
e59f31
http://oss.sgi.com/mailman/listinfo/xfs
e59f31
e59f31