25 Oct, 2020

1 commit

  • Pull misc vfs updates from Al Viro:
    "Assorted stuff all over the place (the largest group here is
    Christoph's stat cleanups)"

    * 'work.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
    fs: remove KSTAT_QUERY_FLAGS
    fs: remove vfs_stat_set_lookup_flags
    fs: move vfs_fstatat out of line
    fs: implement vfs_stat and vfs_lstat in terms of vfs_fstatat
    fs: remove vfs_statx_fd
    fs: omfs: use kmemdup() rather than kmalloc+memcpy
    [PATCH] reduce boilerplate in fsid handling
    fs: Remove duplicated flag O_NDELAY occurring twice in VALID_OPEN_FLAGS
    selftests: mount: add nosymfollow tests
    Add a "nosymfollow" mount option.

    Linus Torvalds
     

16 Oct, 2020

1 commit

  • Pull UDF, reiserfs, ext2, quota fixes from Jan Kara:

    - a couple of UDF fixes for issues found by syzbot fuzzing

    - a couple of reiserfs fixes for issues found by syzbot fuzzing

    - some minor ext2 cleanups

    - quota patches to support grace times beyond year 2038 for XFS quota
    APIs

    * tag 'fs_for_v5.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs:
    reiserfs: Fix oops during mount
    udf: Limit sparing table size
    udf: Remove pointless union in udf_inode_info
    udf: Avoid accessing uninitialized data on failed inode read
    quota: clear padding in v2r1_mem2diskdqb()
    reiserfs: Initialize inode keys properly
    udf: Fix memory leak when mounting
    udf: Remove redundant initialization of variable ret
    reiserfs: only call unlock_new_inode() if I_NEW
    ext2: Fix some kernel-doc warnings in balloc.c
    quota: Expand comment describing d_itimer
    quota: widen timestamps for the fs_disk_quota structure
    reiserfs: Fix memory leak in reiserfs_parse_options()
    udf: Use kvzalloc() in udf_sb_alloc_bitmap()
    ext2: remove duplicate include

    Linus Torvalds
     

19 Sep, 2020

1 commit


14 Sep, 2020

1 commit

  • Fixes the following W=1 kernel build warning(s):

    fs/ext2/balloc.c:203: warning: Excess function parameter 'rb_root' description in '__rsv_window_dump'
    fs/ext2/balloc.c:294: warning: Excess function parameter 'rb_root' description in 'search_reserve_window'
    fs/ext2/balloc.c:878: warning: Excess function parameter 'rsv' description in 'alloc_new_reservation'

    Link: https://lore.kernel.org/r/20200911114036.60616-1-wanghai38@huawei.com
    Reported-by: Hulk Robot
    Signed-off-by: Wang Hai
    Signed-off-by: Jan Kara

    Wang Hai
     

06 Sep, 2020

1 commit

  • When running in a dax mode, if the user maps a page with MAP_PRIVATE and
    PROT_WRITE, the ext2 filesystem would incorrectly update ctime and mtime
    when the user hits a COW fault.

    This breaks building of the Linux kernel. How to reproduce:

    1. extract the Linux kernel tree on dax-mounted ext2 filesystem
    2. run make clean
    3. run make -j12
    4. run make -j12

    at step 4, make would incorrectly rebuild the whole kernel (although it
    was already built in step 3).

    The reason for the breakage is that almost all object files depend on
    objtool. When we run objtool, it takes COW page fault on its .data
    section, and these faults will incorrectly update the timestamp of the
    objtool binary. The updated timestamp causes make to rebuild the whole
    tree.

    Signed-off-by: Mikulas Patocka
    Cc: stable@vger.kernel.org
    Signed-off-by: Linus Torvalds

    Mikulas Patocka
     

28 Aug, 2020

1 commit

  • Remove linux/fiemap.h which is included more than once

    Link: https://lore.kernel.org/r/20200819025434.65763-1-wanghai38@huawei.com
    Reported-by: Hulk Robot
    Reviewed-by: Ritesh Harjani
    Signed-off-by: Wang Hai
    Signed-off-by: Jan Kara

    Wang Hai
     

24 Aug, 2020

1 commit

  • Replace the existing /* fall through */ comments and its variants with
    the new pseudo-keyword macro fallthrough[1]. Also, remove unnecessary
    fall-through markings when it is the case.

    [1] https://www.kernel.org/doc/html/v5.7/process/deprecated.html?highlight=fallthrough#implicit-switch-case-fall-through

    Signed-off-by: Gustavo A. R. Silva

    Gustavo A. R. Silva
     

