diff options
Diffstat (limited to 'fs/xfs/xfs_buf.c')
-rw-r--r-- | fs/xfs/xfs_buf.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c index eedc5e0156ff..4f5f2ff3f70f 100644 --- a/fs/xfs/xfs_buf.c +++ b/fs/xfs/xfs_buf.c | |||
@@ -776,10 +776,26 @@ _xfs_buf_read( | |||
776 | } | 776 | } |
777 | 777 | ||
778 | /* | 778 | /* |
779 | * Set buffer ops on an unchecked buffer and validate it, if possible. | ||
780 | * | ||
779 | * If the caller passed in an ops structure and the buffer doesn't have ops | 781 | * If the caller passed in an ops structure and the buffer doesn't have ops |
780 | * assigned, set the ops and use them to verify the contents. If the contents | 782 | * assigned, set the ops and use them to verify the contents. If the contents |
781 | * cannot be verified, we'll clear XBF_DONE. We assume the buffer has no | 783 | * cannot be verified, we'll clear XBF_DONE. We assume the buffer has no |
782 | * recorded errors and is already in XBF_DONE state. | 784 | * recorded errors and is already in XBF_DONE state. |
785 | * | ||
786 | * Under normal operations, every in-core buffer must have buffer ops assigned | ||
787 | * to them when the buffer is read in from disk so that we can validate the | ||
788 | * metadata. | ||
789 | * | ||
790 | * However, there are two scenarios where one can encounter in-core buffers | ||
791 | * that don't have buffer ops. The first is during log recovery of buffers on | ||
792 | * a V4 filesystem, though these buffers are purged at the end of recovery. | ||
793 | * | ||
794 | * The other is online repair, which tries to match arbitrary metadata blocks | ||
795 | * with btree types in order to find the root. If online repair doesn't match | ||
796 | * the buffer with /any/ btree type, the buffer remains in memory in DONE state | ||
797 | * with no ops, and a subsequent read_buf call from elsewhere will not set the | ||
798 | * ops. This function helps us fix this situation. | ||
783 | */ | 799 | */ |
784 | int | 800 | int |
785 | xfs_buf_ensure_ops( | 801 | xfs_buf_ensure_ops( |
@@ -1536,8 +1552,7 @@ __xfs_buf_submit( | |||
1536 | xfs_buf_ioerror(bp, -EIO); | 1552 | xfs_buf_ioerror(bp, -EIO); |
1537 | bp->b_flags &= ~XBF_DONE; | 1553 | bp->b_flags &= ~XBF_DONE; |
1538 | xfs_buf_stale(bp); | 1554 | xfs_buf_stale(bp); |
1539 | if (bp->b_flags & XBF_ASYNC) | 1555 | xfs_buf_ioend(bp); |
1540 | xfs_buf_ioend(bp); | ||
1541 | return -EIO; | 1556 | return -EIO; |
1542 | } | 1557 | } |
1543 | 1558 | ||