09 Jun, 2022

1 commit

  • [ Upstream commit 183c3237c928109d2008c0456dff508baf692b20 ]

    fat*_ent_bread() can be the cause of too many report on I/O error path.
    So use fat_msg_ratelimit() instead.

    Link: https://lkml.kernel.org/r/87bkxogfeq.fsf@mail.parknet.co.jp
    Signed-off-by: OGAWA Hirofumi
    Reported-by: qianfan
    Tested-by: qianfan
    Signed-off-by: Andrew Morton
    Signed-off-by: Sasha Levin

    OGAWA Hirofumi
     

03 Sep, 2021

1 commit

  • …/kernel/git/shuah/linux-kselftest

    Pull KUnit updates from Shuah Khan:
    "This KUnit update for Linux 5.15-rc1 adds new features and tests:

    Tool:

    - support for '--kernel_args' to allow setting module params

    - support for '--raw_output' option to show just the kunit output
    during make

    Tests:

    - new KUnit tests for checksums and timestamps

    - Print test statistics on failure

    - Integrates UBSAN into the KUnit testing framework. It fails KUnit
    tests whenever it reports undefined behavior"

    * tag 'linux-kselftest-kunit-5.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest:
    kunit: Print test statistics on failure
    kunit: tool: make --raw_output support only showing kunit output
    kunit: tool: add --kernel_args to allow setting module params
    kunit: ubsan integration
    fat: Add KUnit tests for checksums and timestamps

    Linus Torvalds
     

14 Aug, 2021

1 commit

  • Add some basic sanity-check tests for the fat_checksum() function and
    the fat_time_unix2fat() and fat_time_fat2unix() functions. These unit
    tests verify these functions return correct output for a number of test
    inputs.

    These tests were inspired by -- and serve a similar purpose to -- the
    timestamp parsing KUnit tests in ext4[1].

    Note that, unlike fat_time_unix2fat, fat_time_fat2unix wasn't previously
    exported, so this patch exports it as well. This is required for the
    case where we're building the fat and fat_test as modules.

    Fixed minor checkpatch coding style errors and typos in commit log:
    Shuah Khan

    [1]:
    https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/fs/ext4/inode-test.c

    Signed-off-by: David Gow
    Acked-by: OGAWA Hirofumi
    Reviewed-by: Brendan Higgins
    Tested-by: Daniel Latypov
    Signed-off-by: Shuah Khan

    David Gow
     

10 Aug, 2021

1 commit


30 Jun, 2021

1 commit

  • Remove the CONFIG_BLOCK default to __set_page_dirty_buffers and just wire
    that method up for the missing instances.

    [hch@lst.de: ecryptfs: add a ->set_page_dirty cludge]
    Link: https://lkml.kernel.org/r/20210624125250.536369-1-hch@lst.de

    Link: https://lkml.kernel.org/r/20210614061512.3966143-4-hch@lst.de
    Signed-off-by: Christoph Hellwig
    Reviewed-by: Greg Kroah-Hartman
    Reviewed-by: Jan Kara
    Cc: Al Viro
    Cc: Matthew Wilcox (Oracle)
    Cc: Tyler Hicks
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Christoph Hellwig
     

07 May, 2021

1 commit


24 Feb, 2021