27 Jul, 2020

1 commit

  • Change the repeated word "the" in "it the the" to "it is the".
    Fix typo "recentl" to "recently".
    Fix verb "give" to "gives".

    Link: https://lore.kernel.org/r/20200720001327.23603-1-rdunlap@infradead.org
    Signed-off-by: Randy Dunlap
    Cc: Jan Kara
    Cc: linux-ext4@vger.kernel.org
    Signed-off-by: Jan Kara

    Randy Dunlap
     

09 Jul, 2020

7 commits

  • In order to correctly account/limit space usage, should initialize
    quota info before calling quota related functions.

    Link: https://lore.kernel.org/r/20200626054959.114177-1-cgxu519@mykernel.net
    Signed-off-by: Chengguang Xu
    Reviewed-by: Reviewed-by: Ritesh Harjani
    Signed-off-by: Jan Kara

    Chengguang Xu
     
  • There are some incorrect comments in inode.c, so fix them
    properly.

    Link: https://lore.kernel.org/r/20200703124411.24085-1-cgxu519@mykernel.net
    Signed-off-by: Chengguang Xu
    Signed-off-by: Jan Kara

    Chengguang Xu
     
  • Remove useless nocheck option.

    Link: https://lore.kernel.org/r/20200619073144.4701-1-cgxu519@mykernel.net
    Signed-off-by: Chengguang Xu
    Signed-off-by: Jan Kara

    Chengguang Xu
     
  • sbi->s_freeinodes_counter is only decreased by the ext2 code, it is never
    increased. This patch fixes it.

    Note that sbi->s_freeinodes_counter is only used in the algorithm that
    tries to find the group for new allocations, so this bug is not easily
    visible (the only visibility is that the group finding algorithm selects
    inoptinal result).

    Link: https://lore.kernel.org/r/alpine.LRH.2.02.2004201538300.19436@file01.intranet.prod.int.rdu2.redhat.com
    Signed-off-by: Mikulas Patocka
    Cc: stable@vger.kernel.org

    Signed-off-by: Jan Kara

    Mikulas Patocka
     
  • Almost all callers of ext2_find_entry() transform NULL return value to
    -ENOENT, so just let ext2_find_entry() retuen -ENOENT instead of NULL
    if no valid entry found, and also switch to check the return value of
    ext2_inode_by_name() in ext2_lookup() and ext2_get_parent().

    Link: https://lore.kernel.org/r/20200608034043.10451-2-yi.zhang@huawei.com
    Signed-off-by: zhangyi (F)
    Suggested-by: Jan Kara
    Signed-off-by: Jan Kara

    zhangyi (F)
     
  • The same to commit (ext4: propagate errors up to
    ext4_find_entry()'s callers') in ext4, also return error instead of NULL
    pointer in case of some error happens in ext2_find_entry() (e.g. -ENOMEM
    or -EIO). This could avoid a negative dentry cache entry installed even
    it failed to read directory block due to IO error.

    Link: https://lore.kernel.org/r/20200608034043.10451-1-yi.zhang@huawei.com
    Signed-off-by: zhangyi (F)
    Signed-off-by: Jan Kara

    zhangyi (F)
     
  • In the process of changing value for existing EA,
    there is an improper assignment of e_value_offs(setting to 0),
    because it will be reset to incorrect value in the following
    loop(shifting EA values before target). Delayed assignment
    can avoid this issue.

    Link: https://lore.kernel.org/r/20200603084429.25344-1-cgxu519@mykernel.net
    Signed-off-by: Chengguang Xu
    Signed-off-by: Jan Kara

    Chengguang Xu
     

10 Jun, 2020

1 commit

  • Convert comments that reference mmap_sem to reference mmap_lock instead.

    [akpm@linux-foundation.org: fix up linux-next leftovers]
    [akpm@linux-foundation.org: s/lockaphore/lock/, per Vlastimil]
    [akpm@linux-foundation.org: more linux-next fixups, per Michel]

    Signed-off-by: Michel Lespinasse
    Signed-off-by: Andrew Morton
    Reviewed-by: Vlastimil Babka
    Reviewed-by: Daniel Jordan
    Cc: Davidlohr Bueso
    Cc: David Rientjes
    Cc: Hugh Dickins
    Cc: Jason Gunthorpe
    Cc: Jerome Glisse
    Cc: John Hubbard
    Cc: Laurent Dufour
    Cc: Liam Howlett
    Cc: Matthew Wilcox
    Cc: Peter Zijlstra
    Cc: Ying Han
    Link: http://lkml.kernel.org/r/20200520052908.204642-13-walken@google.com
    Signed-off-by: Linus Torvalds

    Michel Lespinasse
     

