xfs
[Top] [All Lists]

[PATCH 35/45] xfs: remove log item from AIL in xfs_qm_dqflush after a sh

To: xfs@xxxxxxxxxxx
Subject: [PATCH 35/45] xfs: remove log item from AIL in xfs_qm_dqflush after a shutdown
From: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Date: Fri, 28 Oct 2011 05:54:58 -0400
References: <20111028095423.796574703@xxxxxxxxxxxxxxxxxxxxxx>
User-agent: quilt/0.48-1
If a filesystem has been forced shutdown we are never going to write dquots
to disk, which means the dquot items will stay in the AIL forever.
Currently that is not a problem, but a pending chance requires us to
empty the AIL before shutting down the filesystem, in which case this
behaviour is lethal.  Make sure to remove the log item from the AIL
to allow emptying the AIL on shutdown filesystems.

Signed-off-by: Christoph Hellwig <hch@xxxxxx>

---
 fs/xfs/xfs_dquot.c |   13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

Index: xfs/fs/xfs/xfs_dquot.c
===================================================================
--- xfs.orig/fs/xfs/xfs_dquot.c 2011-10-27 22:40:08.598176882 +0200
+++ xfs/fs/xfs/xfs_dquot.c      2011-10-27 22:40:11.298171586 +0200
@@ -1010,10 +1010,21 @@ xfs_qm_dqflush(
        /*
         * This may have been unpinned because the filesystem is shutting
         * down forcibly. If that's the case we must not write this dquot
-        * to disk, because the log record didn't make it to disk!
+        * to disk, because the log record didn't make it to disk.
+        *
+        * We also have to remove the log item from the AIL in this case,
+        * as we wait for an emptry AIL as part of the unmount process.
         */
        if (XFS_FORCED_SHUTDOWN(mp)) {
+               struct xfs_log_item     *lip = &dqp->q_logitem.qli_item;
                dqp->dq_flags &= ~XFS_DQ_DIRTY;
+
+               spin_lock(&mp->m_ail->xa_lock);
+               if (lip->li_flags & XFS_LI_IN_AIL)
+                       xfs_trans_ail_delete(mp->m_ail, lip);
+               else
+                       spin_unlock(&mp->m_ail->xa_lock);
+
                xfs_dqfunlock(dqp);
                return XFS_ERROR(EIO);
        }

<Prev in Thread] Current Thread [Next in Thread>