1 commit

  • Pull idmapped mounts from Christian Brauner:
    "This introduces idmapped mounts which has been in the making for some
    time. Simply put, different mounts can expose the same file or
    directory with different ownership. This initial implementation comes
    with ports for fat, ext4 and with Christoph's port for xfs with more
    filesystems being actively worked on by independent people and
    maintainers.

    Idmapping mounts handle a wide range of long standing use-cases. Here
    are just a few:

    - Idmapped mounts make it possible to easily share files between
    multiple users or multiple machines especially in complex
    scenarios. For example, idmapped mounts will be used in the
    implementation of portable home directories in
    systemd-homed.service(8) where they allow users to move their home
    directory to an external storage device and use it on multiple
    computers where they are assigned different uids and gids. This
    effectively makes it possible to assign random uids and gids at
    login time.

    - It is possible to share files from the host with unprivileged
    containers without having to change ownership permanently through
    chown(2).

    - It is possible to idmap a container's rootfs and without having to
    mangle every file. For example, Chromebooks use it to share the
    user's Download folder with their unprivileged containers in their
    Linux subsystem.

    - It is possible to share files between containers with
    non-overlapping idmappings.

    - Filesystem that lack a proper concept of ownership such as fat can
    use idmapped mounts to implement discretionary access (DAC)
    permission checking.

    - They allow users to efficiently changing ownership on a per-mount
    basis without having to (recursively) chown(2) all files. In
    contrast to chown (2) changing ownership of large sets of files is
    instantenous with idmapped mounts. This is especially useful when
    ownership of a whole root filesystem of a virtual machine or
    container is changed. With idmapped mounts a single syscall
    mount_setattr syscall will be sufficient to change the ownership of
    all files.

    - Idmapped mounts always take the current ownership into account as
    idmappings specify what a given uid or gid is supposed to be mapped
    to. This contrasts with the chown(2) syscall which cannot by itself
    take the current ownership of the files it changes into account. It
    simply changes the ownership to the specified uid and gid. This is
    especially problematic when recursively chown(2)ing a large set of
    files which is commong with the aforementioned portable home
    directory and container and vm scenario.

    - Idmapped mounts allow to change ownership locally, restricting it
    to specific mounts, and temporarily as the ownership changes only
    apply as long as the mount exists.

    Several userspace projects have either already put up patches and
    pull-requests for this feature or will do so should you decide to pull
    this:

    - systemd: In a wide variety of scenarios but especially right away
    in their implementation of portable home directories.

    https://systemd.io/HOME_DIRECTORY/

    - container runtimes: containerd, runC, LXD:To share data between
    host and unprivileged containers, unprivileged and privileged
    containers, etc. The pull request for idmapped mounts support in
    containerd, the default Kubernetes runtime is already up for quite
    a while now: https://github.com/containerd/containerd/pull/4734

    - The virtio-fs developers and several users have expressed interest
    in using this feature with virtual machines once virtio-fs is
    ported.

    - ChromeOS: Sharing host-directories with unprivileged containers.

    I've tightly synced with all those projects and all of those listed
    here have also expressed their need/desire for this feature on the
    mailing list. For more info on how people use this there's a bunch of
    talks about this too. Here's just two recent ones:

    https://www.cncf.io/wp-content/uploads/2020/12/Rootless-Containers-in-Gitpod.pdf
    https://fosdem.org/2021/schedule/event/containers_idmap/

    This comes with an extensive xfstests suite covering both ext4 and
    xfs:

    https://git.kernel.org/brauner/xfstests-dev/h/idmapped_mounts

    It covers truncation, creation, opening, xattrs, vfscaps, setid
    execution, setgid inheritance and more both with idmapped and
    non-idmapped mounts. It already helped to discover an unrelated xfs
    setgid inheritance bug which has since been fixed in mainline. It will
    be sent for inclusion with the xfstests project should you decide to
    merge this.

    In order to support per-mount idmappings vfsmounts are marked with
    user namespaces. The idmapping of the user namespace will be used to
    map the ids of vfs objects when they are accessed through that mount.
    By default all vfsmounts are marked with the initial user namespace.
    The initial user namespace is used to indicate that a mount is not
    idmapped. All operations behave as before and this is verified in the
    testsuite.

    Based on prior discussions we want to attach the whole user namespace
    and not just a dedicated idmapping struct. This allows us to reuse all
    the helpers that already exist for dealing with idmappings instead of
    introducing a whole new range of helpers. In addition, if we decide in
    the future that we are confident enough to enable unprivileged users
    to setup idmapped mounts the permission checking can take into account
    whether the caller is privileged in the user namespace the mount is
    currently marked with.

    The user namespace the mount will be marked with can be specified by
    passing a file descriptor refering to the user namespace as an
    argument to the new mount_setattr() syscall together with the new
    MOUNT_ATTR_IDMAP flag. The system call follows the openat2() pattern
    of extensibility.

    The following conditions must be met in order to create an idmapped
    mount:

    - The caller must currently have the CAP_SYS_ADMIN capability in the
    user namespace the underlying filesystem has been mounted in.

    - The underlying filesystem must support idmapped mounts.

    - The mount must not already be idmapped. This also implies that the
    idmapping of a mount cannot be altered once it has been idmapped.

    - The mount must be a detached/anonymous mount, i.e. it must have
    been created by calling open_tree() with the OPEN_TREE_CLONE flag
    and it must not already have been visible in the filesystem.

    The last two points guarantee easier semantics for userspace and the
    kernel and make the implementation significantly simpler.

    By default vfsmounts are marked with the initial user namespace and no
    behavioral or performance changes are observed.

    The manpage with a detailed description can be found here:

    https://git.kernel.org/brauner/man-pages/c/1d7b902e2875a1ff342e036a9f866a995640aea8

    In order to support idmapped mounts, filesystems need to be changed
    and mark themselves with the FS_ALLOW_IDMAP flag in fs_flags. The
    patches to convert individual filesystem are not very large or
    complicated overall as can be seen from the included fat, ext4, and
    xfs ports. Patches for other filesystems are actively worked on and
    will be sent out separately. The xfstestsuite can be used to verify
    that port has been done correctly.

    The mount_setattr() syscall is motivated independent of the idmapped
    mounts patches and it's been around since July 2019. One of the most
    valuable features of the new mount api is the ability to perform
    mounts based on file descriptors only.

    Together with the lookup restrictions available in the openat2()
    RESOLVE_* flag namespace which we added in v5.6 this is the first time
    we are close to hardened and race-free (e.g. symlinks) mounting and
    path resolution.

    While userspace has started porting to the new mount api to mount
    proper filesystems and create new bind-mounts it is currently not
    possible to change mount options of an already existing bind mount in
    the new mount api since the mount_setattr() syscall is missing.

    With the addition of the mount_setattr() syscall we remove this last
    restriction and userspace can now fully port to the new mount api,
    covering every use-case the old mount api could. We also add the
    crucial ability to recursively change mount options for a whole mount
    tree, both removing and adding mount options at the same time. This
    syscall has been requested multiple times by various people and
    projects.

    There is a simple tool available at

    https://github.com/brauner/mount-idmapped

    that allows to create idmapped mounts so people can play with this
    patch series. I'll add support for the regular mount binary should you
    decide to pull this in the following weeks:

    Here's an example to a simple idmapped mount of another user's home
    directory:

    u1001@f2-vm:/$ sudo ./mount --idmap both:1000:1001:1 /home/ubuntu/ /mnt

    u1001@f2-vm:/$ ls -al /home/ubuntu/
    total 28
    drwxr-xr-x 2 ubuntu ubuntu 4096 Oct 28 22:07 .
    drwxr-xr-x 4 root root 4096 Oct 28 04:00 ..
    -rw------- 1 ubuntu ubuntu 3154 Oct 28 22:12 .bash_history
    -rw-r--r-- 1 ubuntu ubuntu 220 Feb 25 2020 .bash_logout
    -rw-r--r-- 1 ubuntu ubuntu 3771 Feb 25 2020 .bashrc
    -rw-r--r-- 1 ubuntu ubuntu 807 Feb 25 2020 .profile
    -rw-r--r-- 1 ubuntu ubuntu 0 Oct 16 16:11 .sudo_as_admin_successful
    -rw------- 1 ubuntu ubuntu 1144 Oct 28 00:43 .viminfo

    u1001@f2-vm:/$ ls -al /mnt/
    total 28
    drwxr-xr-x 2 u1001 u1001 4096 Oct 28 22:07 .
    drwxr-xr-x 29 root root 4096 Oct 28 22:01 ..
    -rw------- 1 u1001 u1001 3154 Oct 28 22:12 .bash_history
    -rw-r--r-- 1 u1001 u1001 220 Feb 25 2020 .bash_logout
    -rw-r--r-- 1 u1001 u1001 3771 Feb 25 2020 .bashrc
    -rw-r--r-- 1 u1001 u1001 807 Feb 25 2020 .profile
    -rw-r--r-- 1 u1001 u1001 0 Oct 16 16:11 .sudo_as_admin_successful
    -rw------- 1 u1001 u1001 1144 Oct 28 00:43 .viminfo

    u1001@f2-vm:/$ touch /mnt/my-file

    u1001@f2-vm:/$ setfacl -m u:1001:rwx /mnt/my-file

    u1001@f2-vm:/$ sudo setcap -n 1001 cap_net_raw+ep /mnt/my-file

    u1001@f2-vm:/$ ls -al /mnt/my-file
    -rw-rwxr--+ 1 u1001 u1001 0 Oct 28 22:14 /mnt/my-file

    u1001@f2-vm:/$ ls -al /home/ubuntu/my-file
    -rw-rwxr--+ 1 ubuntu ubuntu 0 Oct 28 22:14 /home/ubuntu/my-file

    u1001@f2-vm:/$ getfacl /mnt/my-file
    getfacl: Removing leading '/' from absolute path names
    # file: mnt/my-file
    # owner: u1001
    # group: u1001
    user::rw-
    user:u1001:rwx
    group::rw-
    mask::rwx
    other::r--

    u1001@f2-vm:/$ getfacl /home/ubuntu/my-file
    getfacl: Removing leading '/' from absolute path names
    # file: home/ubuntu/my-file
    # owner: ubuntu
    # group: ubuntu
    user::rw-
    user:ubuntu:rwx
    group::rw-
    mask::rwx
    other::r--"

    * tag 'idmapped-mounts-v5.12' of git://git.kernel.org/pub/scm/linux/kernel/git/brauner/linux: (41 commits)
    xfs: remove the possibly unused mp variable in xfs_file_compat_ioctl
    xfs: support idmapped mounts
    ext4: support idmapped mounts
    fat: handle idmapped mounts
    tests: add mount_setattr() selftests
    fs: introduce MOUNT_ATTR_IDMAP
    fs: add mount_setattr()
    fs: add attr_flags_to_mnt_flags helper
    fs: split out functions to hold writers
    namespace: only take read lock in do_reconfigure_mnt()
    mount: make {lock,unlock}_mount_hash() static
    namespace: take lock_mount_hash() directly when changing flags
    nfs: do not export idmapped mounts
    overlayfs: do not mount on top of idmapped mounts
    ecryptfs: do not mount on top of idmapped mounts
    ima: handle idmapped mounts
    apparmor: handle idmapped mounts
    fs: make helpers idmap mount aware
    exec: handle idmapped mounts
    would_dump: handle idmapped mounts
    ...

    Linus Torvalds
     

