06 Dec, 2018

1 commit

  • commit 7b38460dc8e4eafba06c78f8e37099d3b34d473c upstream.

    Kanda Motohiro reported that expanding a tiny xattr into a large xattr
    fails on XFS because we remove the tiny xattr from a shortform fork and
    then try to re-add it after converting the fork to extents format having
    not removed the ATTR_REPLACE flag. This fails because the attr is no
    longer present, causing a fs shutdown.

    This is derived from the patch in his bug report, but we really
    shouldn't ignore a nonzero retval from the remove call.

    Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=199119
    Reported-by: kanda.motohiro@gmail.com
    Reviewed-by: Dave Chinner
    Reviewed-by: Christoph Hellwig
    Signed-off-by: Darrick J. Wong
    Signed-off-by: Ben Hutchings
    Signed-off-by: Sasha Levin

    Darrick J. Wong
     

10 Nov, 2018

1 commit

  • [ Upstream commit a606ebdb859e78beb757dfefa08001df366e2ef5 ]

    The truncate transaction does not ever modify the inode btree, but
    includes an associated log reservation. Update
    xfs_calc_itruncate_reservation() to remove the reservation
    associated with inobt updates.

    [Amir: This commit was merged for kernel v4.16 and a twin commit was
    merged for xfsprogs v4.16. As a result, a small xfs filesystem
    formatted with features -m rmapbt=1,reflink=1 using mkfs.xfs
    version >= v4.16 cannot be mounted with kernel < v4.16.

    For example, xfstests generic/17{1,2,3} format a small fs and
    when trying to mount it, they fail with an assert on this very
    demonic line:

    XFS (vdc): Log size 3075 blocks too small, minimum size is 3717 blocks
    XFS (vdc): AAIEEE! Log failed size checks. Abort!
    XFS: Assertion failed: 0, file: src/linux/fs/xfs/xfs_log.c, line: 666

    The simple solution for stable kernels is to apply this patch,
    because mkfs.xfs v4.16 is already in the wild, so we have to
    assume that xfs filesystems with a "too small" log exist.
    Regardless, xfsprogs maintainers should also consider reverting
    the twin patch to stop creating those filesystems for the sake
    of users with unpatched kernels.]

    Signed-off-by: Brian Foster
    Reviewed-by: Dave Chinner
    Reviewed-by: Darrick J. Wong
    Signed-off-by: Darrick J. Wong
    Cc: # v4.9+
    Signed-off-by: Amir Goldstein
    Reviewed-by: Darrick J . Wong
    Signed-off-by: Sasha Levin

    Brian Foster
     

09 Aug, 2018

1 commit

  • commit bb3d48dcf86a97dc25fe9fc2c11938e19cb4399a upstream.

    xfs_attr3_leaf_create may have errored out before instantiating a buffer,
    for example if the blkno is out of range. In that case there is no work
    to do to remove it, and in fact xfs_da_shrink_inode will lead to an oops
    if we try.

    This also seems to fix a flaw where the original error from
    xfs_attr3_leaf_create gets overwritten in the cleanup case, and it
    removes a pointless assignment to bp which isn't used after this.

    Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=199969
    Reported-by: Xu, Wen
    Tested-by: Xu, Wen
    Signed-off-by: Eric Sandeen
    Reviewed-by: Darrick J. Wong
    Signed-off-by: Darrick J. Wong
    Cc: Eduardo Valentin
    Signed-off-by: Greg Kroah-Hartman

    Eric Sandeen
     

05 Jun, 2018