06 Jun, 2020

1 commit

  • Pull ext4 updates from Ted Ts'o:
    "A lot of bug fixes and cleanups for ext4, including:

    - Fix performance problems found in dioread_nolock now that it is the
    default, caused by transaction leaks.

    - Clean up fiemap handling in ext4

    - Clean up and refactor multiple block allocator (mballoc) code

    - Fix a problem with mballoc with a smaller file systems running out
    of blocks because they couldn't properly use blocks that had been
    reserved by inode preallocation.

    - Fixed a race in ext4_sync_parent() versus rename()

    - Simplify the error handling in the extent manipulation code

    - Make sure all metadata I/O errors are felected to
    ext4_ext_dirty()'s and ext4_make_inode_dirty()'s callers.

    - Avoid passing an error pointer to brelse in ext4_xattr_set()

    - Fix race which could result to freeing an inode on the dirty last
    in data=journal mode.

    - Fix refcount handling if ext4_iget() fails

    - Fix a crash in generic/019 caused by a corrupted extent node"

    * tag 'ext4_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4: (58 commits)
    ext4: avoid unnecessary transaction starts during writeback
    ext4: don't block for O_DIRECT if IOCB_NOWAIT is set
    ext4: remove the access_ok() check in ext4_ioctl_get_es_cache
    fs: remove the access_ok() check in ioctl_fiemap
    fs: handle FIEMAP_FLAG_SYNC in fiemap_prep
    fs: move fiemap range validation into the file systems instances
    iomap: fix the iomap_fiemap prototype
    fs: move the fiemap definitions out of fs.h
    fs: mark __generic_block_fiemap static
    ext4: remove the call to fiemap_check_flags in ext4_fiemap
    ext4: split _ext4_fiemap
    ext4: fix fiemap size checks for bitmap files
    ext4: fix EXT4_MAX_LOGICAL_BLOCK macro
    add comment for ext4_dir_entry_2 file_type member
    jbd2: avoid leaking transaction credits when unreserving handle
    ext4: drop ext4_journal_free_reserved()
    ext4: mballoc: use lock for checking free blocks while retrying
    ext4: mballoc: refactor ext4_mb_good_group()
    ext4: mballoc: introduce pcpu seqcnt for freeing PA to improve ENOSPC handling
    ext4: mballoc: refactor ext4_mb_discard_preallocations()
    ...

    Linus Torvalds
     

05 Jun, 2020

1 commit


04 Jun, 2020

1 commit


03 Jun, 2020

1 commit

  • 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)
     

22 May, 2020

2 commits

  • Define ext2_listxattr to NULL when CONFIG_EROFS_FS_XATTR
    is not enabled, then we can remove many ugly ifdef macros
    in the code.

    Link: https://lore.kernel.org/r/20200522044035.24190-2-cgxu519@mykernel.net
    Signed-off-by: Chengguang Xu
    Signed-off-by: Jan Kara

    Chengguang Xu
     
  • Let's always set special inode i_op to &ext2_special_inode_operations
    regardless of CONFIG_EXT2_FS_XATTR setting. It makes sence to be able to
    query extended inode flags (needing ->setattr and ->getattr callbacks)
    even when CONFIG_EXT2_FS_XATTR is not set.

    Link: https://lore.kernel.org/r/20200522044035.24190-1-cgxu519@mykernel.net
    Signed-off-by: Chengguang Xu
    Signed-off-by: Jan Kara

    Chengguang Xu
     

23 Mar, 2020

1 commit

  • When EXT2_ATTR_DEBUG is not defined, modify the 2 debug macros
    to use the no_printk() macro instead of .
    This fixes gcc warnings when -Wextra is used:

    ../fs/ext2/xattr.c:252:42: warning: suggest braces around empty body in an ‘if’ statement [-Wempty-body]
    ../fs/ext2/xattr.c:258:42: warning: suggest braces around empty body in an ‘if’ statement [-Wempty-body]
    ../fs/ext2/xattr.c:330:42: warning: suggest braces around empty body in an ‘if’ statement [-Wempty-body]
    ../fs/ext2/xattr.c:872:45: warning: suggest braces around empty body in an ‘else’ statement [-Wempty-body]

    I have verified that the only object code change (with gcc 7.5.0) is
    the reversal of some instructions from 'cmp a,b' to 'cmp b,a'.

    Link: https://lore.kernel.org/r/e18a7395-61fb-2093-18e8-ed4f8cf56248@infradead.org
    Signed-off-by: Randy Dunlap
    Cc: Jan Kara
    Cc: linux-ext4@vger.kernel.org
    Signed-off-by: Jan Kara

    Randy Dunlap
     

