]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.19-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 20 Feb 2022 15:00:35 +0000 (16:00 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 20 Feb 2022 15:00:35 +0000 (16:00 +0100)
added patches:
block-wbt-fix-negative-inflight-counter-when-remove-scsi-device.patch
ext4-check-for-out-of-order-index-extents-in-ext4_valid_extent_entries.patch
mtd-rawnand-qcom-fix-clock-sequencing-in-qcom_nandc_probe.patch
nfs-do-not-report-writeback-errors-in-nfs_getattr.patch
nfs-lookup_directory-is-also-ok-with-symlinks.patch

queue-4.19/block-wbt-fix-negative-inflight-counter-when-remove-scsi-device.patch [new file with mode: 0644]
queue-4.19/ext4-check-for-out-of-order-index-extents-in-ext4_valid_extent_entries.patch [new file with mode: 0644]
queue-4.19/mtd-rawnand-qcom-fix-clock-sequencing-in-qcom_nandc_probe.patch [new file with mode: 0644]
queue-4.19/nfs-do-not-report-writeback-errors-in-nfs_getattr.patch [new file with mode: 0644]
queue-4.19/nfs-lookup_directory-is-also-ok-with-symlinks.patch [new file with mode: 0644]
queue-4.19/series

diff --git a/queue-4.19/block-wbt-fix-negative-inflight-counter-when-remove-scsi-device.patch b/queue-4.19/block-wbt-fix-negative-inflight-counter-when-remove-scsi-device.patch
new file mode 100644 (file)
index 0000000..eab3b36
--- /dev/null
@@ -0,0 +1,78 @@
+From e92bc4cd34de2ce454bdea8cd198b8067ee4e123 Mon Sep 17 00:00:00 2001
+From: Laibin Qiu <qiulaibin@huawei.com>
+Date: Sat, 22 Jan 2022 19:10:45 +0800
+Subject: block/wbt: fix negative inflight counter when remove scsi device
+
+From: Laibin Qiu <qiulaibin@huawei.com>
+
+commit e92bc4cd34de2ce454bdea8cd198b8067ee4e123 upstream.
+
+Now that we disable wbt by set WBT_STATE_OFF_DEFAULT in
+wbt_disable_default() when switch elevator to bfq. And when
+we remove scsi device, wbt will be enabled by wbt_enable_default.
+If it become false positive between wbt_wait() and wbt_track()
+when submit write request.
+
+The following is the scenario that triggered the problem.
+
+T1                          T2                           T3
+                            elevator_switch_mq
+                            bfq_init_queue
+                            wbt_disable_default <= Set
+                            rwb->enable_state (OFF)
+Submit_bio
+blk_mq_make_request
+rq_qos_throttle
+<= rwb->enable_state (OFF)
+                                                         scsi_remove_device
+                                                         sd_remove
+                                                         del_gendisk
+                                                         blk_unregister_queue
+                                                         elv_unregister_queue
+                                                         wbt_enable_default
+                                                         <= Set rwb->enable_state (ON)
+q_qos_track
+<= rwb->enable_state (ON)
+^^^^^^ this request will mark WBT_TRACKED without inflight add and will
+lead to drop rqw->inflight to -1 in wbt_done() which will trigger IO hung.
+
+Fix this by move wbt_enable_default() from elv_unregister to
+bfq_exit_queue(). Only re-enable wbt when bfq exit.
+
+Fixes: 76a8040817b4b ("blk-wbt: make sure throttle is enabled properly")
+
+Remove oneline stale comment, and kill one oneshot local variable.
+
+Signed-off-by: Ming Lei <ming.lei@rehdat.com>
+Reviewed-by: Christoph Hellwig <hch@lst.de>
+Link: https://lore.kernel.org/linux-block/20211214133103.551813-1-qiulaibin@huawei.com/
+Signed-off-by: Laibin Qiu <qiulaibin@huawei.com>
+Signed-off-by: Jens Axboe <axboe@kernel.dk>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ block/bfq-iosched.c |    2 ++
+ block/elevator.c    |    2 --
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+--- a/block/bfq-iosched.c
++++ b/block/bfq-iosched.c
+@@ -5417,6 +5417,8 @@ static void bfq_exit_queue(struct elevat
+       spin_unlock_irq(&bfqd->lock);
+ #endif
++      wbt_enable_default(bfqd->queue);
++
+       kfree(bfqd);
+ }
+--- a/block/elevator.c
++++ b/block/elevator.c
+@@ -877,8 +877,6 @@ void elv_unregister_queue(struct request
+               kobject_del(&e->kobj);
+               e->registered = 0;
+-              /* Re-enable throttling in case elevator disabled it */
+-              wbt_enable_default(q);
+       }
+ }
diff --git a/queue-4.19/ext4-check-for-out-of-order-index-extents-in-ext4_valid_extent_entries.patch b/queue-4.19/ext4-check-for-out-of-order-index-extents-in-ext4_valid_extent_entries.patch
new file mode 100644 (file)
index 0000000..85b815a
--- /dev/null
@@ -0,0 +1,93 @@
+From 8dd27fecede55e8a4e67eef2878040ecad0f0d33 Mon Sep 17 00:00:00 2001
+From: Zhang Yi <yi.zhang@huawei.com>
+Date: Wed, 8 Sep 2021 20:08:48 +0800
+Subject: ext4: check for out-of-order index extents in ext4_valid_extent_entries()
+
+From: Zhang Yi <yi.zhang@huawei.com>
+
+commit 8dd27fecede55e8a4e67eef2878040ecad0f0d33 upstream.
+
+After commit 5946d089379a ("ext4: check for overlapping extents in
+ext4_valid_extent_entries()"), we can check out the overlapping extent
+entry in leaf extent blocks. But the out-of-order extent entry in index
+extent blocks could also trigger bad things if the filesystem is
+inconsistent. So this patch add a check to figure out the out-of-order
+index extents and return error.
+
+Signed-off-by: Zhang Yi <yi.zhang@huawei.com>
+Reviewed-by: Theodore Ts'o <tytso@mit.edu>
+Link: https://lore.kernel.org/r/20210908120850.4012324-2-yi.zhang@huawei.com
+Signed-off-by: Theodore Ts'o <tytso@mit.edu>
+Signed-off-by: Leah Rumancik <leah.rumancik@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ fs/ext4/extents.c |   21 ++++++++++++++-------
+ 1 file changed, 14 insertions(+), 7 deletions(-)
+
+--- a/fs/ext4/extents.c
++++ b/fs/ext4/extents.c
+@@ -390,9 +390,12 @@ static int ext4_valid_extent_idx(struct
+ static int ext4_valid_extent_entries(struct inode *inode,
+                               struct ext4_extent_header *eh,
+-                              int depth)
++                              ext4_fsblk_t *pblk, int depth)
+ {
+       unsigned short entries;
++      ext4_lblk_t lblock = 0;
++      ext4_lblk_t prev = 0;
++
+       if (eh->eh_entries == 0)
+               return 1;
+@@ -403,32 +406,36 @@ static int ext4_valid_extent_entries(str
+               struct ext4_extent *ext = EXT_FIRST_EXTENT(eh);
+               struct ext4_super_block *es = EXT4_SB(inode->i_sb)->s_es;
+               ext4_fsblk_t pblock = 0;
+-              ext4_lblk_t lblock = 0;
+-              ext4_lblk_t prev = 0;
+-              int len = 0;
+               while (entries) {
+                       if (!ext4_valid_extent(inode, ext))
+                               return 0;
+                       /* Check for overlapping extents */
+                       lblock = le32_to_cpu(ext->ee_block);
+-                      len = ext4_ext_get_actual_len(ext);
+                       if ((lblock <= prev) && prev) {
+                               pblock = ext4_ext_pblock(ext);
+                               es->s_last_error_block = cpu_to_le64(pblock);
+                               return 0;
+                       }
++                      prev = lblock + ext4_ext_get_actual_len(ext) - 1;
+                       ext++;
+                       entries--;
+-                      prev = lblock + len - 1;
+               }
+       } else {
+               struct ext4_extent_idx *ext_idx = EXT_FIRST_INDEX(eh);
+               while (entries) {
+                       if (!ext4_valid_extent_idx(inode, ext_idx))
+                               return 0;
++
++                      /* Check for overlapping index extents */
++                      lblock = le32_to_cpu(ext_idx->ei_block);
++                      if ((lblock <= prev) && prev) {
++                              *pblk = ext4_idx_pblock(ext_idx);
++                              return 0;
++                      }
+                       ext_idx++;
+                       entries--;
++                      prev = lblock;
+               }
+       }
+       return 1;
+@@ -462,7 +469,7 @@ static int __ext4_ext_check(const char *
+               error_msg = "invalid eh_entries";
+               goto corrupted;
+       }
+-      if (!ext4_valid_extent_entries(inode, eh, depth)) {
++      if (!ext4_valid_extent_entries(inode, eh, &pblk, depth)) {
+               error_msg = "invalid extent entries";
+               goto corrupted;
+       }
diff --git a/queue-4.19/mtd-rawnand-qcom-fix-clock-sequencing-in-qcom_nandc_probe.patch b/queue-4.19/mtd-rawnand-qcom-fix-clock-sequencing-in-qcom_nandc_probe.patch
new file mode 100644 (file)
index 0000000..70ce320
--- /dev/null
@@ -0,0 +1,91 @@
+From 5c23b3f965bc9ee696bf2ed4bdc54d339dd9a455 Mon Sep 17 00:00:00 2001
+From: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
+Date: Mon, 3 Jan 2022 03:03:15 +0000
+Subject: mtd: rawnand: qcom: Fix clock sequencing in qcom_nandc_probe()
+
+From: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
+
+commit 5c23b3f965bc9ee696bf2ed4bdc54d339dd9a455 upstream.
+
+Interacting with a NAND chip on an IPQ6018 I found that the qcomsmem NAND
+partition parser was returning -EPROBE_DEFER waiting for the main smem
+driver to load.
+
+This caused the board to reset. Playing about with the probe() function
+shows that the problem lies in the core clock being switched off before the
+nandc_unalloc() routine has completed.
+
+If we look at how qcom_nandc_remove() tears down allocated resources we see
+the expected order is
+
+qcom_nandc_unalloc(nandc);
+
+clk_disable_unprepare(nandc->aon_clk);
+clk_disable_unprepare(nandc->core_clk);
+
+dma_unmap_resource(&pdev->dev, nandc->base_dma, resource_size(res),
+                  DMA_BIDIRECTIONAL, 0);
+
+Tweaking probe() to both bring up and tear-down in that order removes the
+reset if we end up deferring elsewhere.
+
+Fixes: c76b78d8ec05 ("mtd: nand: Qualcomm NAND controller driver")
+Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
+Reviewed-by: Manivannan Sadhasivam <mani@kernel.org>
+Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
+Link: https://lore.kernel.org/linux-mtd/20220103030316.58301-2-bryan.odonoghue@linaro.org
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/mtd/nand/raw/qcom_nandc.c |   14 ++++++--------
+ 1 file changed, 6 insertions(+), 8 deletions(-)
+
+--- a/drivers/mtd/nand/raw/qcom_nandc.c
++++ b/drivers/mtd/nand/raw/qcom_nandc.c
+@@ -10,7 +10,6 @@
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  * GNU General Public License for more details.
+  */
+-
+ #include <linux/clk.h>
+ #include <linux/slab.h>
+ #include <linux/bitops.h>
+@@ -2959,10 +2958,6 @@ static int qcom_nandc_probe(struct platf
+       if (!nandc->base_dma)
+               return -ENXIO;
+-      ret = qcom_nandc_alloc(nandc);
+-      if (ret)
+-              goto err_nandc_alloc;
+-
+       ret = clk_prepare_enable(nandc->core_clk);
+       if (ret)
+               goto err_core_clk;
+@@ -2971,6 +2966,10 @@ static int qcom_nandc_probe(struct platf
+       if (ret)
+               goto err_aon_clk;
++      ret = qcom_nandc_alloc(nandc);
++      if (ret)
++              goto err_nandc_alloc;
++
+       ret = qcom_nandc_setup(nandc);
+       if (ret)
+               goto err_setup;
+@@ -2982,15 +2981,14 @@ static int qcom_nandc_probe(struct platf
+       return 0;
+ err_setup:
++      qcom_nandc_unalloc(nandc);
++err_nandc_alloc:
+       clk_disable_unprepare(nandc->aon_clk);
+ err_aon_clk:
+       clk_disable_unprepare(nandc->core_clk);
+ err_core_clk:
+-      qcom_nandc_unalloc(nandc);
+-err_nandc_alloc:
+       dma_unmap_resource(dev, res->start, resource_size(res),
+                          DMA_BIDIRECTIONAL, 0);
+-
+       return ret;
+ }
diff --git a/queue-4.19/nfs-do-not-report-writeback-errors-in-nfs_getattr.patch b/queue-4.19/nfs-do-not-report-writeback-errors-in-nfs_getattr.patch
new file mode 100644 (file)
index 0000000..c063e0f
--- /dev/null
@@ -0,0 +1,39 @@
+From d19e0183a88306acda07f4a01fedeeffe2a2a06b Mon Sep 17 00:00:00 2001
+From: Trond Myklebust <trond.myklebust@hammerspace.com>
+Date: Tue, 15 Feb 2022 18:05:18 -0500
+Subject: NFS: Do not report writeback errors in nfs_getattr()
+
+From: Trond Myklebust <trond.myklebust@hammerspace.com>
+
+commit d19e0183a88306acda07f4a01fedeeffe2a2a06b upstream.
+
+The result of the writeback, whether it is an ENOSPC or an EIO, or
+anything else, does not inhibit the NFS client from reporting the
+correct file timestamps.
+
+Fixes: 79566ef018f5 ("NFS: Getattr doesn't require data sync semantics")
+Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
+Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ fs/nfs/inode.c |    9 +++------
+ 1 file changed, 3 insertions(+), 6 deletions(-)
+
+--- a/fs/nfs/inode.c
++++ b/fs/nfs/inode.c
+@@ -787,12 +787,9 @@ int nfs_getattr(const struct path *path,
+               goto out_no_update;
+       /* Flush out writes to the server in order to update c/mtime.  */
+-      if ((request_mask & (STATX_CTIME|STATX_MTIME)) &&
+-                      S_ISREG(inode->i_mode)) {
+-              err = filemap_write_and_wait(inode->i_mapping);
+-              if (err)
+-                      goto out;
+-      }
++      if ((request_mask & (STATX_CTIME | STATX_MTIME)) &&
++          S_ISREG(inode->i_mode))
++              filemap_write_and_wait(inode->i_mapping);
+       /*
+        * We may force a getattr if the user cares about atime.
diff --git a/queue-4.19/nfs-lookup_directory-is-also-ok-with-symlinks.patch b/queue-4.19/nfs-lookup_directory-is-also-ok-with-symlinks.patch
new file mode 100644 (file)
index 0000000..ff38386
--- /dev/null
@@ -0,0 +1,43 @@
+From e0caaf75d443e02e55e146fd75fe2efc8aed5540 Mon Sep 17 00:00:00 2001
+From: Trond Myklebust <trond.myklebust@hammerspace.com>
+Date: Tue, 8 Feb 2022 13:38:23 -0500
+Subject: NFS: LOOKUP_DIRECTORY is also ok with symlinks
+
+From: Trond Myklebust <trond.myklebust@hammerspace.com>
+
+commit e0caaf75d443e02e55e146fd75fe2efc8aed5540 upstream.
+
+Commit ac795161c936 (NFSv4: Handle case where the lookup of a directory
+fails) [1], part of Linux since 5.17-rc2, introduced a regression, where
+a symbolic link on an NFS mount to a directory on another NFS does not
+resolve(?) the first time it is accessed:
+
+Reported-by: Paul Menzel <pmenzel@molgen.mpg.de>
+Fixes: ac795161c936 ("NFSv4: Handle case where the lookup of a directory fails")
+Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
+Tested-by: Donald Buczek <buczek@molgen.mpg.de>
+Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ fs/nfs/dir.c |    4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/fs/nfs/dir.c
++++ b/fs/nfs/dir.c
+@@ -1629,14 +1629,14 @@ no_open:
+       if (!res) {
+               inode = d_inode(dentry);
+               if ((lookup_flags & LOOKUP_DIRECTORY) && inode &&
+-                  !S_ISDIR(inode->i_mode))
++                  !(S_ISDIR(inode->i_mode) || S_ISLNK(inode->i_mode)))
+                       res = ERR_PTR(-ENOTDIR);
+               else if (inode && S_ISREG(inode->i_mode))
+                       res = ERR_PTR(-EOPENSTALE);
+       } else if (!IS_ERR(res)) {
+               inode = d_inode(res);
+               if ((lookup_flags & LOOKUP_DIRECTORY) && inode &&
+-                  !S_ISDIR(inode->i_mode)) {
++                  !(S_ISDIR(inode->i_mode) || S_ISLNK(inode->i_mode))) {
+                       dput(res);
+                       res = ERR_PTR(-ENOTDIR);
+               } else if (inode && S_ISREG(inode->i_mode)) {
index c0a0b198afa803281cf58960b829e03f8b60222f..eb73930627b73f7093d8845ff90f3a0706862bd0 100644 (file)
@@ -33,3 +33,8 @@ alsa-hda-fix-missing-codec-probe-on-shenker-dock-15.patch
 asoc-ops-fix-stereo-change-notifications-in-snd_soc_put_volsw.patch
 asoc-ops-fix-stereo-change-notifications-in-snd_soc_put_volsw_range.patch
 powerpc-lib-sstep-fix-ptesync-build-error.patch
+ext4-check-for-out-of-order-index-extents-in-ext4_valid_extent_entries.patch
+block-wbt-fix-negative-inflight-counter-when-remove-scsi-device.patch
+nfs-lookup_directory-is-also-ok-with-symlinks.patch
+nfs-do-not-report-writeback-errors-in-nfs_getattr.patch
+mtd-rawnand-qcom-fix-clock-sequencing-in-qcom_nandc_probe.patch