1. 19 Nov, 2019 1 commit
    • Bob Peterson's avatar
      gfs2: clean up iopen glock mess in gfs2_create_inode · 2c47c1be
      Bob Peterson authored
      Before this patch, gfs2_create_inode had a use-after-free for the
      iopen glock in some error paths because it did this:
      
      	gfs2_glock_put(io_gl);
      fail_gunlock2:
      	if (io_gl)
      		clear_bit(GLF_INODE_CREATING, &io_gl->gl_flags);
      
      In some cases, the io_gl was used for create and only had one
      reference, so the glock might be freed before the clear_bit().
      This patch tries to straighten it out by only jumping to the
      error paths where iopen is properly set, and moving the
      gfs2_glock_put after the clear_bit.
      Signed-off-by: default avatarBob Peterson <rpeterso@redhat.com>
      Signed-off-by: default avatarAndreas Gruenbacher <agruenba@redhat.com>
      2c47c1be
  2. 15 Nov, 2019 2 commits
    • Bob Peterson's avatar
      gfs2: Close timing window with GLF_INVALIDATE_IN_PROGRESS · d99724c3
      Bob Peterson authored
      This patch closes a timing window in which two processes compete
      and overlap in the execution of do_xmote for the same glock:
      
                   Process A                              Process B
         ------------------------------------   -----------------------------
      1. Grabs gl_lockref and calls do_xmote
      2.                                        Grabs gl_lockref but is blocked
      3. Sets GLF_INVALIDATE_IN_PROGRESS
      4. Unlocks gl_lockref
      5.                                        Calls do_xmote
      6. Call glops->go_sync
      7. test_and_clear_bit GLF_DIRTY
      8. Call gfs2_log_flush                    Call glops->go_sync
      9. (slow IO, so it blocks a long time)    test_and_clear_bit GLF_DIRTY
                                                It's not dirty (step 7) returns
      10.                                       Tests GLF_INVALIDATE_IN_PROGRESS
      11.                                       Calls go_inval (rgrp_go_inval)
      12.                                       gfs2_rgrp_relse does brelse
      13.                                       truncate_inode_pages_range
      14.                                       Calls lm_lock UN
      
      In step 14 we've just told dlm to give the glock to another node
      when, in fact, process A has not finished the IO and synced all
      buffer_heads to disk and make sure their revokes are done.
      
      This patch fixes the problem by changing the GLF_INVALIDATE_IN_PROGRESS
      to use test_and_set_bit, and if the bit is already set, process B just
      ignores it and trusts that process A will do the do_xmote in the proper
      order.
      Signed-off-by: default avatarBob Peterson <rpeterso@redhat.com>
      Signed-off-by: default avatarAndreas Gruenbacher <agruenba@redhat.com>
      d99724c3
    • Bob Peterson's avatar
      gfs2: Abort gfs2_freeze if io error is seen · 52b1cdcb
      Bob Peterson authored
      Before this patch, an io error, such as -EIO writing to the journal
      would cause function gfs2_freeze to go into an infinite loop,
      continuously retrying the freeze operation. But nothing ever clears
      the -EIO except unmount after withdraw, which is impossible if the
      freeze operation never ends (fails). Instead you get:
      
      [ 6499.767994] gfs2: fsid=dm-32.0: error freezing FS: -5
      [ 6499.773058] gfs2: fsid=dm-32.0: retrying...
      [ 6500.791957] gfs2: fsid=dm-32.0: error freezing FS: -5
      [ 6500.797015] gfs2: fsid=dm-32.0: retrying...
      
      This patch adds a check for -EIO in gfs2_freeze, and if seen, it
      dequeues the freeze glock, aborts the loop and returns the error.
      Also, there's no need to pass the freeze holder to function
      gfs2_lock_fs_check_clean since it's only called in one place and
      it's a well-known superblock pointer, so this simplifies that.
      Signed-off-by: default avatarBob Peterson <rpeterso@redhat.com>
      Signed-off-by: default avatarAndreas Gruenbacher <agruenba@redhat.com>
      52b1cdcb
  3. 14 Nov, 2019 5 commits
  4. 12 Nov, 2019 1 commit
    • Andreas Gruenbacher's avatar
      gfs2: Remove active journal side effect from gfs2_write_log_header · 19ebc050
      Andreas Gruenbacher authored
      Function gfs2_write_log_header can be used to write a log header into any of
      the journals of a filesystem.  When used on the node's own journal,
      gfs2_write_log_header advances the current position in the log
      (sdp->sd_log_flush_head) as a side effect, through function gfs2_log_bmap.
      
      This is confusing, and it also means that we can't use gfs2_log_bmap for other
      journals even if they have an extent map.  So clean this mess up by not
      advancing sdp->sd_log_flush_head in gfs2_write_log_header or gfs2_log_bmap
      anymore and making that a responsibility of the callers instead.
      
      This is related to commit 7c70b896 ("gfs2: clean_journal improperly set
      sd_log_flush_head").
      Signed-off-by: default avatarAndreas Gruenbacher <agruenba@redhat.com>
      19ebc050
  5. 07 Nov, 2019 3 commits
    • Andreas Gruenbacher's avatar
      gfs2: Fix end-of-file handling in gfs2_page_mkwrite · 184b4e60
      Andreas Gruenbacher authored
      When the filesystem block size is smaller than the page size, the last
      page may contain blocks that lie entirely beyond the end of the file.
      Make sure to only allocate blocks that lie at least partially in the
      file.  Allocating blocks beyond that isn't useful, and what's more, they
      will not be zeroed out and may end up containing random data.
      
      With that change in place, make sure we'll still always unstuff stuffed
      inodes: iomap_writepage and iomap_writepages currently can't handle
      stuffed files.
      
      In addition, simplify and move the end-of-file check further to the top
      in gfs2_page_mkwrite to avoid weird side effects like unstuffing when
      we're not.
      
      Fixes xfstest generic/263.
      Signed-off-by: default avatarAndreas Gruenbacher <agruenba@redhat.com>
      184b4e60
    • Andreas Gruenbacher's avatar
      gfs2: Multi-block allocations in gfs2_page_mkwrite · f53056c4
      Andreas Gruenbacher authored
      In gfs2_page_mkwrite's gfs2_allocate_page_backing helper, try to
      allocate as many blocks at once as we need.  Pass in the size of the
      requested allocation.
      
      Fixes: 35af80ae ("gfs2: don't use buffer_heads in gfs2_allocate_page_backing")
      Cc: stable@vger.kernel.org # v5.3+
      Signed-off-by: default avatarAndreas Gruenbacher <agruenba@redhat.com>
      f53056c4
    • Andreas Gruenbacher's avatar
      gfs2: Improve mmap write vs. punch_hole consistency · 39c3a948
      Andreas Gruenbacher authored
      When punching a hole in a file, use filemap_write_and_wait_range to
      write back any dirty pages in the range of the hole.  As a side effect,
      if the hole isn't page aligned, this marks unaligned pages at the
      beginning and the end of the hole read-only.  This is required when the
      block size is smaller than the page size: when those pages are written
      to again after the hole punching, we must make sure that page_mkwrite is
      called for those pages so that the page will be fully allocated and any
      blocks turned into holes from the hole punching will be reallocated.
      (If a page is writably mapped, page_mkwrite won't be called.)
      
      Fixes xfstest generic/567.
      Signed-off-by: default avatarAndreas Gruenbacher <agruenba@redhat.com>
      39c3a948
  6. 30 Oct, 2019 4 commits
  7. 27 Oct, 2019 7 commits
    • Linus Torvalds's avatar
      Linux 5.4-rc5 · d6d5df1d
      Linus Torvalds authored
      d6d5df1d
    • Linus Torvalds's avatar
      Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 153a971f
      Linus Torvalds authored
      Pull x86 fixes from Thomas Gleixner:
       "Two fixes for the VMWare guest support:
      
         - Unbreak VMWare platform detection which got wreckaged by converting
           an integer constant to a string constant.
      
         - Fix the clang build of the VMWAre hypercall by explicitely
           specifying the ouput register for INL instead of using the short
           form"
      
      * 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/cpu/vmware: Fix platform detection VMWARE_PORT macro
        x86/cpu/vmware: Use the full form of INL in VMWARE_HYPERCALL, for clang/llvm
      153a971f
    • Linus Torvalds's avatar
      Merge branch 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 2b776b54
      Linus Torvalds authored
      Pull timer fixes from Thomas Gleixner:
       "A small set of fixes for time(keeping):
      
         - Add a missing include to prevent compiler warnings.
      
         - Make the VDSO implementation of clock_getres() POSIX compliant
           again. A recent change dropped the NULL pointer guard which is
           required as NULL is a valid pointer value for this function.
      
         - Fix two function documentation typos"
      
      * 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        posix-cpu-timers: Fix two trivial comments
        timers/sched_clock: Include local timekeeping.h for missing declarations
        lib/vdso: Make clock_getres() POSIX compliant again
      2b776b54
    • Linus Torvalds's avatar
      Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · a8a31fdc
      Linus Torvalds authored
      Pull perf fixes from Thomas Gleixner:
       "A set of perf fixes:
      
        kernel:
      
         - Unbreak the tracking of auxiliary buffer allocations which got
           imbalanced causing recource limit failures.
      
         - Fix the fallout of splitting of ToPA entries which missed to shift
           the base entry PA correctly.
      
         - Use the correct context to lookup the AUX event when unmapping the
           associated AUX buffer so the event can be stopped and the buffer
           reference dropped.
      
        tools:
      
         - Fix buildiid-cache mode setting in copyfile_mode_ns() when copying
           /proc/kcore
      
         - Fix freeing id arrays in the event list so the correct event is
           closed.
      
         - Sync sched.h anc kvm.h headers with the kernel sources.
      
         - Link jvmti against tools/lib/ctype.o to have weak strlcpy().
      
         - Fix multiple memory and file descriptor leaks, found by coverity in
           perf annotate.
      
         - Fix leaks in error handling paths in 'perf c2c', 'perf kmem', found
           by a static analysis tool"
      
      * 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        perf/aux: Fix AUX output stopping
        perf/aux: Fix tracking of auxiliary trace buffer allocation
        perf/x86/intel/pt: Fix base for single entry topa
        perf kmem: Fix memory leak in compact_gfp_flags()
        tools headers UAPI: Sync sched.h with the kernel
        tools headers kvm: Sync kvm.h headers with the kernel sources
        tools headers kvm: Sync kvm headers with the kernel sources
        tools headers kvm: Sync kvm headers with the kernel sources
        perf c2c: Fix memory leak in build_cl_output()
        perf tools: Fix mode setting in copyfile_mode_ns()
        perf annotate: Fix multiple memory and file descriptor leaks
        perf tools: Fix resource leak of closedir() on the error paths
        perf evlist: Fix fix for freed id arrays
        perf jvmti: Link against tools/lib/ctype.h to have weak strlcpy()
      a8a31fdc
    • Linus Torvalds's avatar
      Merge branch 'irq-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 1e1ac1cb
      Linus Torvalds authored
      Pull irq fixes from Thomas Gleixner:
       "Two fixes for interrupt controller drivers:
      
         - Skip IRQ_M_EXT entries in the device tree when initializing the
           RISCV PLIC controller to avoid a double init attempt.
      
         - Use the correct ITS list when issuing the VMOVP synchronization
           command so the operation works only on the ITS instances which are
           associated to a VM"
      
      * 'irq-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        irqchip/sifive-plic: Skip contexts except supervisor in plic_init()
        irqchip/gic-v3-its: Use the exact ITSList for VMOVP
      1e1ac1cb
    • Linus Torvalds's avatar
      Merge tag '5.4-rc5-smb3-fixes' of git://git.samba.org/sfrench/cifs-2.6 · c9a2e4a8
      Linus Torvalds authored
      Pull cifs fixes from Steve French:
       "Seven cifs/smb3 fixes, including three for stable"
      
      * tag '5.4-rc5-smb3-fixes' of git://git.samba.org/sfrench/cifs-2.6:
        cifs: Fix cifsInodeInfo lock_sem deadlock when reconnect occurs
        CIFS: Fix use after free of file info structures
        CIFS: Fix retry mid list corruption on reconnects
        cifs: Fix missed free operations
        CIFS: avoid using MID 0xFFFF
        cifs: clarify comment about timestamp granularity for old servers
        cifs: Handle -EINPROGRESS only when noblockcnt is set
      c9a2e4a8
    • Linus Torvalds's avatar
      Merge tag 'riscv/for-v5.4-rc5-b' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux · 6995a6a5
      Linus Torvalds authored
      Pull RISC-V fixes from Paul Walmsley:
       "Several minor fixes and cleanups for v5.4-rc5:
      
         - Three build fixes for various SPARSEMEM-related kernel
           configurations
      
         - Two cleanup patches for the kernel bug and breakpoint trap handler
           code"
      
      * tag 'riscv/for-v5.4-rc5-b' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux:
        riscv: cleanup do_trap_break
        riscv: cleanup <asm/bug.h>
        riscv: Fix undefined reference to vmemmap_populate_basepages
        riscv: Fix implicit declaration of 'page_to_section'
        riscv: fix fs/proc/kcore.c compilation with sparsemem enabled
      6995a6a5
  8. 26 Oct, 2019 13 commits
  9. 25 Oct, 2019 4 commits