31 May, 2019

1 commit

  • Based on 1 normalized pattern(s):

    this program is free software you can redistribute it and or modify
    it under the terms of the gnu general public license version 2 as
    published by the free software foundation 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 you should have received a copy of the gnu general
    public license along with this program if not write to free software
    foundation 51 franklin street fifth floor boston ma 02111 1301 usa

    extracted by the scancode license scanner the SPDX license identifier

    GPL-2.0-only

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

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

    Thomas Gleixner
     

03 Mar, 2019

1 commit

  • Use inode->i_lock to protect i_size_write(), else i_size_read() in
    generic_fillattr() may loop infinitely in read_seqcount_begin() when
    multiple processes invoke v9fs_vfs_getattr() or v9fs_vfs_getattr_dotl()
    simultaneously under 32-bit SMP environment, and a soft lockup will be
    triggered as show below:

    watchdog: BUG: soft lockup - CPU#5 stuck for 22s! [stat:2217]
    Modules linked in:
    CPU: 5 PID: 2217 Comm: stat Not tainted 5.0.0-rc1-00005-g7f702faf5a9e #4
    Hardware name: Generic DT based system
    PC is at generic_fillattr+0x104/0x108
    LR is at 0xec497f00
    pc : [] lr : [] psr: 200c0013
    sp : ec497e20 ip : ed608030 fp : ec497e3c
    r10: 00000000 r9 : ec497f00 r8 : ed608030
    r7 : ec497ebc r6 : ec497f00 r5 : ee5c1550 r4 : ee005780
    r3 : 0000052d r2 : 00000000 r1 : ec497f00 r0 : ed608030
    Flags: nzCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment none
    Control: 10c5387d Table: ac48006a DAC: 00000051
    CPU: 5 PID: 2217 Comm: stat Not tainted 5.0.0-rc1-00005-g7f702faf5a9e #4
    Hardware name: Generic DT based system
    Backtrace:
    [] (dump_backtrace) from [] (show_stack+0x20/0x24)
    [] (show_stack) from [] (dump_stack+0xb0/0xdc)
    [] (dump_stack) from [] (show_regs+0x1c/0x20)
    [] (show_regs) from [] (watchdog_timer_fn+0x280/0x2f8)
    [] (watchdog_timer_fn) from [] (__hrtimer_run_queues+0x18c/0x380)
    [] (__hrtimer_run_queues) from [] (hrtimer_run_queues+0xb8/0xf0)
    [] (hrtimer_run_queues) from [] (run_local_timers+0x28/0x64)
    [] (run_local_timers) from [] (update_process_times+0x3c/0x6c)
    [] (update_process_times) from [] (tick_nohz_handler+0xe0/0x1bc)
    [] (tick_nohz_handler) from [] (arch_timer_handler_virt+0x38/0x48)
    [] (arch_timer_handler_virt) from [] (handle_percpu_devid_irq+0x8c/0x240)
    [] (handle_percpu_devid_irq) from [] (generic_handle_irq+0x34/0x44)
    [] (generic_handle_irq) from [] (__handle_domain_irq+0x6c/0xc4)
    [] (__handle_domain_irq) from [] (gic_handle_irq+0x4c/0x88)
    [] (gic_handle_irq) from [] (__irq_svc+0x70/0x98)
    [] (generic_fillattr) from [] (v9fs_vfs_getattr_dotl+0x74/0xa4)
    [] (v9fs_vfs_getattr_dotl) from [] (vfs_getattr_nosec+0x68/0x7c)
    [] (vfs_getattr_nosec) from [] (vfs_getattr+0x44/0x48)
    [] (vfs_getattr) from [] (vfs_statx+0x9c/0xec)
    [] (vfs_statx) from [] (sys_lstat64+0x48/0x78)
    [] (sys_lstat64) from [] (ret_fast_syscall+0x0/0x28)

    [dominique.martinet@cea.fr: updated comment to not refer to a function
    in another subsystem]
    Link: http://lkml.kernel.org/r/20190124063514.8571-2-houtao1@huawei.com
    Cc: stable@vger.kernel.org
    Fixes: 7549ae3e81cc ("9p: Use the i_size_[read, write]() macros instead of using inode->i_size directly.")
    Reported-by: Xing Gaopeng
    Signed-off-by: Hou Tao
    Signed-off-by: Dominique Martinet

    Hou Tao
     