17 Mar, 2020

1 commit

  • Fix a debug-only build error in ext2/xattr.c:

    When building without extra debugging, (and with another patch that uses
    no_printk() instead of for the ext2-xattr debug-print macros,
    this build error happens:

    ../fs/ext2/xattr.c: In function ‘ext2_xattr_cache_insert’:
    ../fs/ext2/xattr.c:869:18: error: ‘ext2_xattr_cache’ undeclared (first use in
    this function); did you mean ‘ext2_xattr_list’?
    atomic_read(&ext2_xattr_cache->c_entry_count));

    Fix the problem by removing cached entry count from the debug message
    since otherwise we'd have to export the mbcache structure just for that.

    Fixes: be0726d33cb8 ("ext2: convert to mbcache2")
    Reported-by: Randy Dunlap
    Signed-off-by: Jan Kara

    Jan Kara
     

16 Mar, 2020

1 commit

  • The current codebase makes use of the zero-length array language
    extension to the C90 standard, but the preferred mechanism to declare
    variable-length types such as these ones is a flexible array member[1][2],
    introduced in C99:

    struct foo {
    int stuff;
    struct boo array[];
    };

    By making use of the mechanism above, we will get a compiler warning
    in case the flexible array does not occur last in the structure, which
    will help us prevent some kind of undefined behavior bugs from being
    inadvertently introduced[3] to the codebase from now on.

    Also, notice that, dynamic memory allocations won't be affected by
    this change:

    "Flexible array members have incomplete type, and so the sizeof operator
    may not be applied. As a quirk of the original implementation of
    zero-length arrays, sizeof evaluates to zero."[1]

    This issue was found with the help of Coccinelle.

    [1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
    [2] https://github.com/KSPP/linux/issues/21
    [3] commit 76497732932f ("cxgb3/l2t: Fix undefined behaviour")

    Link: https://lore.kernel.org/r/20200309180441.GA2992@embeddedor
    Signed-off-by: Gustavo A. R. Silva
    Signed-off-by: Jan Kara

    Gustavo A. R. Silva
     

26 Feb, 2020

1 commit

  • Lockdep complains about a chain:
    sb_internal#2 --> &ei->xattr_sem#2 --> fs_reclaim

    and shrink_dentry_list -> ext2_evict_inode -> ext2_xattr_delete_inode ->
    down_write(ei->xattr_sem) creating a locking cycle in the reclaim path.
    This is however a false positive because when we are in
    ext2_evict_inode() we are the only holder of the inode reference and
    nobody else should touch xattr_sem of that inode. So we cannot ever
    block on acquiring the xattr_sem in the reclaim path.

    Silence the lockdep warning by using down_write_trylock() in
    ext2_xattr_delete_inode() to not create false locking dependency.

    Reported-by: "J. R. Okajima"
    Reviewed-by: Ritesh Harjani
    Signed-off-by: Jan Kara

    Jan Kara
     

12 Feb, 2020

1 commit

  • Pull dax fixes from Dan Williams:
    "A fix for an xfstest failure and some and an update that removes an
    fsdax dependency on block devices.

    Summary:

    - Fix RWF_NOWAIT writes to properly return -EAGAIN

    - Clean up an unused helper

    - Update dax_writeback_mapping_range to not need a block_device
    argument"

    * tag 'dax-fixes-5.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm:
    dax: pass NOWAIT flag to iomap_apply
    dax: Get rid of fs_dax_get_by_host() helper
    dax: Pass dax_dev instead of bdev to dax_writeback_mapping_range()

    Linus Torvalds
     

06 Jan, 2020

1 commit

  • Clang warns:

    ../fs/ext2/super.c:1076:3: warning: misleading indentation; statement is
    not part of the previous 'if' [-Wmisleading-indentation]
    sbi->s_groups_count = ((le32_to_cpu(es->s_blocks_count) -
    ^
    ../fs/ext2/super.c:1074:2: note: previous statement is here
    if (EXT2_BLOCKS_PER_GROUP(sb) == 0)
    ^
    1 warning generated.

    This warning occurs because there is a space before the tab on this
    line. Remove it so that the indentation is consistent with the Linux
    kernel coding style and clang no longer warns.

    Fixes: 41f04d852e35 ("[PATCH] ext2: fix mounts at 16T")
    Link: https://github.com/ClangBuiltLinux/linux/issues/827
    Link: https://lore.kernel.org/r/20191218031930.31393-1-natechancellor@gmail.com
    Signed-off-by: Nathan Chancellor
    Signed-off-by: Jan Kara

    Nathan Chancellor
     

04 Jan, 2020

1 commit

  • As of now dax_writeback_mapping_range() takes "struct block_device" as a
    parameter and dax_dev is searched from bdev name. This also involves taking
    a fresh reference on dax_dev and putting that reference at the end of
    function.

    We are developing a new filesystem virtio-fs and using dax to access host
    page cache directly. But there is no block device. IOW, we want to make
    use of dax but want to get rid of this assumption that there is always
    a block device associated with dax_dev.

    So pass in "struct dax_device" as parameter instead of bdev.

    ext2/ext4/xfs are current users and they already have a reference on
    dax_device. So there is no need to take reference and drop reference to
    dax_device on each call of this function.

    Suggested-by: Christoph Hellwig
    Reviewed-by: Christoph Hellwig
    Reviewed-by: Jan Kara
    Signed-off-by: Vivek Goyal
    Link: https://lore.kernel.org/r/20200103183307.GB13350@redhat.com
    Signed-off-by: Dan Williams

    Vivek Goyal
     

16 Dec, 2019

1 commit


01 Dec, 2019

1 commit

  • Pull ext2, quota, reiserfs cleanups and fixes from Jan Kara:

    - Refactor the quota on/off kernel internal interfaces (mostly for
    ubifs quota support as ubifs does not want to have inodes holding
    quota information)

    - A few other small quota fixes and cleanups

    - Various small ext2 fixes and cleanups

    - Reiserfs xattr fix and one cleanup

    * tag 'for_v5.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs: (28 commits)
    ext2: code cleanup for descriptor_loc()
    fs/quota: handle overflows of sysctl fs.quota.* and report as unsigned long
    ext2: fix improper function comment
    ext2: code cleanup for ext2_try_to_allocate()
    ext2: skip unnecessary operations in ext2_try_to_allocate()
    ext2: Simplify initialization in ext2_try_to_allocate()
    ext2: code cleanup by calling ext2_group_last_block_no()
    ext2: introduce new helper ext2_group_last_block_no()
    reiserfs: replace open-coded atomic_dec_and_mutex_lock()
    ext2: check err when partial != NULL
    quota: Handle quotas without quota inodes in dquot_get_state()
    quota: Make dquot_disable() work without quota inodes
    quota: Drop dquot_enable()
    fs: Use dquot_load_quota_inode() from filesystems
    quota: Rename vfs_load_quota_inode() to dquot_load_quota_inode()
    quota: Simplify dquot_resume()
    quota: Factor out setup of quota inode
    quota: Check that quota is not dirty before release
    quota: fix livelock in dquot_writeback_dquots
    ext2: don't set *count in the case of failure in ext2_try_to_allocate()
    ...

    Linus Torvalds
     

20 Nov, 2019

1 commit


07 Nov, 2019

4 commits


06 Nov, 2019

2 commits


05 Nov, 2019

1 commit

  • Check err when partial == NULL is meaningless because
    partial == NULL means getting branch successfully without
    error.

    CC: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20191105045100.7104-1-cgxu519@mykernel.net
    Signed-off-by: Chengguang Xu
    Signed-off-by: Jan Kara

    Chengguang Xu
     

31 Oct, 2019

1 commit

  • Currently we set *count to num(value 0) in the failure
    of block allocation in ext2_try_to_allocate(). Without
    reservation, we reuse *count(value 0) to retry block
    allocation and wrong *count will cause only allocating
    maximum 1 block even though having sufficent free blocks
    in that block group. Finally, it probably cause significant
    fragmentation.

    Link: https://lore.kernel.org/r/20191026090721.23794-1-cgxu519@mykernel.net
    Signed-off-by: Chengguang Xu
    Signed-off-by: Jan Kara

    Chengguang Xu