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