Skip to content
  1. Mar 15, 2017
  2. Mar 11, 2017
  3. Mar 10, 2017
    • Shaohua Li's avatar
      md/raid1/10: fix potential deadlock · 61eb2b43
      Shaohua Li authored
      
      
      Neil Brown pointed out a potential deadlock in raid 10 code with
      bio_split/chain. The raid1 code could have the same issue, but recent
      barrier rework makes it less likely to happen. The deadlock happens in
      below sequence:
      
      1. generic_make_request(bio), this will set current->bio_list
      2. raid10_make_request will split bio to bio1 and bio2
      3. __make_request(bio1), wait_barrer, add underlayer disk bio to
      current->bio_list
      4. __make_request(bio2), wait_barrer
      
      If raise_barrier happens between 3 & 4, since wait_barrier runs at 3,
      raise_barrier waits for IO completion from 3. And since raise_barrier
      sets barrier, 4 waits for raise_barrier. But IO from 3 can't be
      dispatched because raid10_make_request() doesn't finished yet.
      
      The solution is to adjust the IO ordering. Quotes from Neil:
      "
      It is much safer to:
      
          if (need to split) {
              split = bio_split(bio, ...)
              bio_chain(...)
              make_request_fn(split);
              generic_make_request(bio);
         } else
              make_request_fn(mddev, bio);
      
      This way we first process the initial section of the bio (in 'split')
      which will queue some requests to the underlying devices.  These
      requests will be queued in generic_make_request.
      Then we queue the remainder of the bio, which will be added to the end
      of the generic_make_request queue.
      Then we return.
      generic_make_request() will pop the lower-level device requests off the
      queue and handle them first.  Then it will process the remainder
      of the original bio once the first section has been fully processed.
      "
      
      Note, this only happens in read path. In write path, the bio is flushed to
      underlaying disks either by blk flush (from schedule) or offladed to raid1/10d.
      It's queued in current->bio_list.
      
      Cc: Coly Li <colyli@suse.de>
      Cc: stable@vger.kernel.org (v3.14+, only the raid10 part)
      Suggested-by: default avatarNeilBrown <neilb@suse.com>
      Reviewed-by: default avatarJack Wang <jinpu.wang@profitbricks.com>
      Signed-off-by: default avatarShaohua Li <shli@fb.com>
      61eb2b43
    • NeilBrown's avatar
      md: don't impose the MD_SB_DISKS limit on arrays without metadata. · 1b3bae49
      NeilBrown authored
      
      
      These arrays, created with "mdadm --build" don't benefit from a limit.
      The default will be used, which is '0' and is interpreted as "don't
      impose a limit".
      
      Reported-by: default avatar <ian_bruce@mail.ru>
      Signed-off-by: default avatarNeilBrown <neilb@suse.com>
      Signed-off-by: default avatarShaohua Li <shli@fb.com>
      1b3bae49
    • Guoqing Jiang's avatar
      md: move funcs from pers->resize to update_size · c9483634
      Guoqing Jiang authored
      
      
      raid1_resize and raid5_resize should also check the
      mddev->queue if run underneath dm-raid.
      
      And both set_capacity and revalidate_disk are used in
      pers->resize such as raid1, raid10 and raid5. So
      move them from personality file to common code.
      
      Reviewed-by: default avatarNeilBrown <neilb@suse.com>
      Signed-off-by: default avatarGuoqing Jiang <gqjiang@suse.com>
      Signed-off-by: default avatarShaohua Li <shli@fb.com>
      c9483634
    • Guoqing Jiang's avatar
      md-cluster: remove useless memset from gather_all_resync_info · 75df023f
      Guoqing Jiang authored
      
      
      This memset is not needed.  The lvb is already zeroed because
      it was recently allocated by lockres_init, which uses kzalloc(),
      and read_resync_info() doesn't need it to be zero anyway.
      
      Reviewed-by: default avatarNeilBrown <neilb@suse.com>
      Signed-off-by: default avatarGuoqing Jiang <gqjiang@suse.com>
      Signed-off-by: default avatarShaohua Li <shli@fb.com>
      75df023f
    • Guoqing Jiang's avatar
      md-cluster: free md_cluster_info if node leave cluster · 9c8043f3
      Guoqing Jiang authored
      
      
      To avoid memory leak, we need to free the cinfo which
      is allocated when node join cluster.
      
      Reviewed-by: default avatarNeilBrown <neilb@suse.com>
      Signed-off-by: default avatarGuoqing Jiang <gqjiang@suse.com>
      Signed-off-by: default avatarShaohua Li <shli@fb.com>
      9c8043f3
    • Shaohua Li's avatar
      md: delete dead code · 99b3d74e
      Shaohua Li authored
      
      
      Nobody is using mddev_check_plugged(), so delete the dead code
      
      Signed-off-by: default avatarShaohua Li <shli@fb.com>
      99b3d74e
    • Shaohua Li's avatar
      md/raid10: submit bio directly to replacement disk · 6d399783
      Shaohua Li authored
      Commit 57c67df4
      
      (md/raid10: submit IO from originating thread instead of
      md thread) submits bio directly for normal disks but not for replacement
      disks. There is no point we shouldn't do this for replacement disks.
      
      Cc: NeilBrown <neilb@suse.com>
      Signed-off-by: default avatarShaohua Li <shli@fb.com>
      6d399783
  4. Mar 09, 2017
    • Linus Torvalds's avatar
      Merge branch 'core-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · ea6200e8
      Linus Torvalds authored
      Pull sched.h split-up fixes for MIPS from Ingo Molnar:
       "These are the fixes for MIPS build failures due to the sched.h
        split-up, from Arnd Bergmann"
      
      * 'core-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        MIPS: Add missing include files
      ea6200e8
    • Tony Luck's avatar
      mm, page_alloc: Add missing check for memory holes · b4fb8f66
      Tony Luck authored
      Commit 13ad59df ("mm, page_alloc: avoid page_to_pfn() when merging
      buddies") moved the check for memory holes out of page_is_buddy() and
      had the callers do the check.
      
      But this wasn't done correctly in one place which caused ia64 to crash
      very early in boot.
      
      Update to fix that and make ia64 boot again.
      
      [ v2: Vlastimil pointed out we don't need to call page_to_pfn()
            since we already have the result of that in "buddy_pfn" ]
      
      Fixes: 13ad59df
      
       ("avoid page_to_pfn() when merging buddies")
      Cc: Mel Gorman <mgorman@techsingularity.net>
      Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
      Cc: Michal Hocko <mhocko@kernel.org>
      Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarTony Luck <tony.luck@intel.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      b4fb8f66
    • Linus Torvalds's avatar
      Merge tag 'ktest-v4.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-ktest · 8557b8e4
      Linus Torvalds authored
      Pull ktest fixes from Steven Rostedt:
       "Greg Kroah-Hartman reported to me that the ktest of v4.11-rc1 locked
        up in an infinite loop while doing the make mrproper.
      
        Looking into the cause I noticed that a recent update to the function
        run_command (used for running all shell commands, including "make
        mrproper") changed the internal loop to use the function
        wait_for_input.
      
        The wait_for_input function uses select to look at two file
        descriptors. One is the file descriptor of the command it is running,
        the other is STDIN. The STDIN check was not checking the return status
        of the sysread call, and was also just writing a lot of data into
        syswrite without regard to the size of the data read.
      
        Changing the code to check the return status of sysread, and also to
        still process the passed in descriptor data without looping back to
        the select fixed Greg's problem.
      
        While looking at this code I also realized that the loop did not honor
        the timeout if STDIN always had input (or for some reason return
        error). this could prevent wait_for_input to timeout on the file
        descriptor it is suppose to be waiting for. That is fixed too"
      
      * tag 'ktest-v4.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-ktest:
        ktest: Make sure wait_for_input does honor the timeout
        ktest: Fix while loop in wait_for_input
      8557b8e4
    • Linus Torvalds's avatar
      overlayfs: remove now unnecessary header file include · 04bb94b1
      Linus Torvalds authored
      This removes the extra include header file that was added in commit
      e58bc927
      
       "Pull overlayfs updates from Miklos Szeredi" now that it
      is no longer needed.
      
      There are probably other such includes that got added during the
      scheduler header splitup series, but this is the one that annoyed me
      personally and I know about.
      
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      04bb94b1
    • Linus Torvalds's avatar
      sched/headers: fix up header file dependency on <linux/sched/signal.h> · bd0f9b35
      Linus Torvalds authored
      The scheduler header file split and cleanups ended up exposing a few
      nasty header file dependencies, and in particular it showed how we in
      <linux/wait.h> ended up depending on "signal_pending()", which now comes
      from <linux/sched/signal.h>.
      
      That's a very subtle and annoying dependency, which already caused a
      semantic merge conflict (see commit e58bc927
      
       "Pull overlayfs updates
      from Miklos Szeredi", which added that fixup in the merge commit).
      
      It turns out that we can avoid this dependency _and_ improve code
      generation by moving the guts of the fairly nasty helper #define
      __wait_event_interruptible_locked() to out-of-line code.  The code that
      includes the signal_pending() check is all in the slow-path where we
      actually go to sleep waiting for the event anyway, so using a helper
      function is the right thing to do.
      
      Using a helper function is also what we already did for the non-locked
      versions, see the "__wait_event*()" macros and the "prepare_to_wait*()"
      set of helper functions.
      
      We might want to try to unify all these macro games, we have a _lot_ of
      subtly different wait-event loops.  But this is the minimal patch to fix
      the annoying header dependency.
      
      Acked-by: default avatarIngo Molnar <mingo@kernel.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      bd0f9b35
  5. Mar 08, 2017
    • Steven Rostedt (VMware)'s avatar
      ktest: Make sure wait_for_input does honor the timeout · f7c6401f
      Steven Rostedt (VMware) authored
      
      
      The function wait_for_input takes in a timeout, and even has a default
      timeout. But if for some reason the STDIN descriptor keeps sending in data,
      the function will never time out. The timout is to wait for the data from
      the passed in file descriptor, not for STDIN. Adding a test in the case
      where there's no data from the passed in file descriptor that checks to see
      if the timeout passed, will ensure that it will timeout properly even if
      there's input in STDIN.
      
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      f7c6401f
    • Steven Rostedt (VMware)'s avatar
      ktest: Fix while loop in wait_for_input · 99c014a8
      Steven Rostedt (VMware) authored
      
      
      The run_command function was changed to use the wait_for_input function to
      allow having a timeout if the command to run takes too much time. There was
      a bug in the wait_for_input where it could end up going into an infinite
      loop. There's two issues here. One is that the return value of the sysread
      wasn't used for the write (to write a proper size), and that it should
      continue processing the passed in file descriptor too even if there was
      input. There was no check for error, if for some reason STDIN returned an
      error, the function would go into an infinite loop and never exit.
      
      Reported-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Tested-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Fixes: 6e98d1b4
      
       ("ktest: Add timeout to ssh command")
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      99c014a8
    • Arnd Bergmann's avatar
      MIPS: Add missing include files · fc69910f
      Arnd Bergmann authored
      
      
      After the split of linux/sched.h, several platforms in arch/mips stopped building.
      
      Add the respective additional #include statements to fix the problem I first
      tried adding these into asm/processor.h, but ran into circular header
      dependencies with that which I could not figure out.
      
      The commit I listed as causing the problem is the branch merge, as there is
      likely a combination of multiple patches in that branch.
      
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: linux-mips@linux-mips.org
      Cc: ralf@linux-mips.org
      Fixes: 1827adb1
      
       ("Merge branch 'WIP.sched-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip")
      Link: http://lkml.kernel.org/r/20170308072931.3836696-1-arnd@arndb.de
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      fc69910f
    • Linus Torvalds's avatar
      Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · ec3b93ae
      Linus Torvalds authored
      Pull x86 fixes from Ingo Molnar:
       "Misc fixes and minor updates all over the place:
      
         - an SGI/UV fix
         - a defconfig update
         - a build warning fix
         - move the boot_params file to the arch location in debugfs
         - a pkeys fix
         - selftests fix
         - boot message fixes
         - sparse fixes
         - a resume warning fix
         - ioapic hotplug fixes
         - reboot quirks
      
        ... plus various minor cleanups"
      
      * 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/build/x86_64_defconfig: Enable CONFIG_R8169
        x86/reboot/quirks: Add ASUS EeeBook X205TA/W reboot quirk
        x86/hpet: Prevent might sleep splat on resume
        x86/boot: Correct setup_header.start_sys name
        x86/purgatory: Fix sparse warning, symbol not declared
        x86/purgatory: Make functions and variables static
        x86/events: Remove last remnants of old filenames
        x86/pkeys: Check against max pkey to avoid overflows
        x86/ioapic: Split IOAPIC hot-removal into two steps
        x86/PCI: Implement pcibios_release_device to release IRQ from IOAPIC
        x86/intel_rdt: Remove duplicate inclusion of linux/cpu.h
        x86/vmware: Remove duplicate inclusion of asm/timer.h
        x86/hyperv: Hide unused label
        x86/reboot/quirks: Add ASUS EeeBook X205TA reboot quirk
        x86/platform/uv/BAU: Fix HUB errors by remove initial write to sw-ack register
        x86/selftests: Add clobbers for int80 on x86_64
        x86/apic: Simplify enable_IR_x2apic(), remove try_to_enable_IR()
        x86/apic: Fix a warning message in logical CPU IDs allocation
        x86/kdebugfs: Move boot params hierarchy under (debugfs)/x86/
      ec3b93ae
    • Linus Torvalds's avatar
      Merge branch 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 8a917235
      Linus Torvalds authored
      Pull timer fixes from Ingo Molnar:
       "This includes a fix for lockups caused by incorrect nsecs related
        cleanup, and a capabilities check fix for timerfd"
      
      * 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        jiffies: Revert bogus conversion of NSEC_PER_SEC to TICK_NSEC
        timerfd: Only check CAP_WAKE_ALARM when it is needed
      8a917235
    • Linus Torvalds's avatar
      Merge branch 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 609b07b7
      Linus Torvalds authored
      Pull scheduler fixes from Ingo Molnar:
       "A fix for KVM's scheduler clock which (erroneously) was always marked
        unstable, a fix for RT/DL load balancing, plus latency fixes"
      
      * 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        sched/clock, x86/tsc: Rework the x86 'unstable' sched_clock() interface
        sched/core: Fix pick_next_task() for RT,DL
        sched/fair: Make select_idle_cpu() more aggressive
      609b07b7
    • Linus Torvalds's avatar
      Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · c3abcabe
      Linus Torvalds authored
      Pull perf fixes from Ingo Molnar:
       "This includes a fix for a crash if certain special addresses are
        kprobed, plus does a rename of two Kconfig variables that were a minor
        misnomer"
      
      * 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        perf/core: Rename CONFIG_[UK]PROBE_EVENT to CONFIG_[UK]PROBE_EVENTS
        kprobes/x86: Fix kernel panic when certain exception-handling addresses are probed
      c3abcabe
    • Linus Torvalds's avatar
      Merge branch 'locking-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 500e1af2
      Linus Torvalds authored
      Pull locking fixes from Ingo Molnar:
      
       - Change the new refcount_t warnings from WARN() to WARN_ONCE()
      
       - two ww_mutex fixes
      
       - plus a new lockdep self-consistency check for a bug that triggered in
         practice
      
      * 'locking-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        locking/ww_mutex: Adjust the lock number for stress test
        locking/lockdep: Add nest_lock integrity test
        locking/ww_mutex: Replace cpu_relax() with cond_resched() for tests
        locking/refcounts: Change WARN() to WARN_ONCE()
      500e1af2
    • Linus Torvalds's avatar
      Merge branch 'irq-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 26db8f99
      Linus Torvalds authored
      Pull IRQ fix from Ingo Molnar:
       "Fix an ARM TI DRA7XX SoC irqchip driver local variables type
        bug/warning"
      
      * 'irq-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        irqchip/crossbar: Fix incorrect type of local variables
      26db8f99
    • Linus Torvalds's avatar
      Merge branch 'efi-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 21f85778
      Linus Torvalds authored
      Pull EFI fixes from Ingo Molnar:
       "A boot crash fix, and a secure boot related boot messages fix"
      
      * 'efi-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        efi/arm: Fix boot crash with CONFIG_CPUMASK_OFFSTACK=y
        efi/libstub: Treat missing SecureBoot variable as Secure Boot disabled
      21f85778
    • Linus Torvalds's avatar
      Merge branch 'core-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · c688f14c
      Linus Torvalds authored
      Pull core fixes from Ingo Molnar:
       "A couple of sched.h splitup related build fixes, plus an objtool fix"
      
      * 'core-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        objtool: Fix another GCC jump table detection issue
        drivers/char/nwbutton: Fix build breakage caused by include file reshuffling
        h8300: Fix build breakage caused by header file changes
        avr32: Fix build error caused by include file reshuffling
      c688f14c
    • Linus Torvalds's avatar
      Merge branch 'idr-4.11' of git://git.infradead.org/users/willy/linux-dax · 9e91c144
      Linus Torvalds authored
      Pull idr fix (and new tests) from Matthew Wilcox:
       "One urgent patch in here; freeing the correct IDA bitmap.
      
        Everything else is changes to the test suite"
      
      * 'idr-4.11' of git://git.infradead.org/users/willy/linux-dax:
        radix tree test suite: Specify -m32 in LDFLAGS too
        ida: Free correct IDA bitmap
        radix tree test suite: Depend on Makefile and quieten grep
        radix tree test suite: Fix build with --as-needed
        radix tree test suite: Build 32 bit binaries
        radix tree test suite: Add performance test for radix_tree_join()
        radix tree test suite: Add performance test for radix_tree_split()
        radix tree test suite: Add performance benchmarks
        radix tree test suite: Add test for radix_tree_clear_tags()
        radix tree test suite: Add tests for ida_simple_get() and ida_simple_remove()
        radix tree test suite: Add test for idr_get_next()
      9e91c144
    • Linus Torvalds's avatar
      Merge tag 'powerpc-4.11-3' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux · f7d6a728
      Linus Torvalds authored
      Pull powerpc fixes from Michael Ellerman:
       "Five fairly small fixes for things that went in this cycle.
      
        A fairly large patch to rework the CAS logic on Power9, necessitated
        by a late change to the firmware API, and we can't boot without it.
      
        Three fixes going to stable, allowing more instructions to be emulated
        on LE, fixing a boot crash on 32-bit Freescale BookE machines, and the
        OPAL XICS workaround.
      
        And a patch from me to sort the selects under CONFIG PPC. Annoying
        churn, but worth it in the long run, and best for it to go in now to
        avoid conflicts.
      
        Thanks to:
          Alexey Kardashevskiy, Anton Blanchard, Balbir Singh, Gautham R.
          Shenoy, Laurentiu Tudor, Nicholas Piggin, Paul Mackerras, Ravi
          Bangoria, Sachin Sant, Shile Zhang, Suraj Jitindar Singh"
      
      * tag 'powerpc-4.11-3' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux:
        powerpc: Sort the selects under CONFIG_PPC
        powerpc/64: Fix L1D cache shape vector reporting L1I values
        powerpc/64: Avoid panic during boot due to divide by zero in init_cache_info()
        powerpc: Update to new option-vector-5 format for CAS
        powerpc: Parse the command line before calling CAS
        powerpc/xics: Work around limitations of OPAL XICS priority handling
        powerpc/64: Fix checksum folding in csum_add()
        powerpc/powernv: Fix opal tracepoints with JUMP_LABEL=n
        powerpc/booke: Fix boot crash due to null hugepd
        powerpc: Fix compiling a BE kernel with a powerpc64le toolchain
        selftest/powerpc: Fix false failures for skipped tests
        powerpc/powernv: Fix bug due to labeling ambiguity in power_enter_stop
        powerpc/64: Invalidate process table caching after setting process table
        powerpc: emulate_step() tests for load/store instructions
        powerpc: Emulation support for load/store instructions on LE
      f7d6a728
    • Linus Torvalds's avatar
      Merge branch 'stable/for-linus-4.11' of... · 8c2c8ed8
      Linus Torvalds authored
      Merge branch 'stable/for-linus-4.11' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/swiotlb
      
      Pull swiotlb updates from Konrad Rzeszutek Wilk:
       "Two tiny implementations of the DMA API for callback in ARM (for Xen)"
      
      * 'stable/for-linus-4.11' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/swiotlb:
        swiotlb-xen: implement xen_swiotlb_get_sgtable callback
        swiotlb-xen: implement xen_swiotlb_dma_mmap callback
      8c2c8ed8
    • Matthew Wilcox's avatar
      radix tree test suite: Specify -m32 in LDFLAGS too · f0f3f2d0
      Matthew Wilcox authored
      
      
      Michael's patch to use the default make rule for linking and the patch
      from Rehas to use -m32 if building a 32-bit test-suite on a 64-bit
      platform don't work well together.
      
      Reported-by: default avatarRehas Sachdeva <aquannie@gmail.com>
      Signed-off-by: default avatarMatthew Wilcox <mawilcox@microsoft.com>
      f0f3f2d0
    • Matthew Wilcox's avatar
      ida: Free correct IDA bitmap · 4ecd9542
      Matthew Wilcox authored
      
      
      There's a relatively rare race where we look at the per-cpu preallocated
      IDA bitmap, see it's NULL, allocate a new one, and atomically update it.
      If the kmalloc() happened to sleep and we were rescheduled to a different
      CPU, or an interrupt came in at the exact right time, another task
      might have successfully allocated a bitmap and already deposited it.
      I forgot what the semantics of cmpxchg() were and ended up freeing the
      wrong bitmap leading to KASAN reporting a use-after-free.
      
      Dmitry found the bug with syzkaller & wrote the patch.  I wrote the test
      case that will reproduce the bug without his patch being applied.
      
      Reported-by: default avatarDmitry Vyukov <dvyukov@google.com>
      Signed-off-by: default avatarMatthew Wilcox <mawilcox@microsoft.com>
      4ecd9542
    • Matthew Wilcox's avatar
      radix tree test suite: Depend on Makefile and quieten grep · 3f1b6f9d
      Matthew Wilcox authored
      
      
      Changing the CFLAGS in the Makefile didn't always lead to a
      recompilation because the OFILES didn't depend on the Makefile.
      Also, after doing make clean, grep would still complain about
      a missing map-shift.h; we need -s as well as -q.
      
      Signed-off-by: default avatarMatthew Wilcox <mawilcox@microsoft.com>
      3f1b6f9d
    • Michael Ellerman's avatar
      radix tree test suite: Fix build with --as-needed · 284d96a4
      Michael Ellerman authored
      
      
      Currently the radix tree test suite doesn't build with toolchains that
      use --as-needed by default, for example Ubuntu's:
      
        cc -I. -I../../include -g -O2 -Wall -D_LGPL_SOURCE -fsanitize=address -lpthread -lurcu main.o ... -o main
        /usr/bin/ld: regression1.o: undefined reference to symbol 'pthread_join@@GLIBC_2.17'
        /lib/powerpc64le-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command line
        collect2: error: ld returned 1 exit status
      
      This is caused by the custom makefile rules placing LDFLAGS before the
      .o files that need the libraries.
      
      We could fix it by using --no-as-needed, or rewriting the custom rules.
      But we can also just drop the custom rules and move the libraries to
      LDLIBS, and then the default rules work correctly - with the one caveat
      that we need to add -fsanitize=address to LDFLAGS because that must be
      passed to the linker as well as the compiler.
      
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Signed-off-by: default avatarMatthew Wilcox <mawilcox@microsoft.com>
      284d96a4
    • Rehas Sachdeva's avatar
      radix tree test suite: Build 32 bit binaries · c4634b08
      Rehas Sachdeva authored
      
      
      Add option 'make BUILD=32' for building 32-bit binaries.
      
      Signed-off-by: default avatarRehas Sachdeva <aquannie@gmail.com>
      Signed-off-by: default avatarMatthew Wilcox <mawilcox@microsoft.com>
      c4634b08
    • Rehas Sachdeva's avatar
    • Rehas Sachdeva's avatar
    • Rehas Sachdeva's avatar
      radix tree test suite: Add performance benchmarks · 0d4a41c1
      Rehas Sachdeva authored
      
      
      Add performance benchmarks for radix tree insertion, tagging and deletion.
      
      Signed-off-by: default avatarRehas Sachdeva <aquannie@gmail.com>
      Signed-off-by: default avatarMatthew Wilcox <mawilcox@microsoft.com>
      0d4a41c1
    • Rehas Sachdeva's avatar
      radix tree test suite: Add test for radix_tree_clear_tags() · c629a344
      Rehas Sachdeva authored
      
      
      Assert that radix_tree_clear_tags() clears the tags on the passed node and
      slot. Assert that the case where the radix tree has only one entry at index
      zero and the node is NULL, is also handled.
      
      Signed-off-by: default avatarRehas Sachdeva <aquannie@gmail.com>
      Signed-off-by: default avatarMatthew Wilcox <mawilcox@microsoft.com>
      c629a344
    • Rehas Sachdeva's avatar
      radix tree test suite: Add tests for ida_simple_get() and ida_simple_remove() · 166bb1f5
      Rehas Sachdeva authored
      
      
      Assert that ida_simple_get() allocates an id in the passed range or returns
      error on failure, and ida_simple_remove() releases an allocated id.
      
      Signed-off-by: default avatarRehas Sachdeva <aquannie@gmail.com>
      Signed-off-by: default avatarMatthew Wilcox <mawilcox@microsoft.com>
      166bb1f5