-
xfs: don't let cow cancellation transaction alloc recurse into fs rec…
djwong committedSep 26, 2017 …laim Reclaiming blocks allocated to an inode's CoW fork can happen as part of inode reclamation, which in turn can be triggered by memory reclaim. Therefore, we cannot let the transaction allocation recurse into fs reclaim. This manifests as lockdep warnings such as: ====================================================== WARNING: possible circular locking dependency detected 4.14.0-rc1 #1 Not tainted ------------------------------------------------------ xfs_scrub/1344 is trying to acquire lock: (fs_reclaim){+.+.}, at: [<ffffffff811b2b75>] fs_reclaim_acquire.part.75+0x5/0x30 but task is already holding lock: (sb_internal){.+.+}, at: [<ffffffffa015e65b>] xfs_trans_alloc+0xeb/0x130 [xfs] which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #1 (sb_internal){.+.+}: lock_acquire+0xab/0x200 __sb_start_write+0xbc/0x200 xfs_trans_alloc+0xeb/0x130 [xfs] xfs_reflink_cancel_cow_range+0x8e/0x3d0 [xfs] xfs_fs_destroy_inode+0x22f/0x350 [xfs] dispose_list+0x48/0x70 prune_icache_sb+0x42/0x50 super_cache_scan+0x13b/0x190 shrink_slab.constprop.79+0x212/0x5d0 shrink_node+0x5f/0x190 do_try_to_free_pages+0xd8/0x2d0 try_to_free_pages+0xf1/0x370 __alloc_pages_slowpath+0x445/0x10d0 __alloc_pages_nodemask+0x2c4/0x340 khugepaged+0xb38/0x2510 kthread+0x148/0x180 ret_from_fork+0x2a/0x40 -> #0 (fs_reclaim){+.+.}: __lock_acquire+0x10bf/0x1110 lock_acquire+0xab/0x200 fs_reclaim_acquire.part.75+0x29/0x30 kmem_cache_alloc+0x29/0x2d0 kmem_zone_alloc+0x83/0x100 [xfs] xfs_trans_alloc+0x68/0x130 [xfs] xfs_reflink_cancel_cow_range+0x8e/0x3d0 [xfs] xfs_fs_destroy_inode+0x22f/0x350 [xfs] xfs_bulkstat_one_int+0x262/0x480 [xfs] xfs_bulkstat_one+0x16/0x20 [xfs] xfs_bulkstat+0x4c5/0x6b0 [xfs] xfs_ioc_bulkstat+0xee/0x190 [xfs] xfs_file_ioctl+0x41b/0xd30 [xfs] do_vfs_ioctl+0x8f/0x6f0 SyS_ioctl+0x3b/0x70 entry_SYSCALL_64_fastpath+0x1f/0xbe Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> -
xfs: cross-reference the realtime rmapbt
djwong committedSep 26, 2017 When we're scrubbing the realtime metadata, cross-reference the rtrmapt. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
-
xfs: cross-reference realtime bitmap to realtime rmapbt scrubber
djwong committedSep 26, 2017 When we're checking the realtime rmapbt, cross-reference the entries with the realtime bitmap too. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
-
xfs: scrub the realtime rmapbt
djwong committedSep 26, 2017 Check the realtime reverse mapping btree against the rtbitmap, and modify the rtbitmap scrub to check against the rtrmapbt. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
-
xfs: wire up getfsmap to the realtime reverse mapping btree
djwong committedSep 26, 2017 Connect the getfsmap ioctl to the realtime rmapbt. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
-
xfs: enable realtime rmap btree
djwong committedSep 26, 2017 Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
-
xfs: wire up rmap map and unmap to the realtime rmapbt
djwong committedSep 26, 2017 Connect the map and unmap reverse-mapping operations to the realtime rmapbt via the deferred operation callbacks. This enables us to perform rmap operations against the correct btree. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
-
xfs: don't assume a left rmap when allocating a new rmap
djwong committedSep 26, 2017 The original rmap code assumed that there would always be at least one rmap in the rmapbt (the AG sb/agf/agi) and so errored out if it didn't find one. This assumption isn't true for rtrmapbt, so remove the check and just deal with the situation. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
-
xfs: wire up a new inode fork type for the realtime rmap
djwong committedSep 26, 2017 Plumb in the pieces we need to embed the root of the realtime rmap btree in an inode's data fork, complete with new fork type and on-disk interpretation functions. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
-
xfs: add realtime reverse map inode to superblock
djwong committedSep 26, 2017 Add a field to the superblock to record the rt rmapbt inode and load it at mount time. The rtrmapbt inode will have a unique extent format code, which means that we also have to update the inode validation and flush routines to look for it. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
-
xfs: add realtime rmap btree block detection to log recovery
djwong committedSep 26, 2017 Identify rtrmapbt blocks in the log correctly so that we can validate them during log recovery. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
-
xfs: add a realtime flag to the rmap update log redo items
djwong committedSep 26, 2017 Extend the rmap update (RUI) log items with a new realtime flag that indicates that the updates apply against the realtime rmapbt. We'll wire up the actual rmap code later. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
-
xfs: prepare rmap functions to deal with rtrmapbt
djwong committedSep 26, 2017 Prepare the high-level rmap functions to deal with the new realtime rmapbt and its slightly different conventions. Provide the ability to talk to either rmapbt or rtrmapbt formats from the same high level code. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
-
xfs: add realtime rmap btree operations
djwong committedSep 26, 2017 Implement the generic btree operations needed to manipulate rtrmap btree blocks. This is different from the regular rmapbt in that we allocate space from the filesystem at large, and are neither constrained to the free space nor any particular AG. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
-
xfs: realtime rmap btree transaction reservations
djwong committedSep 26, 2017 Make sure that there's enough log reservation to handle mapping and unmapping realtime extents. We have to reserve enough space to handle a split in the rtrmapbt to add the record and a second split in the regular rmapbt to record the rtrmapbt split. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
-
xfs: define the on-disk realtime rmap btree format
djwong committedSep 26, 2017 Start filling out the rtrmap btree implementation. Start with the on-disk btree format; add everything needed to read, write and manipulate rmap btree blocks. This prepares the way for connecting the btree operations implementation. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
-
xfs: introduce realtime rmap btree definitions
djwong committedSep 26, 2017 Add new realtime rmap btree definitions. The realtime rmap btree will be rooted from a hidden inode, but has its own shape and therefore needs to have most of its own separate types. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
-
xfs: widen xfs_refcount_irec fields to handle realtime rmapbt
djwong committedSep 26, 2017 Change the startblock and blockcount fields of xfs_refcount_irec to be 64 bits wide. This enables us to use the same high level rmap code for either tree. We'll also collect all the resulting breakage fixes here. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
-
xfs: support storing records in the inode core root
djwong committedSep 26, 2017 Make it so that we can actually store btree records in the inode core (i.e. enable bb_level == 0) so that the rtrmapbt can do this. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
-
xfs: make iroot_realloc a btree function
djwong committedSep 26, 2017 For btrees that are rooted in the inode core, we have to have a function to resize the root. This is fairly specific to each btree type, so make xfs_iroot_realloc a per-btree function. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
-
djwong committed
Sep 26, 2017 Whenever we load a buffer, explicitly re-call the structure verifier to ensure that memory isn't corrupting things. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
-
xfs: create a new buf_ops pointer to verify structure metadata
djwong committedSep 26, 2017 Expose all metadata structure buffer verifier functions via buf_ops. These will be used by the online scrub mechanism to look for problems with buffers that are already sitting around in memory. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
-
xfs: fail out of xfs_attr3_leaf_lookup_int if it looks corrupt
djwong committedSep 26, 2017 If the xattr leaf block looks corrupt, return -EFSCORRUPTED to userspace instead of ASSERTing on debug kernels or running off the end of the buffer on regular kernels. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
-
xfs: provide a centralized method for verifying inline fork data
djwong committedSep 26, 2017 Replace the current haphazard dir2 shortform verifier callsites with a centralized verifier function that can be called either with the default verifier functions or with a custom set. This helps us strengthen integrity checking while providing us with flexibility for repair tools. xfs_repair wants this to be able to supply its own verifier functions when trying to fix possibly corrupt metadata. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
-
xfs: refactor short form directory structure verifier function
djwong committedSep 26, 2017 Change the short form directory structure verifier function to return the instruction pointer of a failing check or NULL if everything's ok. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
-
xfs: create structure verifier function for short form symlinks
djwong committedSep 26, 2017 Create a function to check the structure of short form symlink targets. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
-
xfs: create structure verifier function for shortform xattrs
djwong committedSep 26, 2017 Create a function to perform structure verification for short form extended attributes. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
-
xfs: move inode fork verifiers to xfs_dinode_verify
djwong committedSep 26, 2017 Consolidate the fork size and format verifiers to xfs_dinode_verify so that we can reject bad inodes earlier and in a single place. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
-
xfs: verify dinode header first
djwong committedSep 26, 2017 Move the v3 inode integrity information (crc, owner, metauuid) before we look at anything else in the inode so that we don't waste time on a torn write or a totally garbled block. This makes xfs_dinode_verify more consistent with the other verifiers. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
-
xfs: refactor verifier callers to print address of failing check
djwong committedSep 26, 2017 Refactor the callers of verifiers to print the instruction address of a failing check. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
-
xfs: have buffer verifier functions report failing address
djwong committedSep 26, 2017 Modify each function that checks the contents of a metadata buffer to return the instruction address of the failing test so that we can report more precise failure errors to the log. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
-
xfs: remove XFS_WANT_CORRUPTED_RETURN from dir3 data verifiers
djwong committedSep 26, 2017 Since __xfs_dir3_data_check verifies on-disk metadata, we can't have it noisily blowing asserts and hanging the system on corrupt data coming in off the disk. Instead, have it return a boolean like all the other checker functions, and only have it noisily fail if we fail in debug mode. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
-
xfs: refactor long-format btree header verification routines
djwong committedSep 26, 2017 Create two helper functions to verify the headers of a long format btree block. We'll use this later for the realtime rmapbt. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
-
xfs: whine to dmesg when we encounter errors
djwong committedSep 26, 2017 Forward everything scrub whines about to dmesg. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
-
djwong committed
Sep 26, 2017 Repair inconsistent symbolic link data. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>