23 Feb, 2021

1 commit

  • Pull lazytime updates from Jan Kara:
    "Cleanups of the lazytime handling in the writeback code making rules
    for calling ->dirty_inode() filesystem handlers saner"

    * tag 'lazytime_for_v5.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs:
    ext4: simplify i_state checks in __ext4_update_other_inode_time()
    gfs2: don't worry about I_DIRTY_TIME in gfs2_fsync()
    fs: improve comments for writeback_single_inode()
    fs: drop redundant check from __writeback_single_inode()
    fs: clean up __mark_inode_dirty() a bit
    fs: pass only I_DIRTY_INODE flags to ->dirty_inode
    fs: don't call ->dirty_inode for lazytime timestamp updates
    fat: only specify I_DIRTY_TIME when needed in fat_update_time()
    fs: only specify I_DIRTY_TIME when needed in generic_update_time()
    fs: correctly document the inode dirty flags

    Linus Torvalds
     

28 Jan, 2021

1 commit


24 Jan, 2021

4 commits

  • Let fat handle idmapped mounts. This allows to have the same fat mount
    appear in multiple locations with different id mappings. This allows to
    expose a vfat formatted USB stick to multiple user with different ids on
    the host or in user namespaces allowing for dac permissions:

    mount -o uid=1000,gid=1000 /dev/sdb /mnt

    u1001@f2-vm:/lower1$ ls -ln /mnt/
    total 4
    -rwxr-xr-x 1 1000 1000 4 Oct 28 03:44 aaa
    -rwxr-xr-x 1 1000 1000 0 Oct 28 01:09 bbb
    -rwxr-xr-x 1 1000 1000 0 Oct 28 01:10 ccc
    -rwxr-xr-x 1 1000 1000 0 Oct 28 03:46 ddd
    -rwxr-xr-x 1 1000 1000 0 Oct 28 04:01 eee

    mount-idmapped --map-mount b:1000:1001:1

    u1001@f2-vm:/lower1$ ls -ln /lower1/
    total 4
    -rwxr-xr-x 1 1001 1001 4 Oct 28 03:44 aaa
    -rwxr-xr-x 1 1001 1001 0 Oct 28 01:09 bbb
    -rwxr-xr-x 1 1001 1001 0 Oct 28 01:10 ccc
    -rwxr-xr-x 1 1001 1001 0 Oct 28 03:46 ddd
    -rwxr-xr-x 1 1001 1001 0 Oct 28 04:01 eee

    u1001@f2-vm:/lower1$ touch /lower1/fff

    u1001@f2-vm:/lower1$ ls -ln /lower1/fff
    -rwxr-xr-x 1 1001 1001 0 Oct 28 04:03 /lower1/fff

    u1001@f2-vm:/lower1$ ls -ln /mnt/fff
    -rwxr-xr-x 1 1000 1000 0 Oct 28 04:03 /mnt/fff

    Link: https://lore.kernel.org/r/20210121131959.646623-38-christian.brauner@ubuntu.com
    Cc: Christoph Hellwig
    Cc: David Howells
    Cc: Al Viro
    Cc: linux-fsdevel@vger.kernel.org
    Signed-off-by: Christian Brauner

    Christian Brauner
     
  • Extend some inode methods with an additional user namespace argument. A
    filesystem that is aware of idmapped mounts will receive the user
    namespace the mount has been marked with. This can be used for
    additional permission checking and also to enable filesystems to
    translate between uids and gids if they need to. We have implemented all
    relevant helpers in earlier patches.

    As requested we simply extend the exisiting inode method instead of
    introducing new ones. This is a little more code churn but it's mostly
    mechanical and doesnt't leave us with additional inode methods.

    Link: https://lore.kernel.org/r/20210121131959.646623-25-christian.brauner@ubuntu.com
    Cc: Christoph Hellwig
    Cc: David Howells
    Cc: Al Viro
    Cc: linux-fsdevel@vger.kernel.org
    Reviewed-by: Christoph Hellwig
    Signed-off-by: Christian Brauner

    Christian Brauner
     
  • The generic_fillattr() helper fills in the basic attributes associated
    with an inode. Enable it to handle idmapped mounts. If the inode is
    accessed through an idmapped mount map it into the mount's user
    namespace before we store the uid and gid. If the initial user namespace
    is passed nothing changes so non-idmapped mounts will see identical
    behavior as before.

    Link: https://lore.kernel.org/r/20210121131959.646623-12-christian.brauner@ubuntu.com
    Cc: Christoph Hellwig
    Cc: David Howells
    Cc: Al Viro
    Cc: linux-fsdevel@vger.kernel.org
    Reviewed-by: Christoph Hellwig
    Reviewed-by: James Morris
    Signed-off-by: Christian Brauner

    Christian Brauner
     
  • When file attributes are changed most filesystems rely on the
    setattr_prepare(), setattr_copy(), and notify_change() helpers for
    initialization and permission checking. Let them handle idmapped mounts.
    If the inode is accessed through an idmapped mount map it into the
    mount's user namespace. Afterwards the checks are identical to
    non-idmapped mounts. If the initial user namespace is passed nothing
    changes so non-idmapped mounts will see identical behavior as before.

    Helpers that perform checks on the ia_uid and ia_gid fields in struct
    iattr assume that ia_uid and ia_gid are intended values and have already
    been mapped correctly at the userspace-kernelspace boundary as we
    already do today. If the initial user namespace is passed nothing
    changes so non-idmapped mounts will see identical behavior as before.

    Link: https://lore.kernel.org/r/20210121131959.646623-8-christian.brauner@ubuntu.com
    Cc: Christoph Hellwig
    Cc: David Howells
    Cc: Al Viro
    Cc: linux-fsdevel@vger.kernel.org
    Reviewed-by: Christoph Hellwig
    Signed-off-by: Christian Brauner

    Christian Brauner
     

