]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[XFS] Barriers need to be dynamically checked and switched off
authorDavid Chinner <dgc@sgi.com>
Mon, 14 May 2007 08:24:23 +0000 (18:24 +1000)
committerTim Shimmin <tes@chook.melbourne.sgi.com>
Mon, 15 Oct 2007 06:23:45 +0000 (16:23 +1000)
If the underlying block device suddenly stops supporting barriers, we need
to handle the -EOPNOTSUPP error in a sane manner rather than shutting
down the filesystem. If we get this error, clear the barrier flag, reissue
the I/O, and tell the world bad things are occurring.

SGI-PV: 964544
SGI-Modid: xfs-linux-melb:xfs-kern:28568a

Signed-off-by: David Chinner <dgc@sgi.com>
Signed-off-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Tim Shimmin <tes@sgi.com>
fs/xfs/linux-2.6/xfs_buf.c
fs/xfs/linux-2.6/xfs_super.c
fs/xfs/xfs_log.c

index b0f0e58866de6059bcd4b0bc454e886ddde03cbc..8d9298c99763f9a5f090fd63992096a5f2ac86fa 100644 (file)
@@ -997,7 +997,18 @@ xfs_buf_iodone_work(
        xfs_buf_t               *bp =
                container_of(work, xfs_buf_t, b_iodone_work);
 
-       if (bp->b_iodone)
+       /*
+        * We can get an EOPNOTSUPP to ordered writes.  Here we clear the
+        * ordered flag and reissue them.  Because we can't tell the higher
+        * layers directly that they should not issue ordered I/O anymore, they
+        * need to check if the ordered flag was cleared during I/O completion.
+        */
+       if ((bp->b_error == EOPNOTSUPP) &&
+           (bp->b_flags & (XBF_ORDERED|XBF_ASYNC)) == (XBF_ORDERED|XBF_ASYNC)) {
+               XB_TRACE(bp, "ordered_retry", bp->b_iodone);
+               bp->b_flags &= ~XBF_ORDERED;
+               xfs_buf_iorequest(bp);
+       } else if (bp->b_iodone)
                (*(bp->b_iodone))(bp);
        else if (bp->b_flags & XBF_ASYNC)
                xfs_buf_relse(bp);
index 491d1f4f202d8d5919ade355c0a212825e8c8a54..17ad5e46371035865a9cff9debf740b1de498d7f 100644 (file)
@@ -304,14 +304,6 @@ xfs_mountfs_check_barriers(xfs_mount_t *mp)
                return;
        }
 
-       if (mp->m_ddev_targp->bt_bdev->bd_disk->queue->ordered ==
-                                       QUEUE_ORDERED_NONE) {
-               xfs_fs_cmn_err(CE_NOTE, mp,
-                 "Disabling barriers, not supported by the underlying device");
-               mp->m_flags &= ~XFS_MOUNT_BARRIER;
-               return;
-       }
-
        if (xfs_readonly_buftarg(mp->m_ddev_targp)) {
                xfs_fs_cmn_err(CE_NOTE, mp,
                  "Disabling barriers, underlying device is readonly");
index 9bfb69e1e885d2fcf7891392c664b4110e4c9161..db09e1ea5cf3146f7ffecc74338e25bdc55677ea 100644 (file)
@@ -948,6 +948,19 @@ xlog_iodone(xfs_buf_t *bp)
         */
        l = iclog->ic_log;
 
+       /*
+        * If the ordered flag has been removed by a lower
+        * layer, it means the underlyin device no longer supports
+        * barrier I/O. Warn loudly and turn off barriers.
+        */
+       if ((l->l_mp->m_flags & XFS_MOUNT_BARRIER) && !XFS_BUF_ORDERED(bp)) {
+               l->l_mp->m_flags &= ~XFS_MOUNT_BARRIER;
+               xfs_fs_cmn_err(CE_WARN, l->l_mp,
+                               "xlog_iodone: Barriers are no longer supported"
+                               " by device. Disabling barriers\n");
+               xfs_buftrace("XLOG_IODONE BARRIERS OFF", bp);
+       }
+
        /*
         * Race to shutdown the filesystem if we see an error.
         */