27 Nov, 2018

1 commit

  • [ Upstream commit b10298d56c9623f9b173f19959732d3184b35f4f ]

    fill_with_dentries() failed to propagate errors up to
    reiserfs_for_each_xattr() properly. Plumb them through.

    Note that reiserfs_for_each_xattr() is only used by
    reiserfs_delete_xattrs() and reiserfs_chown_xattrs(). The result of
    reiserfs_delete_xattrs() is discarded anyway, the only difference there is
    whether a warning is printed to dmesg. The result of
    reiserfs_chown_xattrs() does matter because it can block chowning of the
    file to which the xattrs belong; but either way, the resulting state can
    have misaligned ownership, so my patch doesn't improve things greatly.

    Credit for making me look at this code goes to Al Viro, who pointed out
    that the ->actor calling convention is suboptimal and should be changed.

    Link: http://lkml.kernel.org/r/20180802163335.83312-1-jannh@google.com
    Signed-off-by: Jann Horn
    Reviewed-by: Andrew Morton
    Cc: Jeff Mahoney
    Cc: Eric Biggers
    Cc: Al Viro
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds
    Signed-off-by: Sasha Levin

    Jann Horn
     

15 Sep, 2018

1 commit

  • [ Upstream commit 8b73ce6a4bae4fe12bcb2c361c0da4183c2e1b6f ]

    This uses the deprecated time_t type but is write-only, and could be
    removed, but as Jeff explains, having a timestamp can be usefule for
    post-mortem analysis in crash dumps.

    In order to remove one of the last instances of time_t, this changes the
    type to time64_t, same as j_trans_start_time.

    Link: http://lkml.kernel.org/r/20180622133315.221210-1-arnd@arndb.de
    Signed-off-by: Arnd Bergmann
    Cc: Jan Kara
    Cc: Jeff Mahoney
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Arnd Bergmann
     

24 Aug, 2018

1 commit

  • commit a13f085d111e90469faf2d9965eb39b11c114d7e upstream.

    This fixes the following issues:

    - When a buffer size is supplied to reiserfs_listxattr() such that each
    individual name fits, but the concatenation of all names doesn't fit,
    reiserfs_listxattr() overflows the supplied buffer. This leads to a
    kernel heap overflow (verified using KASAN) followed by an out-of-bounds
    usercopy and is therefore a security bug.

    - When a buffer size is supplied to reiserfs_listxattr() such that a
    name doesn't fit, -ERANGE should be returned. But reiserfs instead just
    truncates the list of names; I have verified that if the only xattr on a
    file has a longer name than the supplied buffer length, listxattr()
    incorrectly returns zero.

    With my patch applied, -ERANGE is returned in both cases and the memory
    corruption doesn't happen anymore.

    Credit for making me clean this code up a bit goes to Al Viro, who pointed
    out that the ->actor calling convention is suboptimal and should be
    changed.

    Link: http://lkml.kernel.org/r/20180802151539.5373-1-jannh@google.com
    Fixes: 48b32a3553a5 ("reiserfs: use generic xattr handlers")
    Signed-off-by: Jann Horn
    Acked-by: Jeff Mahoney
    Cc: Eric Biggers
    Cc: Al Viro
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds
    Signed-off-by: Greg Kroah-Hartman

    Jann Horn
     

22 Jul, 2018

1 commit

  • commit fe10e398e860955bac4d28ec031b701d358465e4 upstream.

    ReiserFS prepares log messages into a 1024-byte buffer with no bounds
    checks. Long messages, such as the "unknown mount option" warning when
    userspace passes a crafted mount options string, overflow this buffer.
    This causes KASAN to report a global-out-of-bounds write.

    Fix it by truncating messages to the buffer size.

    Link: http://lkml.kernel.org/r/20180707203621.30922-1-ebiggers3@gmail.com
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Reported-by: syzbot+b890b3335a4d8c608963@syzkaller.appspotmail.com
    Signed-off-by: Eric Biggers
    Reviewed-by: Andrew Morton
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds
    Signed-off-by: Greg Kroah-Hartman

    Eric Biggers
     