14 Jan, 2021

1 commit

  • As was done for generic_update_time(), only pass I_DIRTY_TIME to
    __mark_inode_dirty() when the inode's timestamps were actually updated
    and lazytime is enabled. This avoids a weird edge case where
    I_DIRTY_TIME could be set in i_state when lazytime isn't enabled.

    Link: https://lore.kernel.org/r/20210112190253.64307-5-ebiggers@kernel.org
    Reviewed-by: Christoph Hellwig
    Reviewed-by: Jan Kara
    Signed-off-by: Eric Biggers
    Signed-off-by: Jan Kara

    Eric Biggers
     

19 Sep, 2020

1 commit


13 Aug, 2020

3 commits

  • If data clusters == 0, fat_ra_init() calls the ->ent_blocknr() for the
    cluster beyond ->max_clusters.

    This checks the limit before initialization to suppress the warning.

    Reported-by: syzbot+756199124937b31a9b7e@syzkaller.appspotmail.com
    Signed-off-by: OGAWA Hirofumi
    Signed-off-by: Andrew Morton
    Link: http://lkml.kernel.org/r/87mu462sv4.fsf@mail.parknet.co.jp
    Signed-off-by: Linus Torvalds

    OGAWA Hirofumi
     
  • Rationale:
    Reduces attack surface on kernel devs opening the links for MITM
    as HTTPS traffic is much harder to manipulate.

    Deterministic algorithm:
    For each file:
    If not .svg:
    For each line:
    If doesn't contain `xmlns`:
    For each link, `http://[^# ]*(?:\w|/)`:
    If neither `gnu\.org/license`, nor `mozilla\.org/MPL`:
    If both the HTTP and HTTPS versions
    return 200 OK and serve the same content:
    Replace HTTP with HTTPS.

    Signed-off-by: Alexander A. Klimov
    Signed-off-by: Andrew Morton
    Acked-by: OGAWA Hirofumi
    Link: http://lkml.kernel.org/r/20200708200409.22293-1-grandmaster@al2klimov.de
    Signed-off-by: Linus Torvalds

    Alexander A. Klimov
     
  • There is no need to hold write_lock in fat_ioctl_get_attributes.
    write_lock may make an impact on concurrency of fat_ioctl_get_attributes.

    Signed-off-by: Yubo Feng
    Signed-off-by: Andrew Morton
    Acked-by: OGAWA Hirofumi
    Link: http://lkml.kernel.org/r/1593308053-12702-1-git-send-email-fengyubo3@huawei.com
    Signed-off-by: Linus Torvalds

    Yubo Feng
     

