Commit f9ece4ab authored by Eric Sandeen's avatar Eric Sandeen Committed by Nathan Scott

[XFS] Be more careful about quota state changes on ro-devices

We can't allow quota state changes on a read-only device,
this would kick of a failing transaction & shut down the fs.
Previously the test was quota/no quota but we need to disallow
any change wrt user and/or group quota state.

SGI Modid: 2.5.x-xfs:slinx:131554a
parent fbfafd0b
...@@ -561,6 +561,7 @@ xfs_mountfs( ...@@ -561,6 +561,7 @@ xfs_mountfs(
extern xfs_ioops_t xfs_iocore_xfs; /* from xfs_iocore.c */ extern xfs_ioops_t xfs_iocore_xfs; /* from xfs_iocore.c */
__uint64_t ret64; __uint64_t ret64;
uint quotaflags, quotaondisk, rootqcheck, needquotacheck; uint quotaflags, quotaondisk, rootqcheck, needquotacheck;
uint uquotaondisk = 0, gquotaondisk = 0;
boolean_t needquotamount; boolean_t needquotamount;
__int64_t update_flags; __int64_t update_flags;
int agno, noio; int agno, noio;
...@@ -913,6 +914,11 @@ xfs_mountfs( ...@@ -913,6 +914,11 @@ xfs_mountfs(
quotaondisk = XFS_SB_VERSION_HASQUOTA(&mp->m_sb) && quotaondisk = XFS_SB_VERSION_HASQUOTA(&mp->m_sb) &&
mp->m_sb.sb_qflags & (XFS_UQUOTA_ACCT|XFS_GQUOTA_ACCT); mp->m_sb.sb_qflags & (XFS_UQUOTA_ACCT|XFS_GQUOTA_ACCT);
if (quotaondisk) {
uquotaondisk = mp->m_sb.sb_qflags & XFS_UQUOTA_ACCT;
gquotaondisk = mp->m_sb.sb_qflags & XFS_GQUOTA_ACCT;
}
/* /*
* If the device itself is read-only, we can't allow * If the device itself is read-only, we can't allow
* the user to change the state of quota on the mount - * the user to change the state of quota on the mount -
...@@ -920,13 +926,16 @@ xfs_mountfs( ...@@ -920,13 +926,16 @@ xfs_mountfs(
* which would lead to an I/O error and shutdown * which would lead to an I/O error and shutdown
*/ */
if (((quotaondisk && !XFS_IS_QUOTA_ON(mp)) || if (((uquotaondisk && !XFS_IS_UQUOTA_ON(mp)) ||
(!quotaondisk && XFS_IS_QUOTA_ON(mp))) && (!uquotaondisk && XFS_IS_UQUOTA_ON(mp)) ||
(gquotaondisk && !XFS_IS_GQUOTA_ON(mp)) ||
(!gquotaondisk && XFS_IS_GQUOTA_ON(mp))) &&
xfs_dev_is_read_only(mp, "changing quota state")) { xfs_dev_is_read_only(mp, "changing quota state")) {
cmn_err(CE_WARN, cmn_err(CE_WARN,
"XFS: device %s is read-only, cannot change " "XFS: please mount with%s%s%s.",
"quota state. Please mount with%s quota option.", (!quotaondisk ? "out quota" : ""),
mp->m_fsname, quotaondisk ? "" : "out"); (uquotaondisk ? " usrquota" : ""),
(gquotaondisk ? " grpquota" : ""));
rvp->v_flag |= VPURGE; rvp->v_flag |= VPURGE;
VN_RELE(rvp); VN_RELE(rvp);
vn_remove(rvp); vn_remove(rvp);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment