Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[2.1] Linux 6.6/6.7/6.8 compat #15860

Merged
merged 14 commits into from
Feb 8, 2024

Commits on Feb 7, 2024

  1. Linux 6.6 compat: use inode_get/set_ctime*(...)

    In Linux commit 13bc24457850583a2e7203ded05b7209ab4bc5ef, direct access
    to the i_ctime member of struct inode was removed. The new approach is
    to use accessor methods that exclusively handle passing the timestamp
    around by value. This change adds new tests for each of these functions
    and introduces zpl_* equivalents in include/os/linux/zfs/sys/zpl.h. In
    where the inode_get/set_ctime*() functions exist, these zpl_* calls will
    be mapped to the new functions. On older kernels, these macros just wrap
    direct-access calls. The code that operated on an address of ip->i_ctime
    to call ZFS_TIME_DECODE() now will take a local copy using
    zpl_inode_get_ctime(), and then pass the address of the local copy when
    performing the ZFS_TIME_DECODE() call, in all cases, rather than
    directly accessing the member.
    
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Signed-off-by: Coleman Kane <ckane@colemankane.org>
    Closes openzfs#15263
    Closes openzfs#15257
    (cherry picked from commit fe9d409)
    ckane authored and robn committed Feb 7, 2024
    Configuration menu
    Copy the full SHA
    a8f1b5b View commit details
    Browse the repository at this point in the history
  2. Linux 6.6 compat: generic_fillattr has a new u32 request_mask added a…

    …t arg2
    
    In commit 0d72b92883c651a11059d93335f33d65c6eb653b, a new u32 argument
    for the request_mask was added to generic_fillattr. This is the same
    request_mask for statx that's present in the most recent API implemented
    by zpl_getattr_impl. This commit conditionally adds it to the
    zpl_generic_fillattr(...) macro, as well as the zfs_getattr_fast(...)
    implementation, when configure determines it's present in the kernel's
    generic_fillattr(...).
    
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Signed-off-by: Coleman Kane <ckane@colemankane.org>
    Closes openzfs#15263
    (cherry picked from commit 21875dd)
    ckane authored and robn committed Feb 7, 2024
    Configuration menu
    Copy the full SHA
    4b7e39a View commit details
    Browse the repository at this point in the history
  3. Linux 6.6 compat: fsync_bdev() has been removed in favor of sync_bloc…

    …kdev()
    
    In Linux commit 560e20e4bf6484a0c12f9f3c7a1aa55056948e1e, the
    fsync_bdev() function was removed in favor of sync_blockdev() to do
    (roughly) the same thing, given the same input. This change
    conditionally attempts to call sync_blockdev() if fsync_bdev() isn't
    discovered during configure.
    
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Signed-off-by: Coleman Kane <ckane@colemankane.org>
    Closes openzfs#15263
    (cherry picked from commit 3f67e01)
    ckane authored and robn committed Feb 7, 2024
    Configuration menu
    Copy the full SHA
    8960e68 View commit details
    Browse the repository at this point in the history
  4. Linux 6.6 compat: fix configure error with clang (openzfs#15558)

    With Linux v6.6.x and clang 16, a configure step fails on a warning that
    later results in an error while building, due to 'ts' being
    uninitialized. Add a trivial initialization to silence the warning.
    
    Signed-off-by: Jaron Kent-Dobias <jaron@kent-dobias.com>
    Reviewed-by: Tony Hutter <hutter2@llnl.gov>
    (cherry picked from commit d813aa8)
    kentdobias authored and robn committed Feb 7, 2024
    Configuration menu
    Copy the full SHA
    c6fa034 View commit details
    Browse the repository at this point in the history
  5. linux 6.7 compat: simplify current_time() check

    6.7 changed the names of the time members in struct inode, so we can't
    assign back to it because we don't know its name. In practice this
    doesn't matter though - if we're missing current_time(), then we must be
    on <4.9, and we know our fallback will need to return timespec.
    
    Signed-off-by: Rob Norris <robn@despairlabs.com>
    Sponsored-by: https://github.com/sponsors/robn
    (cherry picked from commit b3626f0)
    robn committed Feb 7, 2024
    Configuration menu
    Copy the full SHA
    5bc85c9 View commit details
    Browse the repository at this point in the history
  6. linux 6.7 compat: use inode atime/mtime accessors

    6.6 made i_ctime inaccessible; 6.7 has done the same for i_atime and
    i_mtime. This extends the method used for ctime in b37f293 to atime
    and mtime as well.
    
    Signed-off-by: Rob Norris <robn@despairlabs.com>
    Sponsored-by: https://github.com/sponsors/robn
    (cherry picked from commit 3c13601)
    robn committed Feb 7, 2024
    Configuration menu
    Copy the full SHA
    136aa42 View commit details
    Browse the repository at this point in the history
  7. linux 6.7 compat: handle superblock shrinker member change

    In 6.7 the superblock shrinker member s_shrink has changed from being an
    embedded struct to a pointer. Detect this, and don't take a reference if
    it already is one.
    
    Signed-off-by: Rob Norris <robn@despairlabs.com>
    Sponsored-by: https://github.com/sponsors/robn
    (cherry picked from commit 18a9185)
    robn committed Feb 7, 2024
    Configuration menu
    Copy the full SHA
    36acc9b View commit details
    Browse the repository at this point in the history
  8. linux 6.7 compat: rework shrinker setup for heap allocations

    6.7 changes the shrinker API such that shrinkers must be allocated
    dynamically by the kernel. To accomodate this, this commit reworks
    spl_register_shrinker() to do something similar against earlier kernels.
    
    Signed-off-by: Rob Norris <robn@despairlabs.com>
    Sponsored-by: https://github.com/sponsors/robn
    (cherry picked from commit 03b8409)
    robn committed Feb 7, 2024
    Configuration menu
    Copy the full SHA
    e92ae1b View commit details
    Browse the repository at this point in the history
  9. Linux 6.5 compat: check BLK_OPEN_EXCL is defined

    On some systems we already have blkdev_get_by_path() with 4 args
    but still the old FMODE_EXCL and not BLK_OPEN_EXCL defined.
    The vdev_bdev_mode() function was added to handle this case
    but there was no generic way to specify exclusive access.
    
    Reviewed-by: Brian Atkinson <batkinson@lanl.gov>
    Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Closes openzfs#15692
    (cherry picked from commit d530d5d)
    behlendorf authored and robn committed Feb 7, 2024
    Configuration menu
    Copy the full SHA
    d094732 View commit details
    Browse the repository at this point in the history
  10. Linux 6.7 compat: zfs_setattr fix atime update

    In db4fc55 I messed up and changed this bit of code to set the inode
    atime to an uninitialised value, when actually it was just supposed to
    loading the atime from the inode to be stored in the SA. This changes it
    to what it should have been.
    
    Ensure times change by the right amount Previously, we only checked
    if the times changed at all, which missed a bug where the atime was
    being set to an undefined value.
    
    Now ensure the times change by two seconds (or thereabouts), ensuring
    we catch cases where we set the time to something bonkers
    
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Signed-off-by: Rob Norris <robn@despairlabs.com>
    Sponsored-by: https://despairlabs.com/sponsor/
    Closes openzfs#15762
    Closes openzfs#15773
    (cherry picked from commit 2ecc2df)
    robn committed Feb 7, 2024
    Configuration menu
    Copy the full SHA
    701d706 View commit details
    Browse the repository at this point in the history
  11. Linux 6.8 compat: make test functions static

    The kernel is now being compiled with -Wmissing-prototypes. Most of our
    test stub functions had no prototype, and failed to compile. Since they
    don't need to be visible anywhere else, just make them all static.
    
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Signed-off-by: Rob Norris <robn@despairlabs.com>
    Sponsored-by: https://despairlabs.com/sponsor/
    Closes openzfs#15805
    (cherry picked from commit 64afc4e)
    robn committed Feb 7, 2024
    Configuration menu
    Copy the full SHA
    133b71b View commit details
    Browse the repository at this point in the history
  12. Linux 6.8 compat: update for new bdev access functions

    blkdev_get_by_path() and blkdev_put() have been replaced by
    bdev_open_by_path() and bdev_release(), which return a "handle" object
    with the bdev object itself inside.
    
    This adds detection for the new functions, and macros to handle the old
    and new forms consistently.
    
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Signed-off-by: Rob Norris <robn@despairlabs.com>
    Sponsored-by: https://despairlabs.com/sponsor/
    Closes openzfs#15805
    (cherry picked from commit ce782d0)
    robn committed Feb 7, 2024
    Configuration menu
    Copy the full SHA
    5e9a38c View commit details
    Browse the repository at this point in the history

Commits on Feb 8, 2024

  1. Linux 6.8 compat: implement strlcpy fallback

    Linux has removed strlcpy in favour of strscpy. This implements a
    fallback implementation of strlcpy for this case.
    
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Signed-off-by: Rob Norris <robn@despairlabs.com>
    Sponsored-by: https://despairlabs.com/sponsor/
    Closes openzfs#15805
    (cherry picked from commit 7466e09)
    robn committed Feb 8, 2024
    Configuration menu
    Copy the full SHA
    90ef2d4 View commit details
    Browse the repository at this point in the history
  2. Linux 6.8 compat: replace MAX_ORDER define

    MAX_ORDER has been renamed to MAX_PAGE_ORDER. Rather than just
    redefining it, instead define our own name and set it consistently from
    the start.
    
    Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
    Signed-off-by: Rob Norris <robn@despairlabs.com>
    Sponsored-by: https://despairlabs.com/sponsor/
    Closes openzfs#15805
    (cherry picked from commit 09e6724)
    robn committed Feb 8, 2024
    Configuration menu
    Copy the full SHA
    9d68afb View commit details
    Browse the repository at this point in the history