17 Jul, 2020

1 commit

  • Using uninitialized_var() is dangerous as it papers over real bugs[1]
    (or can in the future), and suppresses unrelated compiler warnings
    (e.g. "unused variable"). If the compiler thinks it is uninitialized,
    either simply initialize the variable or make compiler changes.

    In preparation for removing[2] the[3] macro[4], remove all remaining
    needless uses with the following script:

    git grep '\buninitialized_var\b' | cut -d: -f1 | sort -u | \
    xargs perl -pi -e \
    's/\buninitialized_var\(([^\)]+)\)/\1/g;
    s:\s*/\* (GCC be quiet|to make compiler happy) \*/$::g;'

    drivers/video/fbdev/riva/riva_hw.c was manually tweaked to avoid
    pathological white-space.

    No outstanding warnings were found building allmodconfig with GCC 9.3.0
    for x86_64, i386, arm64, arm, powerpc, powerpc64le, s390x, mips, sparc64,
    alpha, and m68k.

    [1] https://lore.kernel.org/lkml/20200603174714.192027-1-glider@google.com/
    [2] https://lore.kernel.org/lkml/CA+55aFw+Vbj0i=1TGqCR5vQkCzWJ0QxK6CernOU6eedsudAixw@mail.gmail.com/
    [3] https://lore.kernel.org/lkml/CA+55aFwgbgqhbp1fkxvRKEpzyR5J8n1vKT1VZdz9knmPuXhOeg@mail.gmail.com/
    [4] https://lore.kernel.org/lkml/CA+55aFz2500WfbKXAx8s67wrm9=yVJu65TpLgN_ybYNv0VEOKA@mail.gmail.com/

    Reviewed-by: Leon Romanovsky # drivers/infiniband and mlx4/mlx5
    Acked-by: Jason Gunthorpe # IB
    Acked-by: Kalle Valo # wireless drivers
    Reviewed-by: Chao Yu # erofs
    Signed-off-by: Kees Cook

    Kees Cook
     