30 May, 2018

1 commit

  • commit 1e2e547a93a00ebc21582c06ca3c6cfea2a309ee upstream.

    For anything NFS-exported we do _not_ want to unlock new inode
    before it has grown an alias; original set of fixes got the
    ordering right, but missed the nasty complication in case of
    lockdep being enabled - unlock_new_inode() does
    lockdep_annotate_inode_mutex_key(inode)
    which can only be done before anyone gets a chance to touch
    ->i_mutex. Unfortunately, flipping the order and doing
    unlock_new_inode() before d_instantiate() opens a window when
    mkdir can race with open-by-fhandle on a guessed fhandle, leading
    to multiple aliases for a directory inode and all the breakage
    that follows from that.

    Correct solution: a new primitive (d_instantiate_new())
    combining these two in the right order - lockdep annotate, then
    d_instantiate(), then the rest of unlock_new_inode(). All
    combinations of d_instantiate() with unlock_new_inode() should
    be converted to that.

    Cc: stable@kernel.org # 2.6.29 and later
    Tested-by: Mike Marshall
    Reviewed-by: Andreas Dilger
    Signed-off-by: Al Viro
    Signed-off-by: Greg Kroah-Hartman

    Al Viro
     

24 Apr, 2018

1 commit

  • commit 9ad553abe66f8be3f4755e9fa0a6ba137ce76341 upstream.

    One use of the reiserfs_warning() macro in journal_init_dev() is missing
    a parameter, causing the following warning:

    REISERFS warning (device loop0): journal_init_dev: Cannot open '%s': %i journal_init_dev:

    This also causes a WARN_ONCE() warning in the vsprintf code, and then a
    panic if panic_on_warn is set.

    Please remove unsupported %/ in format string
    WARNING: CPU: 1 PID: 4480 at lib/vsprintf.c:2138 format_decode+0x77f/0x830 lib/vsprintf.c:2138
    Kernel panic - not syncing: panic_on_warn set ...

    Just add another string argument to the macro invocation.

    Addresses https://syzkaller.appspot.com/bug?id=0627d4551fdc39bf1ef5d82cd9eef587047f7718

    Link: http://lkml.kernel.org/r/d678ebe1-6f54-8090-df4c-b9affad62293@infradead.org
    Signed-off-by: Randy Dunlap
    Reported-by:
    Tested-by: Randy Dunlap
    Acked-by: Jeff Mahoney
    Cc: Alexander Viro
    Cc: Jan Kara
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds
    Signed-off-by: Greg Kroah-Hartman

    Andrew Morton
     

04 Feb, 2018

1 commit

  • [ Upstream commit 9f97df50c52c2887432debb6238f4e43567386a5 ]

    The i_version field in reiserfs is not initialized and is only ever
    updated here. Nothing ever views it, so just remove it.

    Signed-off-by: Jeff Layton
    Signed-off-by: Jan Kara
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Jeff Layton
     

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
     

15 Sep, 2017

1 commit

  • Pull mount flag updates from Al Viro:
    "Another chunk of fmount preparations from dhowells; only trivial
    conflicts for that part. It separates MS_... bits (very grotty
    mount(2) ABI) from the struct super_block ->s_flags (kernel-internal,
    only a small subset of MS_... stuff).

    This does *not* convert the filesystems to new constants; only the
    infrastructure is done here. The next step in that series is where the
    conflicts would be; that's the conversion of filesystems. It's purely
    mechanical and it's better done after the merge, so if you could run
    something like

    list=$(for i in MS_RDONLY MS_NOSUID MS_NODEV MS_NOEXEC MS_SYNCHRONOUS MS_MANDLOCK MS_DIRSYNC MS_NOATIME MS_NODIRATIME MS_SILENT MS_POSIXACL MS_KERNMOUNT MS_I_VERSION MS_LAZYTIME; do git grep -l $i fs drivers/staging/lustre drivers/mtd ipc mm include/linux; done|sort|uniq|grep -v '^fs/namespace.c$')

    sed -i -e 's/\/SB_RDONLY/g' \
    -e 's/\/SB_NOSUID/g' \
    -e 's/\/SB_NODEV/g' \
    -e 's/\/SB_NOEXEC/g' \
    -e 's/\/SB_SYNCHRONOUS/g' \
    -e 's/\/SB_MANDLOCK/g' \
    -e 's/\/SB_DIRSYNC/g' \
    -e 's/\/SB_NOATIME/g' \
    -e 's/\/SB_NODIRATIME/g' \
    -e 's/\/SB_SILENT/g' \
    -e 's/\/SB_POSIXACL/g' \
    -e 's/\/SB_KERNMOUNT/g' \
    -e 's/\/SB_I_VERSION/g' \
    -e 's/\/SB_LAZYTIME/g' \
    $list

    and commit it with something along the lines of 'convert filesystems
    away from use of MS_... constants' as commit message, it would save a
    quite a bit of headache next cycle"

    * 'work.mount' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
    VFS: Differentiate mount flags (MS_*) from internal superblock flags
    VFS: Convert sb->s_flags & MS_RDONLY to sb_rdonly(sb)
    vfs: Add sb_rdonly(sb) to query the MS_RDONLY flag on s_flags

    Linus Torvalds
     

08 Sep, 2017

1 commit

  • Pull UDF, reiserfs, quota, fsnotify cleanups from Jan Kara:
    "Several UDF, reiserfs, quota and fsnotify cleanups.

    Note that there is also a patch updating MAINTAINERS entry for
    notification subsystem to point to me as a maintainer since current
    entries are stale"

    * 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs:
    fsnotify: make dnotify_fsnotify_ops const
    isofs: Delete an unnecessary variable initialisation in isofs_read_inode()
    isofs: Adjust four checks for null pointers
    isofs: Delete an error message for a failed memory allocation in isofs_read_inode()
    quota_v2: Delete an error message for a failed memory allocation in v2_read_file_info()
    fs-udf: Delete an error message for a failed memory allocation in two functions
    fs-udf: Improve six size determinations
    fs-udf: Adjust two checks for null pointers
    reiserfs: fix spelling mistake: "tranasction" -> "transaction"
    MAINTAINERS: Update entries for notification subsystem
    uapi/linux/quota.h: Do not include linux/errno.h

    Linus Torvalds
     

07 Sep, 2017

1 commit

  • Pull writeback error handling updates from Jeff Layton:
    "This pile continues the work from last cycle on better tracking
    writeback errors. In v4.13 we added some basic errseq_t infrastructure
    and converted a few filesystems to use it.

    This set continues refining that infrastructure, adds documentation,
    and converts most of the other filesystems to use it. The main
    exception at this point is the NFS client"

    * tag 'wberr-v4.14-1' of git://git.kernel.org/pub/scm/linux/kernel/git/jlayton/linux:
    ecryptfs: convert to file_write_and_wait in ->fsync
    mm: remove optimizations based on i_size in mapping writeback waits
    fs: convert a pile of fsync routines to errseq_t based reporting
    gfs2: convert to errseq_t based writeback error reporting for fsync
    fs: convert sync_file_range to use errseq_t based error-tracking
    mm: add file_fdatawait_range and file_write_and_wait
    fuse: convert to errseq_t based error tracking for fsync
    mm: consolidate dax / non-dax checks for writeback
    Documentation: add some docs for errseq_t
    errseq: rename __errseq_set to errseq_set

    Linus Torvalds
     

16 Aug, 2017

1 commit


01 Aug, 2017

1 commit

  • This patch converts most of the in-kernel filesystems that do writeback
    out of the pagecache to report errors using the errseq_t-based
    infrastructure that was recently added. This allows them to report
    errors once for each open file description.

    Most filesystems have a fairly straightforward fsync operation. They
    call filemap_write_and_wait_range to write back all of the data and
    wait on it, and then (sometimes) sync out the metadata.

    For those filesystems this is a straightforward conversion from calling
    filemap_write_and_wait_range in their fsync operation to calling
    file_write_and_wait_range.

    Acked-by: Jan Kara
    Acked-by: Dave Kleikamp
    Signed-off-by: Jeff Layton

    Jeff Layton
     

18 Jul, 2017

1 commit

  • When changing a file's acl mask, reiserfs_set_acl() will first set the
    group bits of i_mode to the value of the mask, and only then set the
    actual extended attribute representing the new acl.

    If the second part fails (due to lack of space, for example) and the
    file had no acl attribute to begin with, the system will from now on
    assume that the mask permission bits are actual group permission bits,
    potentially granting access to the wrong users.

    Prevent this by only changing the inode mode after the acl has been set.

    Signed-off-by: Ernesto A. Fernández
    Signed-off-by: Jan Kara

    Ernesto A. Fernández
     

17 Jul, 2017

2 commits

  • When new directory 'DIR1' is created in a directory 'DIR0' with SGID bit
    set, DIR1 is expected to have SGID bit set (and owning group equal to
    the owning group of 'DIR0'). However when 'DIR0' also has some default
    ACLs that 'DIR1' inherits, setting these ACLs will result in SGID bit on
    'DIR1' to get cleared if user is not member of the owning group.

    Fix the problem by moving posix_acl_update_mode() out of
    __reiserfs_set_acl() into reiserfs_set_acl(). That way the function will
    not be called when inheriting ACLs which is what we want as it prevents
    SGID bit clearing and the mode has been properly set by
    posix_acl_create() anyway.

    Fixes: 073931017b49d9458aa351605b43a7e34598caef
    CC: stable@vger.kernel.org
    CC: reiserfs-devel@vger.kernel.org
    Signed-off-by: Jan Kara

    Jan Kara
     
  • Firstly by applying the following with coccinelle's spatch:

    @@ expression SB; @@
    -SB->s_flags & MS_RDONLY
    +sb_rdonly(SB)

    to effect the conversion to sb_rdonly(sb), then by applying:

    @@ expression A, SB; @@
    (
    -(!sb_rdonly(SB)) && A
    +!sb_rdonly(SB) && A
    |
    -A != (sb_rdonly(SB))
    +A != sb_rdonly(SB)
    |
    -A == (sb_rdonly(SB))
    +A == sb_rdonly(SB)
    |
    -!(sb_rdonly(SB))
    +!sb_rdonly(SB)
    |
    -A && (sb_rdonly(SB))
    +A && sb_rdonly(SB)
    |
    -A || (sb_rdonly(SB))
    +A || sb_rdonly(SB)
    |
    -(sb_rdonly(SB)) != A
    +sb_rdonly(SB) != A
    |
    -(sb_rdonly(SB)) == A
    +sb_rdonly(SB) == A
    |
    -(sb_rdonly(SB)) && A
    +sb_rdonly(SB) && A
    |
    -(sb_rdonly(SB)) || A
    +sb_rdonly(SB) || A
    )

    @@ expression A, B, SB; @@
    (
    -(sb_rdonly(SB)) ? 1 : 0
    +sb_rdonly(SB)
    |
    -(sb_rdonly(SB)) ? A : B
    +sb_rdonly(SB) ? A : B
    )

    to remove left over excess bracketage and finally by applying:

    @@ expression A, SB; @@
    (
    -(A & MS_RDONLY) != sb_rdonly(SB)
    +(bool)(A & MS_RDONLY) != sb_rdonly(SB)
    |
    -(A & MS_RDONLY) == sb_rdonly(SB)
    +(bool)(A & MS_RDONLY) == sb_rdonly(SB)
    )

    to make comparisons against the result of sb_rdonly() (which is a bool)
    work correctly.

    Signed-off-by: David Howells

    David Howells
     

16 Jul, 2017

1 commit

  • Pull ->s_options removal from Al Viro:
    "Preparations for fsmount/fsopen stuff (coming next cycle). Everything
    gets moved to explicit ->show_options(), killing ->s_options off +
    some cosmetic bits around fs/namespace.c and friends. Basically, the
    stuff needed to work with fsmount series with minimum of conflicts
    with other work.

    It's not strictly required for this merge window, but it would reduce
    the PITA during the coming cycle, so it would be nice to have those
    bits and pieces out of the way"

    * 'work.mount' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
    isofs: Fix isofs_show_options()
    VFS: Kill off s_options and helpers
    orangefs: Implement show_options
    9p: Implement show_options
    isofs: Implement show_options
    afs: Implement show_options
    affs: Implement show_options
    befs: Implement show_options
    spufs: Implement show_options
    bpf: Implement show_options
    ramfs: Implement show_options
    pstore: Implement show_options
    omfs: Implement show_options
    hugetlbfs: Implement show_options
    VFS: Don't use save/replace_mount_options if not using generic_show_options
    VFS: Provide empty name qstr
    VFS: Make get_filesystem() return the affected filesystem
    VFS: Clean up whitespace in fs/namespace.c and fs/super.c
    Provide a function to create a NUL-terminated string from unterminated data

    Linus Torvalds
     

14 Jul, 2017

1 commit

  • Pull ext2, udf, reiserfs fixes from Jan Kara:
    "Several ext2, udf, and reiserfs fixes"

    * 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs:
    ext2: Fix memory leak when truncate races ext2_get_blocks
    reiserfs: fix race in prealloc discard
    reiserfs: don't preallocate blocks for extended attributes
    udf: Convert udf_disk_stamp_to_time() to use mktime64()
    udf: Use time64_to_tm for timestamp conversion
    udf: Fix deadlock between writeback and udf_setsize()
    udf: Use i_size_read() in udf_adinicb_writepage()
    udf: Fix races with i_size changes during readpage
    udf: Remove unused UDF_DEFAULT_BLOCKSIZE

    Linus Torvalds
     

06 Jul, 2017

1 commit

  • btrfs, debugfs, reiserfs and tracefs call save_mount_options() and reiserfs
    calls replace_mount_options(), but they then implement their own
    ->show_options() methods and don't touch s_options, rendering the saved
    options unnecessary. I'm trying to eliminate s_options to make it easier
    to implement a context-based mount where the mount options can be passed
    individually over a file descriptor.

    Remove the calls to save/replace_mount_options() call in these cases.

    Signed-off-by: David Howells
    cc: Chris Mason
    cc: Greg Kroah-Hartman
    cc: Steven Rostedt
    cc: linux-btrfs@vger.kernel.org
    cc: reiserfs-devel@vger.kernel.org
    Signed-off-by: Al Viro

    David Howells
     

23 Jun, 2017

2 commits

  • The main loop in __discard_prealloc is protected by the reiserfs write lock
    which is dropped across schedules like the BKL it replaced. The problem is
    that it checks the value, calls a routine that schedules, and then adjusts
    the state. As a result, two threads that are calling
    reiserfs_prealloc_discard at the same time can race when one calls
    reiserfs_free_prealloc_block, the lock is dropped, and the other calls
    reiserfs_free_prealloc_block with the same block number. In the right
    circumstances, it can cause the prealloc count to go negative.

    Signed-off-by: Jeff Mahoney
    Signed-off-by: Jan Kara

    Jeff Mahoney
     
  • Most extended attributes will fit in a single block. More importantly,
    we drop the reference to the inode while holding the transaction open
    so the preallocated blocks aren't released. As a result, the inode
    may be evicted before it's removed from the transaction's prealloc list
    which can cause memory corruption.

    Signed-off-by: Jeff Mahoney
    Signed-off-by: Jan Kara

    Jeff Mahoney
     

20 Jun, 2017

1 commit

  • Rename:

    wait_queue_t => wait_queue_entry_t

    'wait_queue_t' was always a slight misnomer: its name implies that it's a "queue",
    but in reality it's a queue *entry*. The 'real' queue is the wait queue head,
    which had to carry the name.

    Start sorting this out by renaming it to 'wait_queue_entry_t'.

    This also allows the real structure name 'struct __wait_queue' to
    lose its double underscore and become 'struct wait_queue_entry',
    which is the more canonical nomenclature for such data types.

    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Cc: linux-kernel@vger.kernel.org
    Signed-off-by: Ingo Molnar

    Ingo Molnar
     

