Commit 3c56836f authored by David Chinner's avatar David Chinner Committed by Lachlan McIlroy

[XFS] Check for dquot flush errors

xfs_qm_dqflush() can fail, but the return is not checked anywhere. Hence
we never know if we've failed to flush a dquot to disk. Propagate the
error and warn to the syslog if a flush ever fails.

SGI-PV: 980084
SGI-Modid: xfs-linux-melb:xfs-kern:30787a
Signed-off-by: default avatarDavid Chinner <dgc@sgi.com>
Signed-off-by: default avatarNiv Sardi <xaiki@sgi.com>
Signed-off-by: default avatarLachlan McIlroy <lachlan@sgi.com>
parent 4b8879df
...@@ -1439,9 +1439,7 @@ xfs_qm_dqpurge( ...@@ -1439,9 +1439,7 @@ xfs_qm_dqpurge(
uint flags) uint flags)
{ {
xfs_dqhash_t *thishash; xfs_dqhash_t *thishash;
xfs_mount_t *mp; xfs_mount_t *mp = dqp->q_mount;
mp = dqp->q_mount;
ASSERT(XFS_QM_IS_MPLIST_LOCKED(mp)); ASSERT(XFS_QM_IS_MPLIST_LOCKED(mp));
ASSERT(XFS_DQ_IS_HASH_LOCKED(dqp->q_hash)); ASSERT(XFS_DQ_IS_HASH_LOCKED(dqp->q_hash));
...@@ -1485,6 +1483,7 @@ xfs_qm_dqpurge( ...@@ -1485,6 +1483,7 @@ xfs_qm_dqpurge(
* we're unmounting, we do care, so we flush it and wait. * we're unmounting, we do care, so we flush it and wait.
*/ */
if (XFS_DQ_IS_DIRTY(dqp)) { if (XFS_DQ_IS_DIRTY(dqp)) {
int error;
xfs_dqtrace_entry(dqp, "DQPURGE ->DQFLUSH: DQDIRTY"); xfs_dqtrace_entry(dqp, "DQPURGE ->DQFLUSH: DQDIRTY");
/* dqflush unlocks dqflock */ /* dqflush unlocks dqflock */
/* /*
...@@ -1495,7 +1494,10 @@ xfs_qm_dqpurge( ...@@ -1495,7 +1494,10 @@ xfs_qm_dqpurge(
* We don't care about getting disk errors here. We need * We don't care about getting disk errors here. We need
* to purge this dquot anyway, so we go ahead regardless. * to purge this dquot anyway, so we go ahead regardless.
*/ */
(void) xfs_qm_dqflush(dqp, XFS_QMOPT_SYNC); error = xfs_qm_dqflush(dqp, XFS_QMOPT_SYNC);
if (error)
xfs_fs_cmn_err(CE_WARN, mp,
"xfs_qm_dqpurge: dquot %p flush failed", dqp);
xfs_dqflock(dqp); xfs_dqflock(dqp);
} }
ASSERT(dqp->q_pincount == 0); ASSERT(dqp->q_pincount == 0);
......
...@@ -146,6 +146,7 @@ xfs_qm_dquot_logitem_push( ...@@ -146,6 +146,7 @@ xfs_qm_dquot_logitem_push(
xfs_dq_logitem_t *logitem) xfs_dq_logitem_t *logitem)
{ {
xfs_dquot_t *dqp; xfs_dquot_t *dqp;
int error;
dqp = logitem->qli_dquot; dqp = logitem->qli_dquot;
...@@ -161,7 +162,11 @@ xfs_qm_dquot_logitem_push( ...@@ -161,7 +162,11 @@ xfs_qm_dquot_logitem_push(
* lock without sleeping, then there must not have been * lock without sleeping, then there must not have been
* anyone in the process of flushing the dquot. * anyone in the process of flushing the dquot.
*/ */
xfs_qm_dqflush(dqp, XFS_B_DELWRI); error = xfs_qm_dqflush(dqp, XFS_QMOPT_DELWRI);
if (error)
xfs_fs_cmn_err(CE_WARN, dqp->q_mount,
"xfs_qm_dquot_logitem_push: push error %d on dqp %p",
error, dqp);
xfs_dqunlock(dqp); xfs_dqunlock(dqp);
} }
......
...@@ -2094,12 +2094,17 @@ xfs_qm_shake_freelist( ...@@ -2094,12 +2094,17 @@ xfs_qm_shake_freelist(
* dirty dquots. * dirty dquots.
*/ */
if (XFS_DQ_IS_DIRTY(dqp)) { if (XFS_DQ_IS_DIRTY(dqp)) {
int error;
xfs_dqtrace_entry(dqp, "DQSHAKE: DQDIRTY"); xfs_dqtrace_entry(dqp, "DQSHAKE: DQDIRTY");
/* /*
* We flush it delayed write, so don't bother * We flush it delayed write, so don't bother
* releasing the mplock. * releasing the mplock.
*/ */
(void) xfs_qm_dqflush(dqp, XFS_QMOPT_DELWRI); error = xfs_qm_dqflush(dqp, XFS_QMOPT_DELWRI);
if (error) {
xfs_fs_cmn_err(CE_WARN, dqp->q_mount,
"xfs_qm_dqflush_all: dquot %p flush failed", dqp);
}
xfs_dqunlock(dqp); /* dqflush unlocks dqflock */ xfs_dqunlock(dqp); /* dqflush unlocks dqflock */
dqp = dqp->dq_flnext; dqp = dqp->dq_flnext;
continue; continue;
...@@ -2266,12 +2271,17 @@ xfs_qm_dqreclaim_one(void) ...@@ -2266,12 +2271,17 @@ xfs_qm_dqreclaim_one(void)
* dirty dquots. * dirty dquots.
*/ */
if (XFS_DQ_IS_DIRTY(dqp)) { if (XFS_DQ_IS_DIRTY(dqp)) {
int error;
xfs_dqtrace_entry(dqp, "DQRECLAIM: DQDIRTY"); xfs_dqtrace_entry(dqp, "DQRECLAIM: DQDIRTY");
/* /*
* We flush it delayed write, so don't bother * We flush it delayed write, so don't bother
* releasing the freelist lock. * releasing the freelist lock.
*/ */
(void) xfs_qm_dqflush(dqp, XFS_QMOPT_DELWRI); error = xfs_qm_dqflush(dqp, XFS_QMOPT_DELWRI);
if (error) {
xfs_fs_cmn_err(CE_WARN, dqp->q_mount,
"xfs_qm_dqreclaim: dquot %p flush failed", dqp);
}
xfs_dqunlock(dqp); /* dqflush unlocks dqflock */ xfs_dqunlock(dqp); /* dqflush unlocks dqflock */
continue; continue;
} }
......
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