08 Sep, 2018

3 commits

  • the 9p client code overwrites our glock.client_id pointing to a static
    buffer by an allocated string holding the network provided value which
    we do not care about; free and reset the value as appropriate.

    This is almost identical to the leak in v9fs_file_getlock() fixed by
    Al Viro in commit ce85dd58ad5a6 ("9p: we are leaking glock.client_id
    in v9fs_file_getlock()"), which was returned as an error by a coverity
    false positive -- while we are here attempt to make the code slightly
    more robust to future change of the net/9p/client code and hopefully
    more clear to coverity that there is no problem.

    Link: http://lkml.kernel.org/r/1536339057-21974-5-git-send-email-asmadeus@codewreck.org
    Signed-off-by: Dominique Martinet

    Dominique Martinet
     
  • The default P9_LOCK_TIMEOUT can be too long for some users exporting
    a local file system to a guest VM (30s), make this configurable at
    mount time.

    Link: http://lkml.kernel.org/r/1536295827-3181-1-git-send-email-asmadeus@codewreck.org
    Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=195727
    Signed-off-by: Dinu-Razvan Chis-Serban
    Signed-off-by: Dominique Martinet

    Dinu-Razvan Chis-Serban
     
  • Replace "fallthough" with a proper "fall through" annotation.

    This fix is part of the ongoing efforts to enabling -Wimplicit-fallthrough

    Link: http://lkml.kernel.org/r/20180903193806.GA11258@embeddedor.com
    Addresses-Coverity-ID: 402012 ("Missing break in switch")
    Signed-off-by: Gustavo A. R. Silva
    Signed-off-by: Dominique Martinet

    Gustavo A. R. Silva
     

13 Aug, 2018

1 commit

  • Use new return type vm_fault_t for page_mkwrite handler.

    See 1c8f422059ae ("mm: change return type to vm_fault_t") for reference.

    Link: http://lkml.kernel.org/r/20180702154928.GA3964@jordon-HP-15-Notebook-PC
    Signed-off-by: Souptick Joarder
    Reviewed-by: Matthew Wilcox
    Acked-by: Jun Piao
    Cc: Eric Van Hensbergen
    Cc: Ron Minnich
    Cc: Latchesar Ionkov
    Signed-off-by: Andrew Morton
    Signed-off-by: Dominique Martinet

    Souptick Joarder
     

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
     

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
     

16 Jul, 2017

1 commit

  • Since commit c69899a17ca4 "NFSv4: Update of VFS byte range lock must be
    atomic with the stateid update", NFSv4 has been inserting locks in rpciod
    worker context. The result is that the file_lock's fl_nspid is the
    kworker's pid instead of the original userspace pid.

    The fl_nspid is only used to represent the namespaced virtual pid number
    when displaying locks or returning from F_GETLK. There's no reason to set
    it for every inserted lock, since we can usually just look it up from
    fl_pid. So, instead of looking up and holding struct pid for every lock,
    let's just look up the virtual pid number from fl_pid when it is needed.
    That means we can remove fl_nspid entirely.

    The translaton and presentation of fl_pid should handle the following four
    cases:

    1 - F_GETLK on a remote file with a remote lock:
    In this case, the filesystem should determine the l_pid to return here.
    Filesystems should indicate that the fl_pid represents a non-local pid
    value that should not be translated by returning an fl_pid
    Signed-off-by: Jeff Layton

    Benjamin Coddington
     

25 Feb, 2017

1 commit

  • ->fault(), ->page_mkwrite(), and ->pfn_mkwrite() calls do not need to
    take a vma and vmf parameter when the vma already resides in vmf.

    Remove the vma parameter to simplify things.

    [arnd@arndb.de: fix ARM build]
    Link: http://lkml.kernel.org/r/20170125223558.1451224-1-arnd@arndb.de
    Link: http://lkml.kernel.org/r/148521301778.19116.10840599906674778980.stgit@djiang5-desk3.ch.intel.com
    Signed-off-by: Dave Jiang
    Signed-off-by: Arnd Bergmann
    Reviewed-by: Ross Zwisler
    Cc: Theodore Ts'o
    Cc: Darrick J. Wong
    Cc: Matthew Wilcox
    Cc: Dave Hansen
    Cc: Christoph Hellwig
    Cc: Jan Kara
    Cc: Dan Williams
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Dave Jiang
     

25 Dec, 2016

1 commit


01 Jul, 2016

1 commit

  • v9fs may be used as lower layer of overlayfs and accessing f_path.dentry
    can lead to a crash. In this case it's a NULL pointer dereference in
    p9_fid_create().

    Fix by replacing direct access of file->f_path.dentry with the
    file_dentry() accessor, which will always return a native object.

    Reported-by: Alessio Igor Bogani
    Signed-off-by: Miklos Szeredi
    Tested-by: Alessio Igor Bogani
    Fixes: 4bacc9c9234c ("overlayfs: Make f_path always point to the overlay and f_inode to the underlay")
    Cc:
    Signed-off-by: Al Viro

    Miklos Szeredi
     

05 Apr, 2016

1 commit

  • PAGE_CACHE_{SIZE,SHIFT,MASK,ALIGN} macros were introduced *long* time
    ago with promise that one day it will be possible to implement page
    cache with bigger chunks than PAGE_SIZE.

    This promise never materialized. And unlikely will.

    We have many places where PAGE_CACHE_SIZE assumed to be equal to
    PAGE_SIZE. And it's constant source of confusion on whether
    PAGE_CACHE_* or PAGE_* constant should be used in a particular case,
    especially on the border between fs and mm.

    Global switching to PAGE_CACHE_SIZE != PAGE_SIZE would cause to much
    breakage to be doable.

    Let's stop pretending that pages in page cache are special. They are
    not.

    The changes are pretty straight-forward:

    - << (PAGE_CACHE_SHIFT - PAGE_SHIFT) -> ;

    - >> (PAGE_CACHE_SHIFT - PAGE_SHIFT) -> ;

    - PAGE_CACHE_{SIZE,SHIFT,MASK,ALIGN} -> PAGE_{SIZE,SHIFT,MASK,ALIGN};

    - page_cache_get() -> get_page();

    - page_cache_release() -> put_page();

    This patch contains automated changes generated with coccinelle using
    script below. For some reason, coccinelle doesn't patch header files.
    I've called spatch for them manually.

    The only adjustment after coccinelle is revert of changes to
    PAGE_CAHCE_ALIGN definition: we are going to drop it later.

    There are few places in the code where coccinelle didn't reach. I'll
    fix them manually in a separate patch. Comments and documentation also
    will be addressed with the separate patch.

    virtual patch

    @@
    expression E;
    @@
    - E << (PAGE_CACHE_SHIFT - PAGE_SHIFT)
    + E

    @@
    expression E;
    @@
    - E >> (PAGE_CACHE_SHIFT - PAGE_SHIFT)
    + E

    @@
    @@
    - PAGE_CACHE_SHIFT
    + PAGE_SHIFT

    @@
    @@
    - PAGE_CACHE_SIZE
    + PAGE_SIZE

    @@
    @@
    - PAGE_CACHE_MASK
    + PAGE_MASK

    @@
    expression E;
    @@
    - PAGE_CACHE_ALIGN(E)
    + PAGE_ALIGN(E)

    @@
    expression E;
    @@
    - page_cache_get(E)
    + get_page(E)

    @@
    expression E;
    @@
    - page_cache_release(E)
    + put_page(E)

    Signed-off-by: Kirill A. Shutemov
    Acked-by: Michal Hocko
    Signed-off-by: Linus Torvalds

    Kirill A. Shutemov
     

23 Jan, 2016

1 commit

  • parallel to mutex_{lock,unlock,trylock,is_locked,lock_nested},
    inode_foo(inode) being mutex_foo(&inode->i_mutex).

    Please, use those for access to ->i_mutex; over the coming cycle
    ->i_mutex will become rwsem, with ->lookup() done with it held
    only shared.

    Signed-off-by: Al Viro

    Al Viro
     

06 Nov, 2015

2 commits

  • Merge patch-bomb from Andrew Morton:

    - inotify tweaks

    - some ocfs2 updates (many more are awaiting review)

    - various misc bits

    - kernel/watchdog.c updates

    - Some of mm. I have a huge number of MM patches this time and quite a
    lot of it is quite difficult and much will be held over to next time.

    * emailed patches from Andrew Morton : (162 commits)
    selftests: vm: add tests for lock on fault
    mm: mlock: add mlock flags to enable VM_LOCKONFAULT usage
    mm: introduce VM_LOCKONFAULT
    mm: mlock: add new mlock system call
    mm: mlock: refactor mlock, munlock, and munlockall code
    kasan: always taint kernel on report
    mm, slub, kasan: enable user tracking by default with KASAN=y
    kasan: use IS_ALIGNED in memory_is_poisoned_8()
    kasan: Fix a type conversion error
    lib: test_kasan: add some testcases
    kasan: update reference to kasan prototype repo
    kasan: move KASAN_SANITIZE in arch/x86/boot/Makefile
    kasan: various fixes in documentation
    kasan: update log messages
    kasan: accurately determine the type of the bad access
    kasan: update reported bug types for kernel memory accesses
    kasan: update reported bug types for not user nor kernel memory accesses
    mm/kasan: prevent deadlock in kasan reporting
    mm/kasan: don't use kasan shadow pointer in generic functions
    mm/kasan: MODULE_VADDR is not available on all archs
    ...

    Linus Torvalds
     
  • If the remote locking fail, we run a local vfs unlock that should work and
    return success to userland when we didn't actually lock at all. We need
    to tell the application that tried to lock that it didn't get it, not that
    all went well.

    Signed-off-by: Dominique Martinet
    Cc: Eric Van Hensbergen
    Cc: Ron Minnich
    Cc: Latchesar Ionkov
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Dominique Martinet
     

23 Oct, 2015

1 commit


24 Aug, 2015

1 commit

  • When reading 0 bytes from an empty file on a 9P filesystem, the return
    code of read() was not 0 as expected due to an unitialized err variable.

    Tested with this simple program:

    #include
    #include
    #include
    #include
    #include

    int main(int argc, const char **argv)
    {
    assert(argc == 2);
    char buffer[256];
    int fd = open(argv[1], O_RDONLY|O_NOCTTY);
    assert(fd >= 0);
    assert(read(fd, buffer, 0) == 0);
    return 0;
    }

    Signed-off-by: Vincent Bernat
    Signed-off-by: Eric Van Hensbergen

    Vincent Bernat
     

19 Apr, 2015

1 commit

  • Pull 9pfs updates from Eric Van Hensbergen:
    "Some accumulated cleanup patches for kerneldoc and unused variables as
    well as some lock bug fixes and adding privateport option for RDMA"

    * tag 'for-linus-4.1-merge-window' of git://git.kernel.org/pub/scm/linux/kernel/git/ericvh/v9fs:
    net/9p: add a privport option for RDMA transport.
    fs/9p: Initialize status in v9fs_file_do_lock.
    net/9p: Initialize opts->privport as it should be.
    net/9p: use memcpy() instead of snprintf() in p9_mount_tag_show()
    9p: use unsigned integers for nwqid/count
    9p: do not crash on unknown lock status code
    9p: fix error handling in v9fs_file_do_lock
    9p: remove unused variable in p9_fd_create()
    9p: kerneldoc warning fixes

    Linus Torvalds
     

12 Apr, 2015

10 commits


22 Mar, 2015

1 commit

  • If p9_client_lock_dotl returns an error, status is possibly never filled
    but will be used in the following switch.
    Initializing it to P9_LOCK_ERROR makes sur we will return an error and
    cleanup (and not hit the default case).

    Signed-off-by: Dominique Martinet
    Signed-off-by: Eric Van Hensbergen

    Dominique Martinet
     

20 Mar, 2015

2 commits

  • Current 9p implementation will crash whole system if sees unknown lock
    status code. It's trivial target for DOS: 9p server can produce such
    code easily.

    Let's fallback more gracefully: warning in dmesg + -ENOLCK.

    Signed-off-by: Kirill A. Shutemov
    Signed-off-by: Dominique Martinet
    Signed-off-by: Eric Van Hensbergen

    Kirill A. Shutemov
     
  • p9_client_lock_dotl() doesn't set status if p9_client_rpc() fails.
    It can lead to 'default:' case in switch below and kernel crashes.

    Let's bypass the switch if p9_client_lock_dotl() fails.

    Signed-off-by: Kirill A. Shutemov
    Signed-off-by: Dominique Martinet
    Signed-off-by: Eric Van Hensbergen

    Kirill A. Shutemov
     

11 Feb, 2015

1 commit


09 Oct, 2014

1 commit


13 Jun, 2014

1 commit

  • Pull vfs updates from Al Viro:
    "This the bunch that sat in -next + lock_parent() fix. This is the
    minimal set; there's more pending stuff.

    In particular, I really hope to get acct.c fixes merged this cycle -
    we need that to deal sanely with delayed-mntput stuff. In the next
    pile, hopefully - that series is fairly short and localized
    (kernel/acct.c, fs/super.c and fs/namespace.c). In this pile: more
    iov_iter work. Most of prereqs for ->splice_write with sane locking
    order are there and Kent's dio rewrite would also fit nicely on top of
    this pile"

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (70 commits)
    lock_parent: don't step on stale ->d_parent of all-but-freed one
    kill generic_file_splice_write()
    ceph: switch to iter_file_splice_write()
    shmem: switch to iter_file_splice_write()
    nfs: switch to iter_splice_write_file()
    fs/splice.c: remove unneeded exports
    ocfs2: switch to iter_file_splice_write()
    ->splice_write() via ->write_iter()
    bio_vec-backed iov_iter
    optimize copy_page_{to,from}_iter()
    bury generic_file_aio_{read,write}
    lustre: get rid of messing with iovecs
    ceph: switch to ->write_iter()
    ceph_sync_direct_write: stop poking into iov_iter guts
    ceph_sync_read: stop poking into iov_iter guts
    new helper: copy_page_from_iter()
    fuse: switch to ->write_iter()
    btrfs: switch to ->write_iter()
    ocfs2: switch to ->write_iter()
    xfs: switch to ->write_iter()
    ...

    Linus Torvalds
     

05 Jun, 2014

1 commit


02 Jun, 2014

1 commit

  • Currently, the fl_owner isn't set for flock locks. Some filesystems use
    byte-range locks to simulate flock locks and there is a common idiom in
    those that does:

    fl->fl_owner = (fl_owner_t)filp;
    fl->fl_start = 0;
    fl->fl_end = OFFSET_MAX;

    Since flock locks are generally "owned" by the open file description,
    move this into the common flock lock setup code. The fl_start and fl_end
    fields are already set appropriately, so remove the unneeded setting of
    that in flock ops in those filesystems as well.

    Finally, the lease code also sets the fl_owner as if they were owned by
    the process and not the open file description. This is incorrect as
    leases have the same ownership semantics as flock locks. Set them the
    same way. The lease code doesn't actually use the fl_owner value for
    anything, so this is more for consistency's sake than a bugfix.

    Reported-by: Trond Myklebust
    Signed-off-by: Jeff Layton
    Acked-by: Greg Kroah-Hartman (Staging portion)
    Acked-by: J. Bruce Fields

    Jeff Layton
     

07 May, 2014

2 commits


08 Apr, 2014

1 commit

  • filemap_map_pages() is generic implementation of ->map_pages() for
    filesystems who uses page cache.

    It should be safe to use filemap_map_pages() for ->map_pages() if
    filesystem use filemap_fault() for ->fault().

    Signed-off-by: Kirill A. Shutemov
    Acked-by: Linus Torvalds
    Cc: Mel Gorman
    Cc: Rik van Riel
    Cc: Andi Kleen
    Cc: Matthew Wilcox
    Cc: Dave Hansen
    Cc: Alexander Viro
    Cc: Dave Chinner
    Cc: Ning Qu
    Cc: Hugh Dickins
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Kirill A. Shutemov