24 May, 2017

1 commit

  • Commit b685d3d65ac7 "block: treat REQ_FUA and REQ_PREFLUSH as
    synchronous" removed REQ_SYNC flag from WRITE_{FUA|PREFLUSH|...}
    definitions. generic_make_request_checks() however strips REQ_FUA and
    REQ_PREFLUSH flags from a bio when the storage doesn't report volatile
    write cache and thus write effectively becomes asynchronous which can
    lead to performance regressions

    Fix the problem by making sure all bios which are synchronous are
    properly marked with REQ_SYNC.

    Fixes: b685d3d65ac791406e0dfd8779cc9b3707fea5a3
    CC: reiserfs-devel@vger.kernel.org
    CC: stable@vger.kernel.org
    Signed-off-by: Jan Kara

    Jan Kara
     

09 May, 2017

1 commit

  • Prepare to mark sensitive kernel structures for randomization by making
    sure they're using designated initializers. These were identified
    during allyesconfig builds of x86, arm, and arm64, with most initializer
    fixes extracted from grsecurity.

    Link: http://lkml.kernel.org/r/20170329210419.GA40066@beast
    Signed-off-by: Kees Cook
    Cc: Jan Kara
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Kees Cook
     

19 Apr, 2017

3 commits

  • Now that all places setting inode->i_flags that should be reflected in
    on-disk flags are gone, we can remove i_attrs_to_sd_attrs() call.

    Signed-off-by: Jan Kara

    Jan Kara
     
  • reiserfs_new_inode() clears IMMUTABLE and APPEND flags from a symlink
    i_flags however a few lines below in sd_attrs_to_i_attrs() we will
    happily overwrite i_flags with whatever we inherited from the directory.
    Since this behavior is there for ages just remove the useless setting of
    i_flags.

    Signed-off-by: Jan Kara

    Jan Kara
     
  • Currently immutable and noatime flags on quota files are set by quota
    code which requires us to copy inode->i_flags to our on disk version of
    quota flags in GETFLAGS ioctl and when writing stat item. Move to
    setting / clearing these on-disk flags directly to save that copying.

    Signed-off-by: Jan Kara

    Jan Kara
     

05 Apr, 2017

2 commits

  • dquot_writeback_dquots() expects s_umount semaphore to be held to
    protect it from other concurrent quota operations. reiserfs_sync_fs()
    can call dquot_writeback_dquots() without holding s_umount semaphore
    when called from flush_old_commits().

    Fix the problem by grabbing s_umount in flush_old_commits(). However we
    have to be careful and use only trylock since reiserfs_cancel_old_sync()
    can be waiting for flush_old_commits() to complete while holding
    s_umount semaphore. Possible postponing of sync work is not a big deal
    though as that is only an opportunistic flush.

    Fixes: 9d1ccbe70e0b14545caad12dc73adb3605447df0
    Reported-by: Jan Beulich
    Signed-off-by: Jan Kara

    Jan Kara
     
  • Currently canceling of delayed work that flushes old data using
    cancel_old_flush() does not prevent work from being requeued. Thus
    in theory new work can be queued after cancel_old_flush() from
    reiserfs_freeze() has run. This will become larger problem once
    flush_old_commits() can requeue the work itself.

    Fix the problem by recording in sbi->work_queue that flushing work is
    canceled and should not be requeued.

    Signed-off-by: Jan Kara

    Jan Kara
     

24 Mar, 2017

