1. 24 Apr, 2018 34 commits
  2. 19 Apr, 2018 6 commits
    • Greg Kroah-Hartman's avatar
      Linux 4.14.35 · 672f07d8
      Greg Kroah-Hartman authored
      672f07d8
    • J. Bruce Fields's avatar
      nfsd: fix incorrect umasks · 9a0a5098
      J. Bruce Fields authored
      commit 880a3a53 upstream.
      
      We're neglecting to clear the umask after it's set, which can cause a
      later unrelated rpc to (incorrectly) use the same umask if it happens to
      be processed by the same thread.
      
      There's a more subtle problem here too:
      
      An NFSv4 compound request is decoded all in one pass before any
      operations are executed.
      
      Currently we're setting current->fs->umask at the time we decode the
      compound.  In theory a single compound could contain multiple creates
      each setting a umask.  In that case we'd end up using whichever umask
      was passed in the *last* operation as the umask for all the creates,
      whether that was correct or not.
      
      So, we should just be saving the umask at decode time and waiting to set
      it until we actually process the corresponding operation.
      
      In practice it's unlikely any client would do multiple creates in a
      single compound.  And even if it did they'd likely be from the same
      process (hence carry the same umask).  So this is a little academic, but
      we should get it right anyway.
      
      Fixes: 47057abd (nfsd: add support for the umask attribute)
      Cc: stable@vger.kernel.org
      Reported-by: default avatarLucash Stach <l.stach@pengutronix.de>
      Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9a0a5098
    • Mike Kravetz's avatar
      hugetlbfs: fix bug in pgoff overflow checking · 61534984
      Mike Kravetz authored
      commit 5df63c2a upstream.
      
      This is a fix for a regression in 32 bit kernels caused by an invalid
      check for pgoff overflow in hugetlbfs mmap setup.  The check incorrectly
      specified that the size of a loff_t was the same as the size of a long.
      The regression prevents mapping hugetlbfs files at offsets greater than
      4GB on 32 bit kernels.
      
      On 32 bit kernels conversion from a page based unsigned long can not
      overflow a loff_t byte offset.  Therefore, skip this check if
      sizeof(unsigned long) != sizeof(loff_t).
      
      Link: http://lkml.kernel.org/r/20180330145402.5053-1-mike.kravetz@oracle.com
      Fixes: 63489f8e ("hugetlbfs: check for pgoff value overflow")
      Reported-by: default avatarDan Rue <dan.rue@linaro.org>
      Signed-off-by: default avatarMike Kravetz <mike.kravetz@oracle.com>
      Tested-by: default avatarAnders Roxell <anders.roxell@linaro.org>
      Cc: Michal Hocko <mhocko@kernel.org>
      Cc: Yisheng Xie <xieyisheng1@huawei.com>
      Cc: "Kirill A . Shutemov" <kirill.shutemov@linux.intel.com>
      Cc: Nic Losby <blurbdust@gmail.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      61534984
    • Simon Gaiser's avatar
      xen: xenbus_dev_frontend: Fix XS_TRANSACTION_END handling · 0319ce67
      Simon Gaiser authored
      commit 2a22ee6c upstream.
      
      Commit fd8aa909 ("xen: optimize xenbus driver for multiple
      concurrent xenstore accesses") made a subtle change to the semantic of
      xenbus_dev_request_and_reply() and xenbus_transaction_end().
      
      Before on an error response to XS_TRANSACTION_END
      xenbus_dev_request_and_reply() would not decrement the active
      transaction counter. But xenbus_transaction_end() has always counted the
      transaction as finished regardless of the response.
      
      The new behavior is that xenbus_dev_request_and_reply() and
      xenbus_transaction_end() will always count the transaction as finished
      regardless the response code (handled in xs_request_exit()).
      
      But xenbus_dev_frontend tries to end a transaction on closing of the
      device if the XS_TRANSACTION_END failed before. Trying to close the
      transaction twice corrupts the reference count. So fix this by also
      considering a transaction closed if we have sent XS_TRANSACTION_END once
      regardless of the return code.
      
      Cc: <stable@vger.kernel.org> # 4.11
      Fixes: fd8aa909 ("xen: optimize xenbus driver for multiple concurrent xenstore accesses")
      Signed-off-by: default avatarSimon Gaiser <simon@invisiblethingslab.com>
      Reviewed-by: default avatarJuergen Gross <jgross@suse.com>
      Signed-off-by: default avatarBoris Ostrovsky <boris.ostrovsky@oracle.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0319ce67
    • Amir Goldstein's avatar
      ovl: fix lookup with middle layer opaque dir and absolute path redirects · 80f509d4
      Amir Goldstein authored
      commit 3ec9b3fa upstream.
      
      As of now if we encounter an opaque dir while looking for a dentry, we set
      d->last=true. This means that there is no need to look further in any of
      the lower layers. This works fine as long as there are no redirets or
      relative redircts. But what if there is an absolute redirect on the
      children dentry of opaque directory. We still need to continue to look into
      next lower layer. This patch fixes it.
      
      Here is an example to demonstrate the issue. Say you have following setup.
      
      upper:  /redirect (redirect=/a/b/c)
      lower1: /a/[b]/c       ([b] is opaque) (c has absolute redirect=/a/b/d/)
      lower0: /a/b/d/foo
      
      Now "redirect" dir should merge with lower1:/a/b/c/ and lower0:/a/b/d.
      Note, despite the fact lower1:/a/[b] is opaque, we need to continue to look
      into lower0 because children c has an absolute redirect.
      
      Following is a reproducer.
      
      Watch me make foo disappear:
      
       $ mkdir lower middle upper work work2 merged
       $ mkdir lower/origin
       $ touch lower/origin/foo
       $ mount -t overlay none merged/ \
               -olowerdir=lower,upperdir=middle,workdir=work2
       $ mkdir merged/pure
       $ mv merged/origin merged/pure/redirect
       $ umount merged
       $ mount -t overlay none merged/ \
               -olowerdir=middle:lower,upperdir=upper,workdir=work
       $ mv merged/pure/redirect merged/redirect
      
      Now you see foo inside a twice redirected merged dir:
      
       $ ls merged/redirect
       foo
       $ umount merged
       $ mount -t overlay none merged/ \
               -olowerdir=middle:lower,upperdir=upper,workdir=work
      
      After mount cycle you don't see foo inside the same dir:
      
       $ ls merged/redirect
      
      During middle layer lookup, the opaqueness of middle/pure is left in
      the lookup state and then middle/pure/redirect is wrongly treated as
      opaque.
      
      Fixes: 02b69b28 ("ovl: lookup redirects")
      Cc: <stable@vger.kernel.org> #v4.10
      Signed-off-by: default avatarAmir Goldstein <amir73il@gmail.com>
      Signed-off-by: default avatarVivek Goyal <vgoyal@redhat.com>
      Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      80f509d4
    • Ming Lei's avatar
      blk-mq: don't keep offline CPUs mapped to hctx 0 · 5ee935da
      Ming Lei authored
      commit bffa9909 upstream.
      
      From commit 4b855ad3 ("blk-mq: Create hctx for each present CPU),
      blk-mq doesn't remap queue after CPU topo is changed, that said when
      some of these offline CPUs become online, they are still mapped to
      hctx 0, then hctx 0 may become the bottleneck of IO dispatch and
      completion.
      
      This patch sets up the mapping from the beginning, and aligns to
      queue mapping for PCI device (blk_mq_pci_map_queues()).
      
      Cc: Stefan Haberland <sth@linux.vnet.ibm.com>
      Cc: Keith Busch <keith.busch@intel.com>
      Cc: stable@vger.kernel.org
      Fixes: 4b855ad3 ("blk-mq: Create hctx for each present CPU)
      Tested-by: default avatarChristian Borntraeger <borntraeger@de.ibm.com>
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      Reviewed-by: default avatarSagi Grimberg <sagi@grimberg.me>
      Signed-off-by: default avatarMing Lei <ming.lei@redhat.com>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5ee935da