History

Merge tag 'xfs-5.0-fixes-1' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux

Pull xfs fixes from Darrick Wong: "Here are a handful of XFS fixes to fix a data corruption problem, a crasher bug, and a deadlock. Summary: - Fix cache coherency problem with writeback mappings - Fix buffer deadlock when shutting fs down - Fix a null pointer dereference when running online repair" * tag 'xfs-5.0-fixes-1' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux: xfs: set buffer ops when repair probes for btree type xfs: end sync buffer I/O properly on shutdown error xfs: eof trim writeback mapping as soon as it is cached

Linus Torvalds committed 7 years ago

Commit bd5ff862 parents adcbc92 add46b33 files · +27 −5Browse files

Unified · Split

3 files
  1. fs/xfs/scrub/repair.c +8 −3
  2. fs/xfs/xfs_aops.c +2 −0
  3. fs/xfs/xfs_buf.c +17 −2
fs/xfs/scrub/repair.c+8−3
@@ -768,18 +768,23 @@ xrep_findroot_block( · 767 unmodified lines
768 if (!uuid_equal(&btblock->bb_u.s.bb_uuid,768 if (!uuid_equal(&btblock->bb_u.s.bb_uuid,
769 &mp->m_sb.sb_meta_uuid))769 &mp->m_sb.sb_meta_uuid))
770 goto out;770 goto out;
771 /*
772 * Read verifiers can reference b_ops, so we set the pointer
773 * here. If the verifier fails we'll reset the buffer state
774 * to what it was before we touched the buffer.
775 */
776 bp->b_ops = fab->buf_ops;
771 fab->buf_ops->verify_read(bp);777 fab->buf_ops->verify_read(bp);
772 if (bp->b_error) {778 if (bp->b_error) {
779 bp->b_ops = NULL;
773 bp->b_error = 0;780 bp->b_error = 0;
774 goto out;781 goto out;
775 }782 }
776 783
777 /*784 /*
778 * Some read verifiers will (re)set b_ops, so we must be785 * Some read verifiers will (re)set b_ops, so we must be
779 * careful not to blow away any such assignment.786 * careful not to change b_ops after running the verifier.
780 */787 */
781 if (!bp->b_ops)
782 bp->b_ops = fab->buf_ops;
783 }788 }
784 789
785 /*790 /*
fs/xfs/xfs_aops.c+2−0
@@ -449,6 +449,7 @@ xfs_map_blocks( · 448 unmodified lines
449 }449 }
450 450
451 wpc->imap = imap;451 wpc->imap = imap;
452 xfs_trim_extent_eof(&wpc->imap, ip);
452 trace_xfs_map_blocks_found(ip, offset, count, wpc->io_type, &imap);453 trace_xfs_map_blocks_found(ip, offset, count, wpc->io_type, &imap);
453 return 0;454 return 0;
454allocate_blocks:455allocate_blocks:
@@ -459,6 +460,7 @@ allocate_blocks: · 4 unmodified lines
459 ASSERT(whichfork == XFS_COW_FORK || cow_fsb == NULLFILEOFF ||460 ASSERT(whichfork == XFS_COW_FORK || cow_fsb == NULLFILEOFF ||
460 imap.br_startoff + imap.br_blockcount <= cow_fsb);461 imap.br_startoff + imap.br_blockcount <= cow_fsb);
461 wpc->imap = imap;462 wpc->imap = imap;
463 xfs_trim_extent_eof(&wpc->imap, ip);
462 trace_xfs_map_blocks_alloc(ip, offset, count, wpc->io_type, &imap);464 trace_xfs_map_blocks_alloc(ip, offset, count, wpc->io_type, &imap);
463 return 0;465 return 0;
464}466}
fs/xfs/xfs_buf.c+17−2
@@ -776,10 +776,26 @@ _xfs_buf_read( · 775 unmodified lines
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 ops781 * 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 contents782 * 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 no783 * 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 */
784int800int
785xfs_buf_ensure_ops(801xfs_buf_ensure_ops(
@@ -1536,8 +1552,7 @@ __xfs_buf_submit( · 750 unmodified lines
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

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t