]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
3.18-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 14 Feb 2018 14:25:00 +0000 (15:25 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 14 Feb 2018 14:25:00 +0000 (15:25 +0100)
added patches:
kernfs-fix-regression-in-kernfs_fop_write-caused-by-wrong-type.patch
mtd-nand-fix-nand_do_read_oob-return-value.patch
nfs-add-a-cond_resched-to-nfs_commit_release_pages.patch
nfs-commit-direct-writes-even-if-they-fail-partially.patch

queue-3.18/kernfs-fix-regression-in-kernfs_fop_write-caused-by-wrong-type.patch [new file with mode: 0644]
queue-3.18/mtd-nand-fix-nand_do_read_oob-return-value.patch [new file with mode: 0644]
queue-3.18/nfs-add-a-cond_resched-to-nfs_commit_release_pages.patch [new file with mode: 0644]
queue-3.18/nfs-commit-direct-writes-even-if-they-fail-partially.patch [new file with mode: 0644]
queue-3.18/series

diff --git a/queue-3.18/kernfs-fix-regression-in-kernfs_fop_write-caused-by-wrong-type.patch b/queue-3.18/kernfs-fix-regression-in-kernfs_fop_write-caused-by-wrong-type.patch
new file mode 100644 (file)
index 0000000..da3d3dd
--- /dev/null
@@ -0,0 +1,43 @@
+From ba87977a49913129962af8ac35b0e13e0fa4382d Mon Sep 17 00:00:00 2001
+From: Ivan Vecera <ivecera@redhat.com>
+Date: Fri, 19 Jan 2018 09:18:54 +0100
+Subject: kernfs: fix regression in kernfs_fop_write caused by wrong type
+
+From: Ivan Vecera <ivecera@redhat.com>
+
+commit ba87977a49913129962af8ac35b0e13e0fa4382d upstream.
+
+Commit b7ce40cff0b9 ("kernfs: cache atomic_write_len in
+kernfs_open_file") changes type of local variable 'len' from ssize_t
+to size_t. This change caused that the *ppos value is updated also
+when the previous write callback failed.
+
+Mentioned snippet:
+...
+len = ops->write(...); <- return value can be negative
+...
+if (len > 0)           <- true here in this case
+        *ppos += len;
+...
+
+Fixes: b7ce40cff0b9 ("kernfs: cache atomic_write_len in kernfs_open_file")
+Acked-by: Tejun Heo <tj@kernel.org>
+Signed-off-by: Ivan Vecera <ivecera@redhat.com>
+Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ fs/kernfs/file.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/fs/kernfs/file.c
++++ b/fs/kernfs/file.c
+@@ -267,7 +267,7 @@ static ssize_t kernfs_fop_write(struct f
+ {
+       struct kernfs_open_file *of = kernfs_of(file);
+       const struct kernfs_ops *ops;
+-      size_t len;
++      ssize_t len;
+       char *buf;
+       if (of->atomic_write_len) {
diff --git a/queue-3.18/mtd-nand-fix-nand_do_read_oob-return-value.patch b/queue-3.18/mtd-nand-fix-nand_do_read_oob-return-value.patch
new file mode 100644 (file)
index 0000000..0b249c1
--- /dev/null
@@ -0,0 +1,59 @@
+From 87e89ce8d0d14f573c068c61bec2117751fb5103 Mon Sep 17 00:00:00 2001
+From: Miquel Raynal <miquel.raynal@free-electrons.com>
+Date: Fri, 12 Jan 2018 10:13:36 +0100
+Subject: mtd: nand: Fix nand_do_read_oob() return value
+
+From: Miquel Raynal <miquel.raynal@free-electrons.com>
+
+commit 87e89ce8d0d14f573c068c61bec2117751fb5103 upstream.
+
+Starting from commit 041e4575f034 ("mtd: nand: handle ECC errors in
+OOB"), nand_do_read_oob() (from the NAND core) did return 0 or a
+negative error, and the MTD layer expected it.
+
+However, the trend for the NAND layer is now to return an error or a
+positive number of bitflips. Deciding which status to return to the user
+belongs to the MTD layer.
+
+Commit e47f68587b82 ("mtd: check for max_bitflips in mtd_read_oob()")
+brought this logic to the mtd_read_oob() function while the return value
+coming from nand_do_read_oob() (called by the ->_read_oob() hook) was
+left unchanged.
+
+Fixes: e47f68587b82 ("mtd: check for max_bitflips in mtd_read_oob()")
+Signed-off-by: Miquel Raynal <miquel.raynal@free-electrons.com>
+Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/mtd/nand/nand_base.c |    5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+--- a/drivers/mtd/nand/nand_base.c
++++ b/drivers/mtd/nand/nand_base.c
+@@ -1872,6 +1872,7 @@ static int nand_write_oob_syndrome(struc
+ static int nand_do_read_oob(struct mtd_info *mtd, loff_t from,
+                           struct mtd_oob_ops *ops)
+ {
++      unsigned int max_bitflips = 0;
+       int page, realpage, chipnr;
+       struct nand_chip *chip = mtd->priv;
+       struct mtd_ecc_stats stats;
+@@ -1932,6 +1933,8 @@ static int nand_do_read_oob(struct mtd_i
+                               nand_wait_ready(mtd);
+               }
++              max_bitflips = max_t(unsigned int, max_bitflips, ret);
++
+               readlen -= len;
+               if (!readlen)
+                       break;
+@@ -1957,7 +1960,7 @@ static int nand_do_read_oob(struct mtd_i
+       if (mtd->ecc_stats.failed - stats.failed)
+               return -EBADMSG;
+-      return  mtd->ecc_stats.corrected - stats.corrected ? -EUCLEAN : 0;
++      return max_bitflips;
+ }
+ /**
diff --git a/queue-3.18/nfs-add-a-cond_resched-to-nfs_commit_release_pages.patch b/queue-3.18/nfs-add-a-cond_resched-to-nfs_commit_release_pages.patch
new file mode 100644 (file)
index 0000000..244ac33
--- /dev/null
@@ -0,0 +1,32 @@
+From 7f1bda447c9bd48b415acedba6b830f61591601f Mon Sep 17 00:00:00 2001
+From: Trond Myklebust <trond.myklebust@primarydata.com>
+Date: Mon, 18 Dec 2017 14:39:13 -0500
+Subject: NFS: Add a cond_resched() to nfs_commit_release_pages()
+
+From: Trond Myklebust <trond.myklebust@primarydata.com>
+
+commit 7f1bda447c9bd48b415acedba6b830f61591601f upstream.
+
+The commit list can get very large, and so we need a cond_resched()
+in nfs_commit_release_pages() in order to ensure we don't hog the CPU
+for excessive periods of time.
+
+Reported-by: Mike Galbraith <efault@gmx.de>
+Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ fs/nfs/write.c |    2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/fs/nfs/write.c
++++ b/fs/nfs/write.c
+@@ -1646,6 +1646,8 @@ static void nfs_commit_release_pages(str
+               set_bit(NFS_CONTEXT_RESEND_WRITES, &req->wb_context->flags);
+       next:
+               nfs_unlock_and_release_request(req);
++              /* Latency breaker */
++              cond_resched();
+       }
+       nfss = NFS_SERVER(data->inode);
+       if (atomic_long_read(&nfss->writeback) < NFS_CONGESTION_OFF_THRESH)
diff --git a/queue-3.18/nfs-commit-direct-writes-even-if-they-fail-partially.patch b/queue-3.18/nfs-commit-direct-writes-even-if-they-fail-partially.patch
new file mode 100644 (file)
index 0000000..882aa39
--- /dev/null
@@ -0,0 +1,40 @@
+From 1b8d97b0a837beaf48a8449955b52c650a7114b4 Mon Sep 17 00:00:00 2001
+From: "J. Bruce Fields" <bfields@redhat.com>
+Date: Tue, 16 Jan 2018 10:08:00 -0500
+Subject: NFS: commit direct writes even if they fail partially
+
+From: J. Bruce Fields <bfields@redhat.com>
+
+commit 1b8d97b0a837beaf48a8449955b52c650a7114b4 upstream.
+
+If some of the WRITE calls making up an O_DIRECT write syscall fail,
+we neglect to commit, even if some of the WRITEs succeed.
+
+We also depend on the commit code to free the reference count on the
+nfs_page taken in the "if (request_commit)" case at the end of
+nfs_direct_write_completion().  The problem was originally noticed
+because ENOSPC's encountered partway through a write would result in a
+closed file being sillyrenamed when it should have been unlinked.
+
+Signed-off-by: J. Bruce Fields <bfields@redhat.com>
+Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ fs/nfs/direct.c |    4 +---
+ 1 file changed, 1 insertion(+), 3 deletions(-)
+
+--- a/fs/nfs/direct.c
++++ b/fs/nfs/direct.c
+@@ -716,10 +716,8 @@ static void nfs_direct_write_completion(
+       spin_lock(&dreq->lock);
+-      if (test_bit(NFS_IOHDR_ERROR, &hdr->flags)) {
+-              dreq->flags = 0;
++      if (test_bit(NFS_IOHDR_ERROR, &hdr->flags))
+               dreq->error = hdr->error;
+-      }
+       if (dreq->error == 0) {
+               dreq->count += hdr->good_bytes;
+               if (nfs_write_need_commit(hdr)) {
index 4c60f07ed5e3e806e3393f5c6bcd89fffb5003df..7ffb7e321d232ddf041ed0f54b07a01e1d7e69dd 100644 (file)
@@ -24,3 +24,7 @@ usbip-vhci-stop-printing-kernel-pointer-addresses-in-messages.patch
 dccp-cve-2017-8824-use-after-free-in-dccp-code.patch
 media-dvb-usb-v2-lmedm04-improve-logic-checking-of-warm-start.patch
 media-dvb-usb-v2-lmedm04-move-ts2020-attach-to-dm04_lme2510_tuner.patch
+mtd-nand-fix-nand_do_read_oob-return-value.patch
+nfs-add-a-cond_resched-to-nfs_commit_release_pages.patch
+nfs-commit-direct-writes-even-if-they-fail-partially.patch
+kernfs-fix-regression-in-kernfs_fop_write-caused-by-wrong-type.patch