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

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