2 commits

  • commit a27ba2607e60312554cbcd43fc660b2c7f29dc9c upstream.

    The struct xfs_agfl v5 header was originally introduced with
    unexpected padding that caused the AGFL to operate with one less
    slot than intended. The header has since been packed, but the fix
    left an incompatibility for users who upgrade from an old kernel
    with the unpacked header to a newer kernel with the packed header
    while the AGFL happens to wrap around the end. The newer kernel
    recognizes one extra slot at the physical end of the AGFL that the
    previous kernel did not. The new kernel will eventually attempt to
    allocate a block from that slot, which contains invalid data, and
    cause a crash.

    This condition can be detected by comparing the active range of the
    AGFL to the count. While this detects a padding mismatch, it can
    also trigger false positives for unrelated flcount corruption. Since
    we cannot distinguish a size mismatch due to padding from unrelated
    corruption, we can't trust the AGFL enough to simply repopulate the
    empty slot.

    Instead, avoid unnecessarily complex detection logic and and use a
    solution that can handle any form of flcount corruption that slips
    through read verifiers: distrust the entire AGFL and reset it to an
    empty state. Any valid blocks within the AGFL are intentionally
    leaked. This requires xfs_repair to rectify (which was already
    necessary based on the state the AGFL was found in). The reset
    mitigates the side effect of the padding mismatch problem from a
    filesystem crash to a free space accounting inconsistency. The
    generic approach also means that this patch can be safely backported
    to kernels with or without a packed struct xfs_agfl.

    Check the AGF for an invalid freelist count on initial read from
    disk. If detected, set a flag on the xfs_perag to indicate that a
    reset is required before the AGFL can be used. In the first
    transaction that attempts to use a flagged AGFL, reset it to empty,
    warn the user about the inconsistency and allow the freelist fixup
    code to repopulate the AGFL with new blocks. The xfs_perag flag is
    cleared to eliminate the need for repeated checks on each block
    allocation operation.

    This allows kernels that include the packing fix commit 96f859d52bcb
    ("libxfs: pack the agfl header structure so XFS_AGFL_SIZE is correct")
    to handle older unpacked AGFL formats without a filesystem crash.

    Suggested-by: Dave Chinner
    Signed-off-by: Brian Foster
    Reviewed-by: Darrick J. Wong
    Reviewed-by Dave Chiluk
    Signed-off-by: Darrick J. Wong
    Signed-off-by: Greg Kroah-Hartman

    Brian Foster
     
  • commit a78ee256c325ecfaec13cafc41b315bd4e1dd518 upstream.

    The AGFL size calculation is about to get more complex, so lets turn
    the macro into a function first and remove the macro.

    Signed-off-by: Dave Chinner
    [darrick: forward port to newer kernel, simplify the helper]
    Signed-off-by: Darrick J. Wong
    Reviewed-by: Brian Foster
    Signed-off-by: Greg Kroah-Hartman

    Dave Chinner
     

20 Dec, 2017

1 commit

  • [ Upstream commit 5e422f5e4fd71d18bc6b851eeb3864477b3d842e ]

    There was one spot in xfs_bmap_add_extent_unwritten_real that didn't use the
    passed in new extent state but always converted to normal, leading to wrong
    behavior when converting from normal to unwritten.

    Only found by code inspection, it seems like this code path to move partial
    extent from written to unwritten while merging it with the next extent is
    rarely exercised.

    Signed-off-by: Christoph Hellwig
    Reviewed-by: Brian Foster
    Reviewed-by: Darrick J. Wong
    Signed-off-by: Darrick J. Wong
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Christoph Hellwig
     

02 Nov, 2017