05 Jun, 2020

2 commits

  • Current readahead for FAT entries is very simple but is having some flaws,
    so it is not working well for some environments. This patch improves the
    readahead more or less.

    The key points of modification are,

    - make the readahead size tunable by using bdi->ra_pages
    - care the bdi->io_pages to avoid the small size I/O request
    - update readahead window before fully exhausting

    With this patch, on slow USB connected 2TB hdd:

    [before]
    383.18sec

    [after]
    51.03sec

    Signed-off-by: OGAWA Hirofumi
    Signed-off-by: Andrew Morton
    Tested-by: hyeongseok.kim
    Reviewed-by: hyeongseok.kim
    Link: http://lkml.kernel.org/r/87d08e1dlh.fsf@mail.parknet.co.jp
    Signed-off-by: Linus Torvalds

    OGAWA Hirofumi
     
  • If FAT length == 0, the image doesn't have any data. And it can be the
    cause of overlapping the root dir and FAT entries.

    Also Windows treats it as invalid format.

    Reported-by: syzbot+6f1624f937d9d6911e2d@syzkaller.appspotmail.com
    Signed-off-by: OGAWA Hirofumi
    Signed-off-by: Andrew Morton
    Cc: Marco Elver
    Cc: Dmitry Vyukov
    Link: http://lkml.kernel.org/r/87r1wz8mrd.fsf@mail.parknet.co.jp
    Signed-off-by: Linus Torvalds

    OGAWA Hirofumi
     

03 Jun, 2020

3 commits

  • Pull block updates from Jens Axboe:
    "Core block changes that have been queued up for this release:

    - Remove dead blk-throttle and blk-wbt code (Guoqing)

    - Include pid in blktrace note traces (Jan)

    - Don't spew I/O errors on wouldblock termination (me)

    - Zone append addition (Johannes, Keith, Damien)

    - IO accounting improvements (Konstantin, Christoph)

    - blk-mq hardware map update improvements (Ming)

    - Scheduler dispatch improvement (Salman)

    - Inline block encryption support (Satya)

    - Request map fixes and improvements (Weiping)

    - blk-iocost tweaks (Tejun)

    - Fix for timeout failing with error injection (Keith)

    - Queue re-run fixes (Douglas)

    - CPU hotplug improvements (Christoph)

    - Queue entry/exit improvements (Christoph)

    - Move DMA drain handling to the few drivers that use it (Christoph)

    - Partition handling cleanups (Christoph)"

    * tag 'for-5.8/block-2020-06-01' of git://git.kernel.dk/linux-block: (127 commits)
    block: mark bio_wouldblock_error() bio with BIO_QUIET
    blk-wbt: rename __wbt_update_limits to wbt_update_limits
    blk-wbt: remove wbt_update_limits
    blk-throttle: remove tg_drain_bios
    blk-throttle: remove blk_throtl_drain
    null_blk: force complete for timeout request
    blk-mq: drain I/O when all CPUs in a hctx are offline
    blk-mq: add blk_mq_all_tag_iter
    blk-mq: open code __blk_mq_alloc_request in blk_mq_alloc_request_hctx
    blk-mq: use BLK_MQ_NO_TAG in more places
    blk-mq: rename BLK_MQ_TAG_FAIL to BLK_MQ_NO_TAG
    blk-mq: move more request initialization to blk_mq_rq_ctx_init
    blk-mq: simplify the blk_mq_get_request calling convention
    blk-mq: remove the bio argument to ->prepare_request
    nvme: force complete cancelled requests
    blk-mq: blk-mq: provide forced completion method
    block: fix a warning when blkdev.h is included for !CONFIG_BLOCK builds
    block: blk-crypto-fallback: remove redundant initialization of variable err
    block: reduce part_stat_lock() scope
    block: use __this_cpu_add() instead of access by smp_processor_id()
    ...

    Linus Torvalds
     
  • Merge updates from Andrew Morton:
    "A few little subsystems and a start of a lot of MM patches.

    Subsystems affected by this patch series: squashfs, ocfs2, parisc,
    vfs. With mm subsystems: slab-generic, slub, debug, pagecache, gup,
    swap, memcg, pagemap, memory-failure, vmalloc, kasan"

    * emailed patches from Andrew Morton : (128 commits)
    kasan: move kasan_report() into report.c
    mm/mm_init.c: report kasan-tag information stored in page->flags
    ubsan: entirely disable alignment checks under UBSAN_TRAP
    kasan: fix clang compilation warning due to stack protector
    x86/mm: remove vmalloc faulting
    mm: remove vmalloc_sync_(un)mappings()
    x86/mm/32: implement arch_sync_kernel_mappings()
    x86/mm/64: implement arch_sync_kernel_mappings()
    mm/ioremap: track which page-table levels were modified
    mm/vmalloc: track which page-table levels were modified
    mm: add functions to track page directory modifications
    s390: use __vmalloc_node in stack_alloc
    powerpc: use __vmalloc_node in alloc_vm_stack
    arm64: use __vmalloc_node in arch_alloc_vmap_stack
    mm: remove vmalloc_user_node_flags
    mm: switch the test_vmalloc module to use __vmalloc_node
    mm: remove __vmalloc_node_flags_caller
    mm: remove both instances of __vmalloc_node_flags
    mm: remove the prot argument to __vmalloc_node
    mm: remove the pgprot argument to __vmalloc
    ...

    Linus Torvalds
     
  • Implement the new readahead aop and convert all callers (block_dev,
    exfat, ext2, fat, gfs2, hpfs, isofs, jfs, nilfs2, ocfs2, omfs, qnx6,
    reiserfs & udf).

    The callers are all trivial except for GFS2 & OCFS2.

    Signed-off-by: Matthew Wilcox (Oracle)
    Signed-off-by: Andrew Morton
    Reviewed-by: Junxiao Bi # ocfs2
    Reviewed-by: Joseph Qi # ocfs2
    Reviewed-by: Dave Chinner
    Reviewed-by: John Hubbard
    Reviewed-by: Christoph Hellwig
    Reviewed-by: William Kucharski
    Cc: Chao Yu
    Cc: Cong Wang
    Cc: Darrick J. Wong
    Cc: Eric Biggers
    Cc: Gao Xiang
    Cc: Jaegeuk Kim
    Cc: Michal Hocko
    Cc: Zi Yan
    Cc: Johannes Thumshirn
    Cc: Miklos Szeredi
    Link: http://lkml.kernel.org/r/20200414150233.24495-17-willy@infradead.org
    Signed-off-by: Linus Torvalds

    Matthew Wilcox (Oracle)
     

