27 Sep, 2020

4 commits


03 Jun, 2020

2 commits

  • Pull DAX updates part one from Darrick Wong:
    "After many years of LKML-wrangling about how to enable programs to
    query and influence the file data access mode (DAX) when a filesystem
    resides on storage devices such as persistent memory, Ira Weiny has
    emerged with a proposed set of standard behaviors that has not been
    shot down by anyone! We're more or less standardizing on the current
    XFS behavior and adapting ext4 to do the same.

    This is the first of a handful pull requests that will make ext4 and
    XFS present a consistent interface for user programs that care about
    DAX. We add a statx attribute that programs can check to see if DAX is
    enabled on a particular file. Then, we update the DAX documentation to
    spell out the user-visible behaviors that filesystems will guarantee
    (until the next storage industry shakeup). The on-disk inode flag has
    been in XFS for a few years now.

    Summary:

    - Clean up io_is_direct.

    - Add a new statx flag to indicate when file data access is being
    done via DAX (as opposed to the page cache).

    - Update the documentation for how system administrators and
    application programmers can take advantage of the (still
    experimental DAX) feature"

    Link: https://lore.kernel.org/lkml/20200505002016.1085071-1-ira.weiny@intel.com/

    * tag 'vfs-5.8-merge-1' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux:
    Documentation/dax: Update Usage section
    fs/stat: Define DAX statx attribute
    fs: Remove unneeded IS_DAX() check in io_is_direct()

    Linus Torvalds
     
  • Pull io_uring updates from Jens Axboe:
    "A relatively quiet round, mostly just fixes and code improvements. In
    particular:

    - Make statx just use the generic statx handler, instead of open
    coding it. We don't need that anymore, as we always call it async
    safe (Bijan)

    - Enable closing of the ring itself. Also fixes O_PATH closure (me)

    - Properly name completion members (me)

    - Batch reap of dead file registrations (me)

    - Allow IORING_OP_POLL with double waitqueues (me)

    - Add tee(2) support (Pavel)

    - Remove double off read (Pavel)

    - Fix overflow cancellations (Pavel)

    - Improve CQ timeouts (Pavel)

    - Async defer drain fixes (Pavel)

    - Add support for enabling/disabling notifications on a registered
    eventfd (Stefano)

    - Remove dead state parameter (Xiaoguang)

    - Disable SQPOLL submit on dying ctx (Xiaoguang)

    - Various code cleanups"

    * tag 'for-5.8/io_uring-2020-06-01' of git://git.kernel.dk/linux-block: (29 commits)
    io_uring: fix overflowed reqs cancellation
    io_uring: off timeouts based only on completions
    io_uring: move timeouts flushing to a helper
    statx: hide interfaces no longer used by io_uring
    io_uring: call statx directly
    statx: allow system call to be invoked from io_uring
    io_uring: add io_statx structure
    io_uring: get rid of manual punting in io_close
    io_uring: separate DRAIN flushing into a cold path
    io_uring: don't re-read sqe->off in timeout_prep()
    io_uring: simplify io_timeout locking
    io_uring: fix flush req->refs underflow
    io_uring: don't submit sqes when ctx->refs is dying
    io_uring: async task poll trigger cleanup
    io_uring: add tee(2) support
    splice: export do_tee()
    io_uring: don't repeat valid flag list
    io_uring: rename io_file_put()
    io_uring: remove req->needs_fixed_files
    io_uring: cleanup io_poll_remove_one() logic
    ...

    Linus Torvalds
     

27 May, 2020

2 commits


14 May, 2020

