1. 09 Apr, 2017 2 commits
    • Linus Torvalds's avatar
      Merge tag 'staging-4.11-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging · 62e1fd08
      Linus Torvalds authored
      Pull staging/IIO driver rfixes from Greg KH:
       "Here are a number of small IIO and staging driver fixes for 4.11-rc6.
        Nothing big here, just iio fixes for reported issues, and an ashmem
        fix for a very old bug that has been reported by a number of Android
        vendors"
      
      * tag 'staging-4.11-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging:
        staging: android: ashmem: lseek failed due to no FMODE_LSEEK.
        iio: hid-sensor-attributes: Fix sensor property setting failure.
        iio: accel: hid-sensor-accel-3d: Fix duplicate scan index error
        iio: core: Fix IIO_VAL_FRACTIONAL_LOG2 for negative values
        iio: st_pressure: initialize lps22hb bootime
        iio: bmg160: reset chip when probing
        iio: cros_ec_sensors: Fix return value to get raw and calibbias data.
      62e1fd08
    • Linus Torvalds's avatar
      Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs · 2a610b8a
      Linus Torvalds authored
      Pull VFS fixes from Al Viro:
       "statx followup fixes and a fix for stack-smashing on alpha"
      
      * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
        alpha: fix stack smashing in old_adjtimex(2)
        statx: Include a mask for stx_attributes in struct statx
        statx: Reserve the top bit of the mask for future struct expansion
        xfs: report crtime and attribute flags to statx
        ext4: Add statx support
        statx: optimize copy of struct statx to userspace
        statx: remove incorrect part of vfs_statx() comment
        statx: reject unknown flags when using NULL path
        Documentation/filesystems: fix documentation for ->getattr()
      2a610b8a
  2. 08 Apr, 2017 20 commits
  3. 07 Apr, 2017 18 commits
    • Martin Brandenburg's avatar
      orangefs: move features validation to fix filesystem hang · cefdc26e
      Martin Brandenburg authored
      Without this fix (and another to the userspace component itself
      described later), the kernel will be unable to process any OrangeFS
      requests after the userspace component is restarted (due to a crash or
      at the administrator's behest).
      
      The bug here is that inside orangefs_remount, the orangefs_request_mutex
      is locked.  When the userspace component restarts while the filesystem
      is mounted, it sends a ORANGEFS_DEV_REMOUNT_ALL ioctl to the device,
      which causes the kernel to send it a few requests aimed at synchronizing
      the state between the two.  While this is happening the
      orangefs_request_mutex is locked to prevent any other requests going
      through.
      
      This is only half of the bugfix.  The other half is in the userspace
      component which outright ignores(!) requests made before it considers
      the filesystem remounted, which is after the ioctl returns.  Of course
      the ioctl doesn't return until after the userspace component responds to
      the request it ignores.  The userspace component has been changed to
      allow ORANGEFS_VFS_OP_FEATURES regardless of the mount status.
      
      Mike Marshall says:
       "I've tested this patch against the fixed userspace part. This patch is
        real important, I hope it can make it into 4.11...
      
        Here's what happens when the userspace daemon is restarted, without
        the patch:
      
          =============================================
          [ INFO: possible recursive locking detected ]
          [   4.10.0-00007-ge98bdb30 #1 Not tainted    ]
          ---------------------------------------------
          pvfs2-client-co/29032 is trying to acquire lock:
           (orangefs_request_mutex){+.+.+.}, at: service_operation+0x3c7/0x7b0 [orangefs]
                        but task is already holding lock:
           (orangefs_request_mutex){+.+.+.}, at: dispatch_ioctl_command+0x1bf/0x330 [orangefs]
      
          CPU: 0 PID: 29032 Comm: pvfs2-client-co Not tainted 4.10.0-00007-ge98bdb30 #1
          Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.9.3-1.fc25 04/01/2014
          Call Trace:
           __lock_acquire+0x7eb/0x1290
           lock_acquire+0xe8/0x1d0
           mutex_lock_killable_nested+0x6f/0x6e0
           service_operation+0x3c7/0x7b0 [orangefs]
           orangefs_remount+0xea/0x150 [orangefs]
           dispatch_ioctl_command+0x227/0x330 [orangefs]
           orangefs_devreq_ioctl+0x29/0x70 [orangefs]
           do_vfs_ioctl+0xa3/0x6e0
           SyS_ioctl+0x79/0x90"
      Signed-off-by: default avatarMartin Brandenburg <martin@omnibond.com>
      Acked-by: default avatarMike Marshall <hubcap@omnibond.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      cefdc26e
    • Linus Torvalds's avatar
      Merge tag 'pci-v4.11-fixes-4' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci · c2eb7bea
      Linus Torvalds authored
      Pull PCI fixes from Bjorn Helgaas:
      
       - fix ThunderX legacy firmware resources
      
       - fix ARTPEC-6 and DesignWare platform driver NULL pointer dereferences
      
       - fix HiSilicon link error
      
      * tag 'pci-v4.11-fixes-4' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci:
        PCI: dwc: Fix dw_pcie_ops NULL pointer dereference
        PCI: dwc: Select PCI_HOST_COMMON for hisi
        PCI: thunder-pem: Fix legacy firmware PEM-specific resources
      c2eb7bea
    • Bart Van Assche's avatar
      blk-mq: Restart a single queue if tag sets are shared · 6d8c6c0f
      Bart Van Assche authored
      To improve scalability, if hardware queues are shared, restart
      a single hardware queue in round-robin fashion. Rename
      blk_mq_sched_restart_queues() to reflect the new semantics.
      Remove blk_mq_sched_mark_restart_queue() because this function
      has no callers. Remove flag QUEUE_FLAG_RESTART because this
      patch removes the code that uses this flag.
      Signed-off-by: default avatarBart Van Assche <bart.vanassche@sandisk.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Hannes Reinecke <hare@suse.com>
      Signed-off-by: default avatarJens Axboe <axboe@fb.com>
      6d8c6c0f
    • Bart Van Assche's avatar
      dm rq: Avoid that request processing stalls sporadically · 6077c2d7
      Bart Van Assche authored
      While running the srp-test software I noticed that request
      processing stalls sporadically at the beginning of a test, namely
      when mkfs is run against a dm-mpath device. Every time when that
      happened the following command was sufficient to resume request
      processing:
      
          echo run >/sys/kernel/debug/block/dm-0/state
      
      This patch avoids that such request processing stalls occur. The
      test I ran is as follows:
      
          while srp-test/run_tests -d -r 30 -t 02-mq; do :; done
      Signed-off-by: default avatarBart Van Assche <bart.vanassche@sandisk.com>
      Cc: Mike Snitzer <snitzer@redhat.com>
      Cc: dm-devel@redhat.com
      Signed-off-by: default avatarJens Axboe <axboe@fb.com>
      6077c2d7
    • Bart Van Assche's avatar
      scsi: Avoid that SCSI queues get stuck · 36e3cf27
      Bart Van Assche authored
      If a .queue_rq() function returns BLK_MQ_RQ_QUEUE_BUSY then the block
      driver that implements that function is responsible for rerunning the
      hardware queue once requests can be queued again successfully.
      
      commit 52d7f1b5 ("blk-mq: Avoid that requeueing starts stopped
      queues") removed the blk_mq_stop_hw_queue() call from scsi_queue_rq()
      for the BLK_MQ_RQ_QUEUE_BUSY case. Hence change all calls to functions
      that are intended to rerun a busy queue such that these examine all
      hardware queues instead of only stopped queues.
      
      Since no other functions than scsi_internal_device_block() and
      scsi_internal_device_unblock() should ever stop or restart a SCSI
      queue, change the blk_mq_delay_queue() call into a
      blk_mq_delay_run_hw_queue() call.
      
      Fixes: commit 52d7f1b5 ("blk-mq: Avoid that requeueing starts stopped queues")
      Fixes: commit 7e79dadc ("blk-mq: stop hardware queue in blk_mq_delay_queue()")
      Signed-off-by: default avatarBart Van Assche <bart.vanassche@sandisk.com>
      Cc: Martin K. Petersen <martin.petersen@oracle.com>
      Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Hannes Reinecke <hare@suse.de>
      Cc: Sagi Grimberg <sagi@grimberg.me>
      Cc: Long Li <longli@microsoft.com>
      Cc: K. Y. Srinivasan <kys@microsoft.com>
      Signed-off-by: default avatarJens Axboe <axboe@fb.com>
      36e3cf27
    • Bart Van Assche's avatar
      blk-mq: Introduce blk_mq_delay_run_hw_queue() · 7587a5ae
      Bart Van Assche authored
      Introduce a function that runs a hardware queue unconditionally
      after a delay. Note: there is already a function that stops and
      restarts a hardware queue after a delay, namely blk_mq_delay_queue().
      
      This function will be used in the next patch in this series.
      Signed-off-by: default avatarBart Van Assche <bart.vanassche@sandisk.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Hannes Reinecke <hare@suse.de>
      Cc: Long Li <longli@microsoft.com>
      Cc: K. Y. Srinivasan <kys@microsoft.com>
      Signed-off-by: default avatarJens Axboe <axboe@fb.com>
      7587a5ae
    • Linus Torvalds's avatar
      Merge tag 'dm-4.11-fixes-2' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm · 81d4bab4
      Linus Torvalds authored
      Pull device mapper fixes from Mike Snitzer:
      
       - two stable fixes for the verity target's FEC support
      
       - a stable fix for raid target's raid1 support (when no bitmap is used)
      
       - a 4.11 cache metadata v2 format fix to properly test blocks are clean
      
      * tag 'dm-4.11-fixes-2' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm:
        dm verity fec: fix bufio leaks
        dm raid: fix NULL pointer dereference for raid1 without bitmap
        dm cache metadata: fix metadata2 format's blocks_are_clean_separate_dirty
        dm verity fec: limit error correction recursion
      81d4bab4
    • Linus Torvalds's avatar
      Merge tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux · dc25ad3f
      Linus Torvalds authored
      Pull arm64 fixes from Will Deacon:
       "We've got a regression fix for the signal raised when userspace makes
        an unsupported unaligned access and a revert of the contiguous
        (hugepte) support for hugetlb, which has once again been found to be
        broken. One day, maybe, we'll get it right.
      
        Summary:
      
         - restore previous SIGBUS behaviour for unhandled unaligned user
           accesses
      
         - revert broken support for the contiguous bit in hugetlb (again...)"
      
      * tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux:
        Revert "Revert "arm64: hugetlb: partial revert of 66b3923a""
        arm64: mm: unaligned access by user-land should be received as SIGBUS
      dc25ad3f
    • Linus Torvalds's avatar
      Merge tag 'metag-for-v4.11-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/jhogan/metag · 4f0d14b0
      Linus Torvalds authored
      Pull metag usercopy fixes from James Hogan:
       "Metag usercopy fault handling fixes
      
        These patches fix a bunch of longstanding (some over a decade old)
        metag user copy fault handling bugs. Thanks go to Al Viro for spotting
        some of the questionable code in the first place"
      
      * tag 'metag-for-v4.11-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/jhogan/metag:
        metag/usercopy: Add missing fixups
        metag/usercopy: Fix src fixup in from user rapf loops
        metag/usercopy: Set flags before ADDZ
        metag/usercopy: Zero rest of buffer from copy_from_user
        metag/usercopy: Add early abort to copy_to_user
        metag/usercopy: Fix alignment error checking
        metag/usercopy: Drop unused macros
      4f0d14b0
    • Linus Torvalds's avatar
      Merge tag 'acpi-4.11-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm · 7ab66185
      Linus Torvalds authored
      Pull ACPI fix from Rafael Wysocki:
       "This fixes a core device enumeration code change made in 4.10, in
        order to address a reported issue, that went too far.
      
        Specifics:
      
         - Refine the check for the existence of _HID in find_child_checks()
           so that it doesn't trigger for device objects with device IDs made
           up by the kernel (Rafael Wysocki)"
      
      * tag 'acpi-4.11-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
        ACPI / scan: Prefer devices without _HID for _ADR matching
      7ab66185
    • Linus Torvalds's avatar
      Merge tag 'for-linus-4.11b-rc6-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip · 50bdd7a0
      Linus Torvalds authored
      Pull Xen fix from Juergen Gross:
       "A fix for error path cleanup in the xenbus handler"
      
      * tag 'for-linus-4.11b-rc6-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip:
        xenbus: remove transaction holder from list before freeing
      50bdd7a0
    • Liping Zhang's avatar
      sysctl: don't print negative flag for proc_douintvec · 5380e564
      Liping Zhang authored
      I saw some very confusing sysctl output on my system:
        # cat /proc/sys/net/core/xfrm_aevent_rseqth
        -2
        # cat /proc/sys/net/core/xfrm_aevent_etime
        -10
        # cat /proc/sys/net/ipv4/tcp_notsent_lowat
        -4294967295
      
      Because we forget to set the *negp flag in proc_douintvec, so it will
      become a garbage value.
      
      Since the value related to proc_douintvec is always an unsigned integer,
      so we can set *negp to false explictily to fix this issue.
      
      Fixes: e7d316a0 ("sysctl: handle error writing UINT_MAX to u32 fields")
      Signed-off-by: default avatarLiping Zhang <zlpnobody@gmail.com>
      Cc: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      5380e564
    • Liping Zhang's avatar
      sysctl: add sanity check for proc_douintvec · 1680a386
      Liping Zhang authored
      Commit e7d316a0 ("sysctl: handle error writing UINT_MAX to u32
      fields") introduced the proc_douintvec helper function, but it forgot to
      add the related sanity check when doing register_sysctl_table.  So add
      it now.
      Signed-off-by: default avatarLiping Zhang <zlpnobody@gmail.com>
      Cc: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      1680a386
    • Omar Sandoval's avatar
      blk-mq: remap queues when adding/removing hardware queues · ebe8bddb
      Omar Sandoval authored
      blk_mq_update_nr_hw_queues() used to remap hardware queues, which is the
      behavior that drivers expect. However, commit 4e68a011 changed
      blk_mq_queue_reinit() to not remap queues for the case of CPU
      hotplugging, inadvertently making blk_mq_update_nr_hw_queues() not remap
      queues as well. This breaks, for example, NBD's multi-connection mode,
      leaving the added hardware queues unused. Fix it by making
      blk_mq_update_nr_hw_queues() explicitly remap the queues.
      
      Fixes: 4e68a011 ("blk-mq: don't redistribute hardware queues on a CPU hotplug event")
      Reviewed-by: default avatarKeith Busch <keith.busch@intel.com>
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      Reviewed-by: default avatarSagi Grimberg <sagi@grimberg.me>
      Signed-off-by: default avatarOmar Sandoval <osandov@fb.com>
      Signed-off-by: default avatarJens Axboe <axboe@fb.com>
      ebe8bddb
    • Omar Sandoval's avatar
      blk-mq-sched: fix crash in switch error path · 54d5329d
      Omar Sandoval authored
      In elevator_switch(), if blk_mq_init_sched() fails, we attempt to fall
      back to the original scheduler. However, at this point, we've already
      torn down the original scheduler's tags, so this causes a crash. Doing
      the fallback like the legacy elevator path is much harder for mq, so fix
      it by just falling back to none, instead.
      Signed-off-by: default avatarOmar Sandoval <osandov@fb.com>
      Signed-off-by: default avatarJens Axboe <axboe@fb.com>
      54d5329d
    • Omar Sandoval's avatar
      blk-mq-sched: set up scheduler tags when bringing up new queues · 93252632
      Omar Sandoval authored
      If a new hardware queue is added at runtime, we don't allocate scheduler
      tags for it, leading to a crash. This hooks up the scheduler framework
      to blk_mq_{init,exit}_hctx() to make sure everything gets properly
      initialized/freed.
      Signed-off-by: default avatarOmar Sandoval <osandov@fb.com>
      Signed-off-by: default avatarJens Axboe <axboe@fb.com>
      93252632
    • Omar Sandoval's avatar
      blk-mq-sched: refactor scheduler initialization · 6917ff0b
      Omar Sandoval authored
      Preparation cleanup for the next couple of fixes, push
      blk_mq_sched_setup() and e->ops.mq.init_sched() into a helper.
      Signed-off-by: default avatarOmar Sandoval <osandov@fb.com>
      Signed-off-by: default avatarJens Axboe <axboe@fb.com>
      6917ff0b
    • Omar Sandoval's avatar
      blk-mq: use the right hctx when getting a driver tag fails · 81380ca1
      Omar Sandoval authored
      While dispatching requests, if we fail to get a driver tag, we mark the
      hardware queue as waiting for a tag and put the requests on a
      hctx->dispatch list to be run later when a driver tag is freed. However,
      blk_mq_dispatch_rq_list() may dispatch requests from multiple hardware
      queues if using a single-queue scheduler with a multiqueue device. If
      blk_mq_get_driver_tag() fails, it doesn't update the hardware queue we
      are processing. This means we end up using the hardware queue of the
      previous request, which may or may not be the same as that of the
      current request. If it isn't, the wrong hardware queue will end up
      waiting for a tag, and the requests will be on the wrong dispatch list,
      leading to a hang.
      
      The fix is twofold:
      
      1. Make sure we save which hardware queue we were trying to get a
         request for in blk_mq_get_driver_tag() regardless of whether it
         succeeds or not.
      2. Make blk_mq_dispatch_rq_list() take a request_queue instead of a
         blk_mq_hw_queue to make it clear that it must handle multiple
         hardware queues, since I've already messed this up on a couple of
         occasions.
      
      This didn't appear in testing with nvme and mq-deadline because nvme has
      more driver tags than the default number of scheduler tags. However,
      with the blk_mq_update_nr_hw_queues() fix, it showed up with nbd.
      Signed-off-by: default avatarOmar Sandoval <osandov@fb.com>
      Signed-off-by: default avatarJens Axboe <axboe@fb.com>
      81380ca1