02 Jun, 2020

1 commit

  • Pull uaccess/access_ok updates from Al Viro:
    "Removals of trivially pointless access_ok() calls.

    Note: the fiemap stuff was removed from the series, since they are
    duplicates with part of ext4 series carried in Ted's tree"

    * 'uaccess.access_ok' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
    vmci_host: get rid of pointless access_ok()
    hfi1: get rid of pointless access_ok()
    usb: get rid of pointless access_ok() calls
    lpfc_debugfs: get rid of pointless access_ok()
    efi_test: get rid of pointless access_ok()
    drm_read(): get rid of pointless access_ok()
    via-pmu: don't bother with access_ok()
    drivers/crypto/ccp/sev-dev.c: get rid of pointless access_ok()
    omapfb: get rid of pointless access_ok() calls
    amifb: get rid of pointless access_ok() calls
    drivers/fpga/dfl-afu-dma-region.c: get rid of pointless access_ok()
    drivers/fpga/dfl-fme-pr.c: get rid of pointless access_ok()
    cm4000_cs.c cmm_ioctl(): get rid of pointless access_ok()
    nvram: drop useless access_ok()
    n_hdlc_tty_read(): remove pointless access_ok()
    tomoyo_write_control(): get rid of pointless access_ok()
    btrfs_ioctl_send(): don't bother with access_ok()
    fat_dir_ioctl(): hadn't needed that access_ok() for more than a decade...
    dlmfs_file_write(): get rid of pointless access_ok()

    Linus Torvalds
     

22 May, 2020

1 commit


10 May, 2020

1 commit


21 Apr, 2020

1 commit

  • Several references got broken due to txt to ReST conversion.

    Several of them can be automatically fixed with:

    scripts/documentation-file-ref-check --fix

    Reviewed-by: Mathieu Poirier # hwtracing/coresight/Kconfig
    Reviewed-by: Paul E. McKenney # memory-barrier.txt
    Acked-by: Alex Shi # translations/zh_CN
    Acked-by: Federico Vaga # translations/it_IT
    Acked-by: Marc Zyngier # kvm/arm64
    Signed-off-by: Mauro Carvalho Chehab
    Link: https://lore.kernel.org/r/6f919ddb83a33b5f2a63b6b5f0575737bb2b36aa.1586881715.git.mchehab+huawei@kernel.org
    Signed-off-by: Jonathan Corbet

    Mauro Carvalho Chehab
     

06 Mar, 2020

1 commit

  • When get an error in the middle of reading an inode, some fields in the
    inode might be still not initialized. And then the evict_inode path may
    access those fields via iput().

    To fix, this makes sure that inode fields are initialized.

    Reported-by: syzbot+9d82b8de2992579da5d0@syzkaller.appspotmail.com
    Signed-off-by: Andrew Morton
    Signed-off-by: OGAWA Hirofumi
    Cc:
    Link: http://lkml.kernel.org/r/871rqnreqx.fsf@mail.parknet.co.jp
    Signed-off-by: Linus Torvalds

    OGAWA Hirofumi
     