4 commits

  • Determining whether a path or file descriptor refers to a mountpoint (or
    more precisely a mount root) is not trivial using current tools.

    Add a flag to statx that indicates whether the path or fd refers to the
    root of a mount or not.

    Cc: linux-api@vger.kernel.org
    Cc: linux-man@vger.kernel.org
    Reported-by: Lennart Poettering
    Reported-by: J. Bruce Fields
    Signed-off-by: Miklos Szeredi
    Reviewed-by: Christoph Hellwig

    Miklos Szeredi
     
  • Systemd is hacking around to get it and it's trivial to add to statx, so...

    Cc: linux-api@vger.kernel.org
    Cc: linux-man@vger.kernel.org
    Signed-off-by: Miklos Szeredi
    Reviewed-by: Christoph Hellwig

    Miklos Szeredi
     
  • IS_NOATIME(inode) is defined as __IS_FLG(inode, SB_RDONLY|SB_NOATIME), so
    generic_fillattr() will clear STATX_ATIME from the result_mask if the super
    block is marked read only.

    This was probably not the intention, so fix to only clear STATX_ATIME if
    the fs doesn't support atime at all.

    Signed-off-by: Miklos Szeredi
    Acked-by: David Howells
    Reviewed-by: Christoph Hellwig

    Miklos Szeredi
     
  • Constants of the *_ALL type can be actively harmful due to the fact that
    developers will usually fail to consider the possible effects of future
    changes to the definition.

    Deprecate STATX_ALL in the uapi, while no damage has been done yet.

    We could keep something like this around in the kernel, but there's
    actually no point, since all filesystems should be explicitly checking
    flags that they support and not rely on the VFS masking unknown ones out: a
    flag could be known to the VFS, yet not known to the filesystem.

    Cc: David Howells
    Cc: linux-api@vger.kernel.org
    Cc: linux-man@vger.kernel.org
    Signed-off-by: Miklos Szeredi
    Reviewed-by: Christoph Hellwig

    Miklos Szeredi
     

04 May, 2020

1 commit

  • In order for users to determine if a file is currently operating in DAX
    state (effective DAX). Define a statx attribute value and set that
    attribute if the effective DAX flag is set.

    To go along with this we propose the following addition to the statx man
    page:

    STATX_ATTR_DAX

    The file is in the DAX (cpu direct access) state. DAX state
    attempts to minimize software cache effects for both I/O and
    memory mappings of this file. It requires a file system which
    has been configured to support DAX.

    DAX generally assumes all accesses are via cpu load / store
    instructions which can minimize overhead for small accesses, but
    may adversely affect cpu utilization for large transfers.

    File I/O is done directly to/from user-space buffers and memory
    mapped I/O may be performed with direct memory mappings that
    bypass kernel page cache.

    While the DAX property tends to result in data being transferred
    synchronously, it does not give the same guarantees of O_SYNC
    where data and the necessary metadata are transferred together.

    A DAX file may support being mapped with the MAP_SYNC flag,
    which enables a program to use CPU cache flush instructions to
    persist CPU store operations without an explicit fsync(2). See
    mmap(2) for more information.

    Reviewed-by: Dave Chinner
    Reviewed-by: Jan Kara
    Reviewed-by: Darrick J. Wong
    Signed-off-by: Ira Weiny
    Signed-off-by: Darrick J. Wong

    Ira Weiny
     

21 Jan, 2020

1 commit


01 Feb, 2019

1 commit


29 Aug, 2018

1 commit

  • We have four generations of stat() syscalls:
    - the oldstat syscalls that are only used on the older architectures
    - the newstat family that is used on all 64-bit architectures but
    lacked support for large files on 32-bit architectures.
    - the stat64 family that is used mostly on 32-bit architectures to
    replace newstat
    - statx() to replace all of the above, adding 64-bit timestamps among
    other things.

    We already compile stat64 only on those architectures that need it,
    but newstat is always built, including on those that don't reference
    it. This adds a new __ARCH_WANT_NEW_STAT symbol along the lines of
    __ARCH_WANT_OLD_STAT and __ARCH_WANT_STAT64 to control compilation of
    newstat. All architectures that need it use an explict define, the
    others now get a little bit smaller, and future architecture (including
    64-bit targets) won't ever see it.

    Acked-by: Geert Uytterhoeven
    Signed-off-by: Arnd Bergmann

    Arnd Bergmann
     

03 Apr, 2018

1 commit


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
     

18 Aug, 2017

1 commit

  • Provide helper __inode_get_bytes() which assumes i_lock is already
    acquired. Quota code will need this to be able to use i_lock to protect
    consistency of quota accounting information and inode usage.

    Signed-off-by: Jan Kara

    Jan Kara
     

