diff options
Diffstat (limited to 'fs/xfs/xfs_sb.c')
-rw-r--r-- | fs/xfs/xfs_sb.c | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/fs/xfs/xfs_sb.c b/fs/xfs/xfs_sb.c index c3453b11f563..7703fa6770ff 100644 --- a/fs/xfs/xfs_sb.c +++ b/fs/xfs/xfs_sb.c | |||
@@ -483,10 +483,16 @@ xfs_sb_quota_to_disk( | |||
483 | } | 483 | } |
484 | 484 | ||
485 | /* | 485 | /* |
486 | * GQUOTINO and PQUOTINO cannot be used together in versions | 486 | * GQUOTINO and PQUOTINO cannot be used together in versions of |
487 | * of superblock that do not have pquotino. from->sb_flags | 487 | * superblock that do not have pquotino. from->sb_flags tells us which |
488 | * tells us which quota is active and should be copied to | 488 | * quota is active and should be copied to disk. If neither are active, |
489 | * disk. | 489 | * make sure we write NULLFSINO to the sb_gquotino field as a quota |
490 | * inode value of "0" is invalid when the XFS_SB_VERSION_QUOTA feature | ||
491 | * bit is set. | ||
492 | * | ||
493 | * Note that we don't need to handle the sb_uquotino or sb_pquotino here | ||
494 | * as they do not require any translation. Hence the main sb field loop | ||
495 | * will write them appropriately from the in-core superblock. | ||
490 | */ | 496 | */ |
491 | if ((*fields & XFS_SB_GQUOTINO) && | 497 | if ((*fields & XFS_SB_GQUOTINO) && |
492 | (from->sb_qflags & XFS_GQUOTA_ACCT)) | 498 | (from->sb_qflags & XFS_GQUOTA_ACCT)) |
@@ -494,6 +500,17 @@ xfs_sb_quota_to_disk( | |||
494 | else if ((*fields & XFS_SB_PQUOTINO) && | 500 | else if ((*fields & XFS_SB_PQUOTINO) && |
495 | (from->sb_qflags & XFS_PQUOTA_ACCT)) | 501 | (from->sb_qflags & XFS_PQUOTA_ACCT)) |
496 | to->sb_gquotino = cpu_to_be64(from->sb_pquotino); | 502 | to->sb_gquotino = cpu_to_be64(from->sb_pquotino); |
503 | else { | ||
504 | /* | ||
505 | * We can't rely on just the fields being logged to tell us | ||
506 | * that it is safe to write NULLFSINO - we should only do that | ||
507 | * if quotas are not actually enabled. Hence only write | ||
508 | * NULLFSINO if both in-core quota inodes are NULL. | ||
509 | */ | ||
510 | if (from->sb_gquotino == NULLFSINO && | ||
511 | from->sb_pquotino == NULLFSINO) | ||
512 | to->sb_gquotino = cpu_to_be64(NULLFSINO); | ||
513 | } | ||
497 | 514 | ||
498 | *fields &= ~(XFS_SB_PQUOTINO | XFS_SB_GQUOTINO); | 515 | *fields &= ~(XFS_SB_PQUOTINO | XFS_SB_GQUOTINO); |
499 | } | 516 | } |