1 commit

  • The latest gcc-7.0.1 snapshot warns about an unintialized variable use:

    In file included from fs/reiserfs/lbalance.c:8:0:
    fs/reiserfs/lbalance.c: In function 'leaf_item_bottle.isra.3':
    fs/reiserfs/reiserfs.h:1279:13: error: '*((void *)&n_ih+8).v' may be used uninitialized in this function [-Werror=maybe-uninitialized]
    v2->v = (v2->v & cpu_to_le64(15ULL << 60)) | cpu_to_le64(offset);
    ~~^~~
    fs/reiserfs/reiserfs.h:1279:13: error: '*((void *)&n_ih+8).v' may be used uninitialized in this function [-Werror=maybe-uninitialized]
    v2->v = (v2->v & cpu_to_le64(15ULL << 60)) | cpu_to_le64(offset);

    This happens because the offset/type pair that is stored in
    ih.key.u.k_offset_v2 is actually uninitialized when we call
    set_le_ih_k_offset() and set_le_ih_k_type(). After we have called both,
    all data is correct, but the first of the two reads uninitialized data
    for the type field and writes it back before it gets overwritten.

    This works around the warning by initializing the k_offset_v2 through
    the slightly larger memcpy().

    [JK: Remove now unused define and make it obvious we initialize the key]

    Signed-off-by: Arnd Bergmann
    Signed-off-by: Jan Kara

    Arnd Bergmann
     

28 Feb, 2017

2 commits

  • 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
     
  • See i_size_read() comments in include/linux/fs.h

    Link: http://lkml.kernel.org/r/20170123174701.30394-1-fabf@skynet.be
    Signed-off-by: Fabian Frederick
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Fabian Frederick
     

18 Dec, 2016

2 commits

  • …/linux/kernel/git/mszeredi/vfs

    Pull partial readlink cleanups from Miklos Szeredi.

    This is the uncontroversial part of the readlink cleanup patch-set that
    simplifies the default readlink handling.

    Miklos and Al are still discussing the rest of the series.

    * git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/vfs:
    vfs: make generic_readlink() static
    vfs: remove ".readlink = generic_readlink" assignments
    vfs: default to generic_readlink()
    vfs: replace calling i_op->readlink with vfs_readlink()
    proc/self: use generic_readlink
    ecryptfs: use vfs_get_link()
    bad_inode: add missing i_op initializers

    Linus Torvalds
     
  • Pull more vfs updates from Al Viro:
    "In this pile:

    - autofs-namespace series
    - dedupe stuff
    - more struct path constification"

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (40 commits)
    ocfs2: implement the VFS clone_range, copy_range, and dedupe_range features
    ocfs2: charge quota for reflinked blocks
    ocfs2: fix bad pointer cast
    ocfs2: always unlock when completing dio writes
    ocfs2: don't eat io errors during _dio_end_io_write
    ocfs2: budget for extent tree splits when adding refcount flag
    ocfs2: prohibit refcounted swapfiles
    ocfs2: add newlines to some error messages
    ocfs2: convert inode refcount test to a helper
    simple_write_end(): don't zero in short copy into uptodate
    exofs: don't mess with simple_write_{begin,end}
    9p: saner ->write_end() on failing copy into non-uptodate page
    fix gfs2_stuffed_write_end() on short copies
    fix ceph_write_end()
    nfs_write_end(): fix handling of short copies
    vfs: refactor clone/dedupe_file_range common functions
    fs: try to clone files first in vfs_copy_file_range
    vfs: misc struct path constification
    namespace.c: constify struct path passed to a bunch of primitives
    quota: constify struct path in quota_on
    ...

    Linus Torvalds
     

09 Dec, 2016

1 commit


06 Dec, 2016

1 commit


01 Nov, 2016

3 commits


11 Oct, 2016

1 commit

  • Pull more vfs updates from Al Viro:
    ">rename2() work from Miklos + current_time() from Deepa"

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
    fs: Replace current_fs_time() with current_time()
    fs: Replace CURRENT_TIME_SEC with current_time() for inode timestamps
    fs: Replace CURRENT_TIME with current_time() for inode timestamps
    fs: proc: Delete inode time initializations in proc_alloc_inode()
    vfs: Add current_time() api
    vfs: add note about i_op->rename changes to porting
    fs: rename "rename2" i_op to "rename"
    vfs: remove unused i_op->rename
    fs: make remaining filesystems use .rename2
    libfs: support RENAME_NOREPLACE in simple_rename()
    fs: support RENAME_NOREPLACE for local filesystems
    ncpfs: fix unused variable warning

    Linus Torvalds