10 Jun, 2017

1 commit


03 May, 2017

1 commit

  • Pull fs/compat.c cleanups from Al Viro:
    "More moving of compat syscalls from fs/compat.c to fs/*.c where the
    native counterparts live.

    And death to compat_sys_getdents64() - the only architecture that used
    to need it was ia64, and _that_ has lost biarch support quite a few
    years ago"

    * 'work.compat' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
    fs/compat.c: trim unused includes
    move compat_rw_copy_check_uvector() over to fs/read_write.c
    fhandle: move compat syscalls from compat.c
    open: move compat syscalls from compat.c
    stat: move compat syscalls from compat.c
    fcntl: move compat syscalls from compat.c
    readdir: move compat syscalls from compat.c
    statfs: move compat syscalls from compat.c
    utimes: move compat syscalls from compat.c
    move compat select-related syscalls to fs/select.c
    Remove compat_sys_getdents64()

    Linus Torvalds
     

28 Apr, 2017

1 commit

  • The change in commit 1e2f82d1e9d1 ("statx: Kill fd-with-NULL-path
    support in favour of AT_EMPTY_PATH") to error on a NULL pathname to
    statx() is inconsistent.

    It results in the error EINVAL for a NULL pathname. Other system calls
    with similar APIs (fchownat(), fstatat(), linkat()), return EFAULT.

    The solution is simply to remove the EINVAL check. As I already pointed
    out in [1], user_path_at*() and filename_lookup() will handle the NULL
    pathname as per the other APIs, to correctly produce the error EFAULT.

    [1] https://lkml.org/lkml/2017/4/26/561

    Signed-off-by: Michael Kerrisk
    Cc: David Howells
    Cc: Al Viro
    Cc: Eric Sandeen
    Signed-off-by: Linus Torvalds

    Michael Kerrisk (man-pages)
     

27 Apr, 2017

1 commit

  • With the new statx() syscall, the following both allow the attributes of
    the file attached to a file descriptor to be retrieved:

    statx(dfd, NULL, 0, ...);

    and:

    statx(dfd, "", AT_EMPTY_PATH, ...);

    Change the code to reject the first option, though this means copying
    the path and engaging pathwalk for the fstat() equivalent. dfd can be a
    non-directory provided path is "".

    [ The timing of this isn't wonderful, but applying this now before we
    have statx() in any released kernel, before anybody starts using the
    NULL special case. - Linus ]

    Fixes: a528d35e8bfc ("statx: Add a system call to make enhanced file info available")
    Reported-by: Michael Kerrisk
    Signed-off-by: David Howells
    cc: Eric Sandeen
    cc: fstests@vger.kernel.org
    cc: linux-api@vger.kernel.org
    cc: linux-man@vger.kernel.org
    Signed-off-by: Linus Torvalds

    David Howells
     

18 Apr, 2017

1 commit


03 Apr, 2017

5 commits

  • Include a mask in struct stat to indicate which bits of stx_attributes the
    filesystem actually supports.

    This would also be useful if we add another system call that allows you to
    do a 'bulk attribute set' and pass in a statx struct with the masks
    appropriately set to say what you want to set.

    Signed-off-by: David Howells
    Signed-off-by: Al Viro

    David Howells
     
  • Reserve the top bit of the mask for future expansion of the statx struct
    and give an error if statx() sees it set. All the other bits are ignored
    if we see them set but don't support the bit; we just clear the bit in the
    returned mask.

    Signed-off-by: David Howells
    Signed-off-by: Al Viro

    David Howells
     
  • I found that statx() was significantly slower than stat(). As a
    microbenchmark, I compared 10,000,000 invocations of fstat() on a tmpfs
    file to the same with statx() passed a NULL path:

    $ time ./stat_benchmark

    real 0m1.464s
    user 0m0.275s
    sys 0m1.187s

    $ time ./statx_benchmark

    real 0m5.530s
    user 0m0.281s
    sys 0m5.247s

    statx is expected to be a little slower than stat because struct statx
    is larger than struct stat, but not by *that* much. It turns out that
    most of the overhead was in copying struct statx to userspace, mostly in
    all the stac/clac instructions that got generated for each __put_user()
    call. (This was on x86_64, but some other architectures, e.g. arm64,
    have something similar now too.)

    stat() instead initializes its struct on the stack and copies it to
    userspace with a single call to copy_to_user(). This turns out to be
    much faster, and changing statx to do this makes it almost as fast as
    stat:

    $ time ./statx_benchmark

    real 0m1.624s
    user 0m0.270s
    sys 0m1.354s

    For zeroing the reserved fields, start by zeroing the full struct with
    memset. This makes it clear that every byte copied to userspace is
    initialized, even implicit padding bytes (though there are none
    currently). In the scenarios I tested, it also performed the same as a
    designated initializer. Manually initializing each field was still
    slightly faster, but would have been more error-prone and less
    verifiable.

    Also rename statx_set_result() to cp_statx() for consistency with
    cp_old_stat() et al., and make it noinline so that struct statx doesn't
    add to the stack usage during the main portion of the syscall execution.

    Signed-off-by: Eric Biggers
    Signed-off-by: David Howells
    Signed-off-by: Al Viro

    Eric Biggers
     
  • request_mask and query_flags are function arguments, not passed in
    struct kstat. So remove the part of the comment which claims otherwise.
    This was apparently left over from an earlier version of the statx
    patch.

    Signed-off-by: Eric Biggers
    Signed-off-by: David Howells
    Reviewed-by: Christoph Hellwig
    Signed-off-by: Al Viro

    Eric Biggers
     
  • The statx() system call currently accepts unknown flags when called with
    a NULL path to operate on a file descriptor. Left unchanged, this could
    make it hard to introduce new query flags in the future, since
    applications may not be able to tell whether a given flag is supported.

    Fix this by failing the system call with EINVAL if any flags other than
    KSTAT_QUERY_FLAGS are specified in combination with a NULL path.

    Arguably, we could still permit known lookup-related flags such as
    AT_SYMLINK_NOFOLLOW. However, that would be inconsistent with how
    sys_utimensat() behaves when passed a NULL path, which seems to be the
    closest precedent. And given that the NULL path case is (I believe)
    mainly intended to be used to implement a wrapper function like fstatx()
    that doesn't have a path argument, I think rejecting lookup-related
    flags too is probably the best choice.

    Signed-off-by: Eric Biggers
    Signed-off-by: David Howells
    Signed-off-by: Al Viro

    Eric Biggers
     

04 Mar, 2017

1 commit

  • Pull vfs 'statx()' update from Al Viro.

    This adds the new extended stat() interface that internally subsumes our
    previous stat interfaces, and allows user mode to specify in more detail
    what kind of information it wants.

    It also allows for some explicit synchronization information to be
    passed to the filesystem, which can be relevant for network filesystems:
    is the cached value ok, or do you need open/close consistency, or what?

    From David Howells.

    Andreas Dilger points out that the first version of the extended statx
    interface was posted June 29, 2010:

    https://www.spinics.net/lists/linux-fsdevel/msg33831.html

    * 'rebased-statx' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
    statx: Add a system call to make enhanced file info available

    Linus Torvalds
     

03 Mar, 2017

1 commit

  • Add a system call to make extended file information available, including
    file creation and some attribute flags where available through the
    underlying filesystem.

    The getattr inode operation is altered to take two additional arguments: a
    u32 request_mask and an unsigned int flags that indicate the
    synchronisation mode. This change is propagated to the vfs_getattr*()
    function.

    Functions like vfs_stat() are now inline wrappers around new functions
    vfs_statx() and vfs_statx_fd() to reduce stack usage.

    ========
    OVERVIEW
    ========

    The idea was initially proposed as a set of xattrs that could be retrieved
    with getxattr(), but the general preference proved to be for a new syscall
    with an extended stat structure.

    A number of requests were gathered for features to be included. The
    following have been included:

    (1) Make the fields a consistent size on all arches and make them large.

    (2) Spare space, request flags and information flags are provided for
    future expansion.

    (3) Better support for the y2038 problem [Arnd Bergmann] (tv_sec is an
    __s64).

    (4) Creation time: The SMB protocol carries the creation time, which could
    be exported by Samba, which will in turn help CIFS make use of
    FS-Cache as that can be used for coherency data (stx_btime).

    This is also specified in NFSv4 as a recommended attribute and could
    be exported by NFSD [Steve French].

    (5) Lightweight stat: Ask for just those details of interest, and allow a
    netfs (such as NFS) to approximate anything not of interest, possibly
    without going to the server [Trond Myklebust, Ulrich Drepper, Andreas
    Dilger] (AT_STATX_DONT_SYNC).

    (6) Heavyweight stat: Force a netfs to go to the server, even if it thinks
    its cached attributes are up to date [Trond Myklebust]
    (AT_STATX_FORCE_SYNC).

    And the following have been left out for future extension:

    (7) Data version number: Could be used by userspace NFS servers [Aneesh
    Kumar].

    Can also be used to modify fill_post_wcc() in NFSD which retrieves
    i_version directly, but has just called vfs_getattr(). It could get
    it from the kstat struct if it used vfs_xgetattr() instead.

    (There's disagreement on the exact semantics of a single field, since
    not all filesystems do this the same way).

    (8) BSD stat compatibility: Including more fields from the BSD stat such
    as creation time (st_btime) and inode generation number (st_gen)
    [Jeremy Allison, Bernd Schubert].

    (9) Inode generation number: Useful for FUSE and userspace NFS servers
    [Bernd Schubert].

    (This was asked for but later deemed unnecessary with the
    open-by-handle capability available and caused disagreement as to
    whether it's a security hole or not).

    (10) Extra coherency data may be useful in making backups [Andreas Dilger].

    (No particular data were offered, but things like last backup
    timestamp, the data version number and the DOS archive bit would come
    into this category).

    (11) Allow the filesystem to indicate what it can/cannot provide: A
    filesystem can now say it doesn't support a standard stat feature if
    that isn't available, so if, for instance, inode numbers or UIDs don't
    exist or are fabricated locally...

    (This requires a separate system call - I have an fsinfo() call idea
    for this).

    (12) Store a 16-byte volume ID in the superblock that can be returned in
    struct xstat [Steve French].

    (Deferred to fsinfo).

    (13) Include granularity fields in the time data to indicate the
    granularity of each of the times (NFSv4 time_delta) [Steve French].

    (Deferred to fsinfo).

    (14) FS_IOC_GETFLAGS value. These could be translated to BSD's st_flags.
    Note that the Linux IOC flags are a mess and filesystems such as Ext4
    define flags that aren't in linux/fs.h, so translation in the kernel
    may be a necessity (or, possibly, we provide the filesystem type too).

    (Some attributes are made available in stx_attributes, but the general
    feeling was that the IOC flags were to ext[234]-specific and shouldn't
    be exposed through statx this way).

    (15) Mask of features available on file (eg: ACLs, seclabel) [Brad Boyer,
    Michael Kerrisk].

    (Deferred, probably to fsinfo. Finding out if there's an ACL or
    seclabal might require extra filesystem operations).

    (16) Femtosecond-resolution timestamps [Dave Chinner].

    (A __reserved field has been left in the statx_timestamp struct for
    this - if there proves to be a need).

    (17) A set multiple attributes syscall to go with this.

    ===============
    NEW SYSTEM CALL
    ===============

    The new system call is:

    int ret = statx(int dfd,
    const char *filename,
    unsigned int flags,
    unsigned int mask,
    struct statx *buffer);

    The dfd, filename and flags parameters indicate the file to query, in a
    similar way to fstatat(). There is no equivalent of lstat() as that can be
    emulated with statx() by passing AT_SYMLINK_NOFOLLOW in flags. There is
    also no equivalent of fstat() as that can be emulated by passing a NULL
    filename to statx() with the fd of interest in dfd.

    Whether or not statx() synchronises the attributes with the backing store
    can be controlled by OR'ing a value into the flags argument (this typically
    only affects network filesystems):

    (1) AT_STATX_SYNC_AS_STAT tells statx() to behave as stat() does in this
    respect.

    (2) AT_STATX_FORCE_SYNC will require a network filesystem to synchronise
    its attributes with the server - which might require data writeback to
    occur to get the timestamps correct.

    (3) AT_STATX_DONT_SYNC will suppress synchronisation with the server in a
    network filesystem. The resulting values should be considered
    approximate.

    mask is a bitmask indicating the fields in struct statx that are of
    interest to the caller. The user should set this to STATX_BASIC_STATS to
    get the basic set returned by stat(). It should be noted that asking for
    more information may entail extra I/O operations.

    buffer points to the destination for the data. This must be 256 bytes in
    size.

    ======================
    MAIN ATTRIBUTES RECORD
    ======================

    The following structures are defined in which to return the main attribute
    set:

    struct statx_timestamp {
    __s64 tv_sec;
    __s32 tv_nsec;
    __s32 __reserved;
    };

    struct statx {
    __u32 stx_mask;
    __u32 stx_blksize;
    __u64 stx_attributes;
    __u32 stx_nlink;
    __u32 stx_uid;
    __u32 stx_gid;
    __u16 stx_mode;
    __u16 __spare0[1];
    __u64 stx_ino;
    __u64 stx_size;
    __u64 stx_blocks;
    __u64 __spare1[1];
    struct statx_timestamp stx_atime;
    struct statx_timestamp stx_btime;
    struct statx_timestamp stx_ctime;
    struct statx_timestamp stx_mtime;
    __u32 stx_rdev_major;
    __u32 stx_rdev_minor;
    __u32 stx_dev_major;
    __u32 stx_dev_minor;
    __u64 __spare2[14];
    };

    The defined bits in request_mask and stx_mask are:

    STATX_TYPE Want/got stx_mode & S_IFMT
    STATX_MODE Want/got stx_mode & ~S_IFMT
    STATX_NLINK Want/got stx_nlink
    STATX_UID Want/got stx_uid
    STATX_GID Want/got stx_gid
    STATX_ATIME Want/got stx_atime{,_ns}
    STATX_MTIME Want/got stx_mtime{,_ns}
    STATX_CTIME Want/got stx_ctime{,_ns}
    STATX_INO Want/got stx_ino
    STATX_SIZE Want/got stx_size
    STATX_BLOCKS Want/got stx_blocks
    STATX_BASIC_STATS [The stuff in the normal stat struct]
    STATX_BTIME Want/got stx_btime{,_ns}
    STATX_ALL [All currently available stuff]

    stx_btime is the file creation time, stx_mask is a bitmask indicating the
    data provided and __spares*[] are where as-yet undefined fields can be
    placed.

    Time fields are structures with separate seconds and nanoseconds fields
    plus a reserved field in case we want to add even finer resolution. Note
    that times will be negative if before 1970; in such a case, the nanosecond
    fields will also be negative if not zero.

    The bits defined in the stx_attributes field convey information about a
    file, how it is accessed, where it is and what it does. The following
    attributes map to FS_*_FL flags and are the same numerical value:

    STATX_ATTR_COMPRESSED File is compressed by the fs
    STATX_ATTR_IMMUTABLE File is marked immutable
    STATX_ATTR_APPEND File is append-only
    STATX_ATTR_NODUMP File is not to be dumped
    STATX_ATTR_ENCRYPTED File requires key to decrypt in fs

    Within the kernel, the supported flags are listed by:

    KSTAT_ATTR_FS_IOC_FLAGS

    [Are any other IOC flags of sufficient general interest to be exposed
    through this interface?]

    New flags include:

    STATX_ATTR_AUTOMOUNT Object is an automount trigger

    These are for the use of GUI tools that might want to mark files specially,
    depending on what they are.

    Fields in struct statx come in a number of classes:

    (0) stx_dev_*, stx_blksize.

    These are local system information and are always available.

    (1) stx_mode, stx_nlinks, stx_uid, stx_gid, stx_[amc]time, stx_ino,
    stx_size, stx_blocks.

    These will be returned whether the caller asks for them or not. The
    corresponding bits in stx_mask will be set to indicate whether they
    actually have valid values.

    If the caller didn't ask for them, then they may be approximated. For
    example, NFS won't waste any time updating them from the server,
    unless as a byproduct of updating something requested.

    If the values don't actually exist for the underlying object (such as
    UID or GID on a DOS file), then the bit won't be set in the stx_mask,
    even if the caller asked for the value. In such a case, the returned
    value will be a fabrication.

    Note that there are instances where the type might not be valid, for
    instance Windows reparse points.

    (2) stx_rdev_*.

    This will be set only if stx_mode indicates we're looking at a
    blockdev or a chardev, otherwise will be 0.

    (3) stx_btime.

    Similar to (1), except this will be set to 0 if it doesn't exist.

    =======
    TESTING
    =======

    The following test program can be used to test the statx system call:

    samples/statx/test-statx.c

    Just compile and run, passing it paths to the files you want to examine.
    The file is built automatically if CONFIG_SAMPLES is enabled.

    Here's some example output. Firstly, an NFS directory that crosses to
    another FSID. Note that the AUTOMOUNT attribute is set because transiting
    this directory will cause d_automount to be invoked by the VFS.

    [root@andromeda ~]# /tmp/test-statx -A /warthog/data
    statx(/warthog/data) = 0
    results=7ff
    Size: 4096 Blocks: 8 IO Block: 1048576 directory
    Device: 00:26 Inode: 1703937 Links: 125
    Access: (3777/drwxrwxrwx) Uid: 0 Gid: 4041
    Access: 2016-11-24 09:02:12.219699527+0000
    Modify: 2016-11-17 10:44:36.225653653+0000
    Change: 2016-11-17 10:44:36.225653653+0000
    Attributes: 0000000000001000 (-------- -------- -------- -------- -------- -------- ---m---- --------)

    Secondly, the result of automounting on that directory.

    [root@andromeda ~]# /tmp/test-statx /warthog/data
    statx(/warthog/data) = 0
    results=7ff
    Size: 4096 Blocks: 8 IO Block: 1048576 directory
    Device: 00:27 Inode: 2 Links: 125
    Access: (3777/drwxrwxrwx) Uid: 0 Gid: 4041
    Access: 2016-11-24 09:02:12.219699527+0000
    Modify: 2016-11-17 10:44:36.225653653+0000
    Change: 2016-11-17 10:44:36.225653653+0000

    Signed-off-by: David Howells
    Signed-off-by: Al Viro

    David Howells
     