05 Feb, 2020

1 commit

  • Pull vfs timestamp updates from Al Viro:
    "More 64bit timestamp work"

    * 'imm.timestamp' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
    kernfs: don't bother with timestamp truncation
    fs: Do not overload update_time
    fs: Delete timespec64_trunc()
    fs: ubifs: Eliminate timespec64_trunc() usage
    fs: ceph: Delete timespec64_trunc() usage
    fs: cifs: Delete usage of timespec64_trunc
    fs: fat: Eliminate timespec64_trunc() usage
    utimes: Clamp the timestamps in notify_change()

    Linus Torvalds
     

19 Dec, 2019

1 commit


09 Dec, 2019

1 commit

  • timespec64_trunc() is being deleted.

    timestamp_truncate() is the replacement api for
    timespec64_trunc. timestamp_truncate() additionally clamps
    timestamps to make sure the timestamps lie within the
    permitted range for the filesystem.

    But, fat always truncates the times locally after it obtains
    the timestamps from current_time().
    Implement a local version here along the lines of existing
    truncate functions.

    Suggested-by: Al Viro
    Signed-off-by: Deepa Dinamani
    Cc: hirofumi@mail.parknet.co.jp
    Signed-off-by: Al Viro

    Deepa Dinamani
     

23 Oct, 2019

1 commit

  • Each of these drivers has a copy of the same trivial helper function to
    convert the pointer argument and then call the native ioctl handler.

    We now have a generic implementation of that, so use it.

    Acked-by: Greg Kroah-Hartman
    Acked-by: Michael S. Tsirkin
    Acked-by: David S. Miller
    Acked-by: Jarkko Sakkinen
    Reviewed-by: Jarkko Sakkinen
    Reviewed-by: Jason Gunthorpe
    Reviewed-by: Jiri Kosina
    Reviewed-by: Stefan Hajnoczi
    Reviewed-by: Cornelia Huck
    Signed-off-by: Arnd Bergmann

    Arnd Bergmann
     

26 Sep, 2019

1 commit

  • brelse() tests whether its argument is NULL and then returns immediately.
    Thus the test around the call is not needed.

    This issue was detected by using the Coccinelle software.

    Link: http://lkml.kernel.org/r/cfff3b81-fb5d-af26-7b5e-724266509045@web.de
    Signed-off-by: Markus Elfring
    Acked-by: OGAWA Hirofumi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Markus Elfring
     

25 Sep, 2019

1 commit

  • If userspace reads the buffer via blockdev while mounting,
    sb_getblk()+modify can race with buffer read via blockdev.

    For example,

    FS userspace
    bh = sb_getblk()
    modify bh->b_data
    read
    ll_rw_block(bh)
    fill bh->b_data by on-disk data
    /* lost modified data by FS */
    set_buffer_uptodate(bh)
    set_buffer_uptodate(bh)

    Userspace should not use the blockdev while mounting though, the udev
    seems to be already doing this. Although I think the udev should try to
    avoid this, workaround the race by small overhead.

    Link: http://lkml.kernel.org/r/87pnk7l3sw.fsf_-_@mail.parknet.co.jp
    Signed-off-by: OGAWA Hirofumi
    Reported-by: Jan Stancek
    Tested-by: Jan Stancek
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    OGAWA Hirofumi
     

30 Aug, 2019

1 commit

  • Fill in the appropriate limits to avoid inconsistencies
    in the vfs cached inode times when timestamps are
    outside the permitted range.

    Some FAT variants indicate that the years after 2099 are not supported.
    Since commit 7decd1cb0305 ("fat: Fix and cleanup timestamp conversion")
    we support the full range of years that can be represented, up to 2107.

    Signed-off-by: Deepa Dinamani
    Acked-by: Jeff Layton
    Cc: hirofumi@mail.parknet.co.jp

    Deepa Dinamani
     

05 Jun, 2019

1 commit

  • Based on 1 normalized pattern(s):

    this software is licensed under the terms of the gnu general public
    license version 2 as published by the free software foundation and
    may be copied distributed and modified under those terms this
    program is distributed in the hope that it will be useful but
    without any warranty without even the implied warranty of
    merchantability or fitness for a particular purpose see the gnu
    general public license for more details

    extracted by the scancode license scanner the SPDX license identifier

    GPL-2.0-only

    has been chosen to replace the boilerplate/reference in 285 file(s).

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Alexios Zavras
    Reviewed-by: Allison Randal
    Cc: linux-spdx@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190529141900.642774971@linutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     

31 May, 2019

1 commit

  • Based on 1 normalized pattern(s):

    released under gpl v2

    extracted by the scancode license scanner the SPDX license identifier

    GPL-2.0-only

    has been chosen to replace the boilerplate/reference in 15 file(s).

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Steve Winslow
    Reviewed-by: Allison Randal
    Reviewed-by: Alexios Zavras
    Cc: linux-spdx@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190528171438.895196075@linutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     

21 May, 2019

2 commits