1 commit

  • Many source files in the tree are missing licensing information, which
    makes it harder for compliance tools to determine the correct license.

    By default all files without license information are under the default
    license of the kernel, which is GPL version 2.

    Update the files which contain no license information with the 'GPL-2.0'
    SPDX license identifier. The SPDX identifier is a legally binding
    shorthand, which can be used instead of the full boiler plate text.

    This patch is based on work done by Thomas Gleixner and Kate Stewart and
    Philippe Ombredanne.

    How this work was done:

    Patches were generated and checked against linux-4.14-rc6 for a subset of
    the use cases:
    - file had no licensing information it it.
    - file was a */uapi/* one with no licensing information in it,
    - file was a */uapi/* one with existing licensing information,

    Further patches will be generated in subsequent months to fix up cases
    where non-standard license headers were used, and references to license
    had to be inferred by heuristics based on keywords.

    The analysis to determine which SPDX License Identifier to be applied to
    a file was done in a spreadsheet of side by side results from of the
    output of two independent scanners (ScanCode & Windriver) producing SPDX
    tag:value files created by Philippe Ombredanne. Philippe prepared the
    base worksheet, and did an initial spot review of a few 1000 files.

    The 4.13 kernel was the starting point of the analysis with 60,537 files
    assessed. Kate Stewart did a file by file comparison of the scanner
    results in the spreadsheet to determine which SPDX license identifier(s)
    to be applied to the file. She confirmed any determination that was not
    immediately clear with lawyers working with the Linux Foundation.

    Criteria used to select files for SPDX license identifier tagging was:
    - Files considered eligible had to be source code files.
    - Make and config files were included as candidates if they contained >5
    lines of source
    - File already had some variant of a license header in it (even if
    Reviewed-by: Philippe Ombredanne
    Reviewed-by: Thomas Gleixner
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

17 Oct, 2017

1 commit

  • The writeback rework in commit fbcc02561359 ("xfs: Introduce
    writeback context for writepages") introduced a subtle change in
    behavior with regard to the block mapping used across the
    ->writepages() sequence. The previous xfs_cluster_write() code would
    only flush pages up to EOF at the time of the writepage, thus
    ensuring that any pages due to file-extending writes would be
    handled on a separate cycle and with a new, updated block mapping.

    The updated code establishes a block mapping in xfs_writepage_map()
    that could extend beyond EOF if the file has post-eof preallocation.
    Because we now use the generic writeback infrastructure and pass the
    cached mapping to each writepage call, there is no implicit EOF
    limit in place. If eofblocks trimming occurs during ->writepages(),
    any post-eof portion of the cached mapping becomes invalid. The
    eofblocks code has no means to serialize against writeback because
    there are no pages associated with post-eof blocks. Therefore if an
    eofblocks trim occurs and is followed by a file-extending buffered
    write, not only has the mapping become invalid, but we could end up
    writing a page to disk based on the invalid mapping.

    Consider the following sequence of events:

    - A buffered write creates a delalloc extent and post-eof
    speculative preallocation.
    - Writeback starts and on the first writepage cycle, the delalloc
    extent is converted to real blocks (including the post-eof blocks)
    and the mapping is cached.
    - The file is closed and xfs_release() trims post-eof blocks. The
    cached writeback mapping is now invalid.
    - Another buffered write appends the file with a delalloc extent.
    - The concurrent writeback cycle picks up the just written page
    because the writeback range end is LLONG_MAX. xfs_writepage_map()
    attributes it to the (now invalid) cached mapping and writes the
    data to an incorrect location on disk (and where the file offset is
    still backed by a delalloc extent).

    This problem is reproduced by xfstests test generic/464, which
    triggers racing writes, appends, open/closes and writeback requests.

    To address this problem, trim the mapping used during writeback to
    within EOF when the mapping is validated. This ensures the mapping
    is revalidated for any pages encountered beyond EOF as of the time
    the current mapping was cached or last validated.

    Reported-by: Eryu Guan
    Diagnosed-by: Eryu Guan
    Signed-off-by: Brian Foster
    Reviewed-by: Dave Chinner
    Reviewed-by: Darrick J. Wong
    Signed-off-by: Darrick J. Wong

    Brian Foster
     

12 Oct, 2017

3 commits

  • Jason reported that a corrupted filesystem failed to replay
    the log with a metadata block out of bounds warning:

    XFS (dm-2): _xfs_buf_find: Block out of range: block 0x80270fff8, EOFS 0x9c40000

    _xfs_buf_find() and xfs_btree_get_bufs() return NULL if
    that happens, and then when xfs_alloc_fix_freelist() calls
    xfs_trans_binval() on that NULL bp, we oops with:

    BUG: unable to handle kernel NULL pointer dereference at 00000000000000f8

    We don't handle _xfs_buf_find errors very well, every
    caller higher up the stack gets to guess at why it failed.
    But we should at least handle it somehow, so return
    EFSCORRUPTED here.

    Reported-by: Jason L Tibbitts III
    Signed-off-by: Eric Sandeen
    Reviewed-by: Christoph Hellwig
    Reviewed-by: Darrick J. Wong
    Signed-off-by: Darrick J. Wong

    Eric Sandeen
     
  • Bool initializations should use true and false. Bool tests don't need
    comparisons.

    Signed-off-by: Thomas Meyer
    Reviewed-by: Brian Foster
    Reviewed-by: Darrick J. Wong
    Signed-off-by: Darrick J. Wong

    Thomas Meyer
     
  • Prevent kmemcheck from throwing warnings about reading uninitialised
    memory when formatting inodes into the incore log buffer. There are
    several issues here - we don't always log all the fields in the
    inode log format item, and we never log the inode the
    di_next_unlinked field.

    In the case of the inode log format item, this is exacerbated
    by the old xfs_inode_log_format structure padding issue. Hence make
    the padded, 64 bit aligned version of the structure the one we always
    use for formatting the log and get rid of the 64 bit variant. This
    means we'll always log the 64-bit version and so recovery only needs
    to convert from the unpadded 32 bit version from older 32 bit
    kernels.

    Signed-Off-By: Dave Chinner
    Tested-by: Tetsuo Handa
    Reviewed-by: Brian Foster
    Reviewed-by: Darrick J. Wong
    Signed-off-by: Darrick J. Wong

    Dave Chinner
     

27 Sep, 2017

2 commits

  • In commit fd26a88093ba we added a worst case estimate for rmapbt blocks
    needed to satisfy the block mapping request. Since then, we added the
    ability to reserve enough space in each AG such that we should never run
    out of blocks to grow the rmapbt, which makes this calculation
    unnecessary. Revert the commit because it makes the extra delalloc
    indlen accounting unnecessary and incorrect.

    Reported-by: Eryu Guan
    Reviewed-by: Brian Foster
    Reviewed-by: Christoph Hellwig
    Signed-off-by: Darrick J. Wong

    Darrick J. Wong
     
  • We call __xfs_ag_resv_init to make a per-AG reservation for each AG.
    This makes the reservation per-AG, not per-filesystem. Therefore, it
    is incorrect to adjust m_ag_max_usable for each AG. Adjust it only
    when we're reserving AG 0's blocks so that we only do it once per fs.

    Signed-off-by: Darrick J. Wong
    Reviewed-by: Brian Foster

    Darrick J. Wong
     

02 Sep, 2017

14 commits

  • Fix up all the compiler warnings that have crept in.

    Signed-off-by: Darrick J. Wong
    Reviewed-by: Christoph Hellwig

    Darrick J. Wong
     
  • In Christoph's patch to refactor xfs_bmse_merge, the updated rmap code
    does more work than it needs to (because map-extent auto-merges
    records). Remove the unnecessary unmap and save ourselves a deferred
    op.

    Signed-off-by: Darrick J. Wong
    Reviewed-by: Christoph Hellwig

    Darrick J. Wong
     
  • This abstracts the function away from details of the low-level extent
    list implementation.

    Signed-off-by: Christoph Hellwig
    Reviewed-by: Darrick J. Wong
    Signed-off-by: Darrick J. Wong

    Christoph Hellwig
     
  • This abstracts the function away from details of the low-level extent
    list implementation.

    Note that it seems like the previous implementation of rmap for
    the merge case was completely broken, but it no seems appear to
    trigger that.

    Signed-off-by: Christoph Hellwig
    Reviewed-by: Darrick J. Wong
    Signed-off-by: Darrick J. Wong

    Christoph Hellwig
     
  • For the first right move we need to look up next_fsb. That means
    our last fsb that contains next_fsb must also be the current extent,
    so take advantage of that by moving the code around a bit.

    Signed-off-by: Christoph Hellwig
    Reviewed-by: Darrick J. Wong
    Signed-off-by: Darrick J. Wong

    Christoph Hellwig
     
  • Use the bmap abstraction instead of open-coding bmbt details here.

    Signed-off-by: Christoph Hellwig
    Reviewed-by: Darrick J. Wong
    Signed-off-by: Darrick J. Wong

    Christoph Hellwig
     
  • Use the helper instead of open coding it, to provide a better abstraction
    for the scalable extent list work. This also gets an additional assert
    and trace point for free.

    Signed-off-by: Christoph Hellwig
    Reviewed-by: Darrick J. Wong
    Signed-off-by: Darrick J. Wong

    Christoph Hellwig
     
  • This helper is used to update an extent record based on the extent index,
    and can be used to provide a level of abstractions between callers that
    want to modify in-core extent records and the details of the extent list
    implementation.

    Also switch all users of the xfs_bmbt_set_all(xfs_iext_get_ext(...))
    pattern to this new helper.

    Signed-off-by: Christoph Hellwig
    Reviewed-by: Darrick J. Wong
    Signed-off-by: Darrick J. Wong

    Christoph Hellwig
     
  • The owner change bmbt scan that occurs during extent swap operations
    does not handle ordered buffer failures. Buffers that cannot be
    marked ordered must be physically logged so previously dirty ranges
    of the buffer can be relogged in the transaction.

    Since the bmbt scan may need to process and potentially log a large
    number of blocks, we can't expect to complete this operation in a
    single transaction. Update extent swap to use a permanent
    transaction with enough log reservation to physically log a buffer.
    Update the bmbt scan to physically log any buffers that cannot be
    ordered and to terminate the scan with -EAGAIN. On -EAGAIN, the
    caller rolls the transaction and restarts the scan. Finally, update
    the bmbt scan helper function to skip bmbt blocks that already match
    the expected owner so they are not reprocessed after scan restarts.

    Signed-off-by: Brian Foster
    Reviewed-by: Darrick J. Wong
    Reviewed-by: Christoph Hellwig
    [darrick: fix the xfs_trans_roll call]
    Signed-off-by: Darrick J. Wong

    Brian Foster
     
  • Extent swap uses xfs_btree_visit_blocks() to fix up bmbt block
    owners on v5 (!rmapbt) filesystems. The bmbt scan uses
    xfs_btree_lookup_get_block() to read bmbt blocks which verifies the
    current owner of the block against the parent inode of the bmbt.
    This works during extent swap because the bmbt owners are updated to
    the opposite inode number before the inode extent forks are swapped.

    The modified bmbt blocks are marked as ordered buffers which allows
    everything to commit in a single transaction. If the transaction
    commits to the log and the system crashes such that recovery of the
    extent swap is required, log recovery restarts the bmbt scan to fix
    up any bmbt blocks that may have not been written back before the
    crash. The log recovery bmbt scan occurs after the inode forks have
    been swapped, however. This causes the bmbt block owner verification
    to fail, leads to log recovery failure and requires xfs_repair to
    zap the log to recover.

    Define a new invalid inode owner flag to inform the btree block
    lookup mechanism that the current inode may be invalid with respect
    to the current owner of the bmbt block. Set this flag on the cursor
    used for change owner scans to allow this operation to work at
    runtime and during log recovery.

    Signed-off-by: Brian Foster
    Fixes: bb3be7e7c ("xfs: check for bogus values in btree block headers")
    Cc: stable@vger.kernel.org
    Reviewed-by: Darrick J. Wong
    Reviewed-by: Christoph Hellwig
    Signed-off-by: Darrick J. Wong

    Brian Foster
     
  • Ordered buffers are attached to transactions and pushed through the
    logging infrastructure just like normal buffers with the exception
    that they are not actually written to the log. Therefore, we don't
    need to log dirty ranges of ordered buffers. xfs_trans_log_buf() is
    called on ordered buffers to set up all of the dirty state on the
    transaction, buffer and log item and prepare the buffer for I/O.

    Now that xfs_trans_dirty_buf() is available, call it from
    xfs_trans_ordered_buf() so the latter is now mutually exclusive with
    xfs_trans_log_buf(). This reflects the implementation of ordered
    buffers and helps eliminate confusion over the need to log ranges of
    ordered buffers just to set up internal log state.

    Signed-off-by: Brian Foster
    Reviewed-by: Allison Henderson
    Reviewed-by: Darrick J. Wong
    Reviewed-by: Christoph Hellwig
    Signed-off-by: Darrick J. Wong

    Brian Foster
     
  • And instead require callers to explicitly join the inode using
    xfs_defer_ijoin. Also consolidate the defer error handling in
    a few places using a goto label.

    Signed-off-by: Christoph Hellwig
    Reviewed-by: Darrick J. Wong
    Signed-off-by: Darrick J. Wong

    Christoph Hellwig
     
  • Signed-off-by: Christoph Hellwig
    Reviewed-by: Dave Chinner
    Reviewed-by: Darrick J. Wong
    Signed-off-by: Darrick J. Wong

    Christoph Hellwig
     
  • Split xfs_trans_roll into a low-level helper that just rolls the
    actual transaction and a new higher level xfs_trans_roll_inode
    that takes care of logging and rejoining the inode. This gets
    rid of the NULL inode case, and allows to simplify the special
    cases in the deferred operation code.

    Signed-off-by: Christoph Hellwig
    Reviewed-by: Darrick J. Wong
    Signed-off-by: Darrick J. Wong

    Christoph Hellwig
     

23 Aug, 2017

1 commit

  • In a filesystem without finobt, the Space manager selects an AG to alloc a new
    inode, where xfs_dialloc_ag_inobt() will search the AG for the free slot chunk.

    When the new inode is in the same AG as its parent, the btree will be searched
    starting on the parent's record, and then retried from the top if no slot is
    available beyond the parent's record.

    To exit this loop though, xfs_dialloc_ag_inobt() relies on the fact that the
    btree must have a free slot available, once its callers relied on the
    agi->freecount when deciding how/where to allocate this new inode.

    In the case when the agi->freecount is corrupted, showing available inodes in an
    AG, when in fact there is none, this becomes an infinite loop.

    Add a way to stop the loop when a free slot is not found in the btree, making
    the function to fall into the whole AG scan which will then, be able to detect
    the corruption and shut the filesystem down.

    As pointed by Brian, this might impact performance, giving the fact we
    don't reset the search distance anymore when we reach the end of the
    tree, giving it fewer tries before falling back to the whole AG search, but
    it will only affect searches that start within 10 records to the end of the tree.

    Signed-off-by: Carlos Maiolino
    Reviewed-by: Darrick J. Wong
    Signed-off-by: Darrick J. Wong

    Carlos Maiolino
     

12 Aug, 2017

1 commit

  • When we try to allocate a free inode by searching the inobt, we try to
    find the inode nearest the parent inode by searching chunks both left
    and right of the chunk containing the parent. As an optimization, we
    cache the leftmost and rightmost records that we previously searched; if
    we do another allocation with the same parent inode, we'll pick up the
    search where it last left off.

    There's a bug in the case where we found a free inode to the left of the
    parent's chunk: we need to update the cached left and right records, but
    because we already reassigned the right record to point to the left, we
    end up assigning the left record to both the cached left and right
    records.

    This isn't a correctness problem strictly, but it can result in the next
    allocation rechecking chunks unnecessarily or allocating inodes further
    away from the parent than it needs to. Fix it by swapping the record
    pointer after we update the cached left and right records.

    Fixes: bd169565993b ("xfs: speed up free inode search")
    Signed-off-by: Omar Sandoval
    Reviewed-by: Christoph Hellwig
    Reviewed-by: Darrick J. Wong
    Signed-off-by: Darrick J. Wong

    Omar Sandoval
     

26 Jul, 2017

1 commit

  • Just like in the allocator we must avoid touching multiple AGs out of
    order when freeing blocks, as freeing still locks the AGF and can cause
    the same AB-BA deadlocks as in the allocation path.

    Signed-off-by: Christoph Hellwig
    Reported-by: Nikolay Borisov
    Reviewed-by: Darrick J. Wong
    Signed-off-by: Darrick J. Wong

    Christoph Hellwig
     

25 Jul, 2017

1 commit


21 Jul, 2017

3 commits


14 Jul, 2017

2 commits

  • This reverts commit 50e0bdbe9f48f98bb02eac7030d682f4716884ae.

    The new XFS_QMOPT_NOLOCK isn't used at all, and conditional locking based
    on a flag is always the wrong thing to do - we should be having helpers
    that can be called without the lock instead.

    Signed-off-by: Christoph Hellwig
    Reviewed-by: Darrick J. Wong
    Signed-off-by: Darrick J. Wong

    Christoph Hellwig
     
  • The comment mentioned the wrong lock. Also add an ASSERT to assert
    this locking precondition.

    Signed-off-by: Christoph Hellwig
    Reviewed-by: Darrick J. Wong
    Signed-off-by: Darrick J. Wong

    Christoph Hellwig
     

08 Jul, 2017

1 commit

  • In quite a few places we call xfs_da_read_buf with a mappedbno that we
    don't control, then assume that the function passes back either an error
    code or a buffer pointer. Unfortunately, if mappedbno == -2 and bno
    maps to a hole, we get a return code of zero and a NULL buffer, which
    means that we crash if we actually try to use that buffer pointer. This
    happens immediately when we set the buffer type for transaction context.

    Therefore, check that we have no error code and a non-NULL bp before
    trying to use bp. This patch is a follow-up to an incomplete fix in
    96a3aefb8ffde231 ("xfs: don't crash if reading a directory results in an
    unexpected hole").

    Signed-off-by: Darrick J. Wong

    Darrick J. Wong
     

07 Jul, 2017

1 commit

  • XFS has a maximum symlink target length of 1024 bytes; this is a
    holdover from the Irix days. Unfortunately, the constant establishing
    this is 'MAXPATHLEN' and is /not/ the same as the Linux MAXPATHLEN,
    which is 4096.

    The kernel enforces its 1024 byte MAXPATHLEN on symlink targets, but
    xfsprogs picks up the (Linux) system 4096 byte MAXPATHLEN, which means
    that xfs_repair doesn't complain about oversized symlinks.

    Since this is an on-disk format constraint, put the define in the XFS
    namespace and move everything over to use the new name.

    Signed-off-by: Darrick J. Wong
    Reviewed-by: Brian Foster

    Darrick J. Wong
     

28 Jun, 2017

2 commits