02 Mar, 2017

1 commit


28 Feb, 2017

1 commit

  • Replace all 1 << inode->i_blkbits and (1 << inode->i_blkbits) in fs
    branch.

    This patch also fixes multiple checkpatch warnings: WARNING: Prefer
    'unsigned int' to bare use of 'unsigned'

    Thanks to Andrew Morton for suggesting more appropriate function instead
    of macro.

    [geliangtang@gmail.com: truncate: use i_blocksize()]
    Link: http://lkml.kernel.org/r/9c8b2cd83c8f5653805d43debde9fa8817e02fc4.1484895804.git.geliangtang@gmail.com
    Link: http://lkml.kernel.org/r/1481319905-10126-1-git-send-email-fabf@skynet.be
    Signed-off-by: Fabian Frederick
    Signed-off-by: Geliang Tang
    Cc: Alexander Viro
    Cc: Ross Zwisler
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Fabian Frederick
     

25 Dec, 2016

1 commit


09 Dec, 2016

1 commit


17 Jan, 2016

1 commit

  • New_valid_dev() always returns true, so that's unnecessary to perform
    new_valid_dev() checks in some filesystems. Most checks of
    new_valid_dev() have been removed so let's drop this last one and then
    we can remove new_valid_dev() from the source code.

    No functional change.

    Signed-off-by: Yaowei Bai
    Cc: Al Viro
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Yaowei Bai
     

10 Nov, 2015

1 commit


16 Apr, 2015

1 commit


12 Apr, 2015

1 commit


09 Nov, 2013

1 commit