diff options
author | David Chinner <dgc@sgi.com> | 2007-05-14 04:24:23 -0400 |
---|---|---|
committer | Tim Shimmin <tes@chook.melbourne.sgi.com> | 2007-10-15 02:23:45 -0400 |
commit | 0bfefc46dc028df60120acdb92062169c9328769 (patch) | |
tree | ce8cecb3f4546300c0d193efa27bf14f78170b3b /fs | |
parent | c1561cf463f4a480d1960e833c8fe628207b24e4 (diff) |
[XFS] Barriers need to be dynamically checked and switched off
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>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/xfs/linux-2.6/xfs_buf.c | 13 | ||||
-rw-r--r-- | fs/xfs/linux-2.6/xfs_super.c | 8 | ||||
-rw-r--r-- | fs/xfs/xfs_log.c | 13 |
3 files changed, 25 insertions, 9 deletions
diff --git a/fs/xfs/linux-2.6/xfs_buf.c b/fs/xfs/linux-2.6/xfs_buf.c index b0f0e58866de..8d9298c99763 100644 --- a/fs/xfs/linux-2.6/xfs_buf.c +++ b/fs/xfs/linux-2.6/xfs_buf.c | |||
@@ -997,7 +997,18 @@ xfs_buf_iodone_work( | |||
997 | xfs_buf_t *bp = | 997 | xfs_buf_t *bp = |
998 | container_of(work, xfs_buf_t, b_iodone_work); | 998 | container_of(work, xfs_buf_t, b_iodone_work); |
999 | 999 | ||
1000 | if (bp->b_iodone) | 1000 | /* |
1001 | * We can get an EOPNOTSUPP to ordered writes. Here we clear the | ||
1002 | * ordered flag and reissue them. Because we can't tell the higher | ||
1003 | * layers directly that they should not issue ordered I/O anymore, they | ||
1004 | * need to check if the ordered flag was cleared during I/O completion. | ||
1005 | */ | ||
1006 | if ((bp->b_error == EOPNOTSUPP) && | ||
1007 | (bp->b_flags & (XBF_ORDERED|XBF_ASYNC)) == (XBF_ORDERED|XBF_ASYNC)) { | ||
1008 | XB_TRACE(bp, "ordered_retry", bp->b_iodone); | ||
1009 | bp->b_flags &= ~XBF_ORDERED; | ||
1010 | xfs_buf_iorequest(bp); | ||
1011 | } else if (bp->b_iodone) | ||
1001 | (*(bp->b_iodone))(bp); | 1012 | (*(bp->b_iodone))(bp); |
1002 | else if (bp->b_flags & XBF_ASYNC) | 1013 | else if (bp->b_flags & XBF_ASYNC) |
1003 | xfs_buf_relse(bp); | 1014 | xfs_buf_relse(bp); |
diff --git a/fs/xfs/linux-2.6/xfs_super.c b/fs/xfs/linux-2.6/xfs_super.c index 491d1f4f202d..17ad5e463710 100644 --- a/fs/xfs/linux-2.6/xfs_super.c +++ b/fs/xfs/linux-2.6/xfs_super.c | |||
@@ -304,14 +304,6 @@ xfs_mountfs_check_barriers(xfs_mount_t *mp) | |||
304 | return; | 304 | return; |
305 | } | 305 | } |
306 | 306 | ||
307 | if (mp->m_ddev_targp->bt_bdev->bd_disk->queue->ordered == | ||
308 | QUEUE_ORDERED_NONE) { | ||
309 | xfs_fs_cmn_err(CE_NOTE, mp, | ||
310 | "Disabling barriers, not supported by the underlying device"); | ||
311 | mp->m_flags &= ~XFS_MOUNT_BARRIER; | ||
312 | return; | ||
313 | } | ||
314 | |||
315 | if (xfs_readonly_buftarg(mp->m_ddev_targp)) { | 307 | if (xfs_readonly_buftarg(mp->m_ddev_targp)) { |
316 | xfs_fs_cmn_err(CE_NOTE, mp, | 308 | xfs_fs_cmn_err(CE_NOTE, mp, |
317 | "Disabling barriers, underlying device is readonly"); | 309 | "Disabling barriers, underlying device is readonly"); |
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c index 9bfb69e1e885..db09e1ea5cf3 100644 --- a/fs/xfs/xfs_log.c +++ b/fs/xfs/xfs_log.c | |||
@@ -949,6 +949,19 @@ xlog_iodone(xfs_buf_t *bp) | |||
949 | l = iclog->ic_log; | 949 | l = iclog->ic_log; |
950 | 950 | ||
951 | /* | 951 | /* |
952 | * If the ordered flag has been removed by a lower | ||
953 | * layer, it means the underlyin device no longer supports | ||
954 | * barrier I/O. Warn loudly and turn off barriers. | ||
955 | */ | ||
956 | if ((l->l_mp->m_flags & XFS_MOUNT_BARRIER) && !XFS_BUF_ORDERED(bp)) { | ||
957 | l->l_mp->m_flags &= ~XFS_MOUNT_BARRIER; | ||
958 | xfs_fs_cmn_err(CE_WARN, l->l_mp, | ||
959 | "xlog_iodone: Barriers are no longer supported" | ||
960 | " by device. Disabling barriers\n"); | ||
961 | xfs_buftrace("XLOG_IODONE BARRIERS OFF", bp); | ||
962 | } | ||
963 | |||
964 | /* | ||
952 | * Race to shutdown the filesystem if we see an error. | 965 | * Race to shutdown the filesystem if we see an error. |
953 | */ | 966 | */ |
954 | if (XFS_TEST_ERROR((XFS_BUF_GETERROR(bp)), l->l_mp, | 967 | if (XFS_TEST_ERROR((XFS_BUF_GETERROR(bp)), l->l_mp, |