jwboyer pushed to kernel (f22). "Backport NFS DIO fixes from 4.1 (rhbz 1211017 1211013)"

notifications at fedoraproject.org notifications at fedoraproject.org
Mon Apr 27 15:15:15 UTC 2015


>From fa59ce88af9b68c9e15b2757c267e0b1ffe46efe Mon Sep 17 00:00:00 2001
From: Josh Boyer <jwboyer at fedoraproject.org>
Date: Mon, 27 Apr 2015 11:13:17 -0400
Subject: Backport NFS DIO fixes from 4.1 (rhbz 1211017 1211013)


diff --git a/kernel.spec b/kernel.spec
index 6bd3b19..38251ec 100644
--- a/kernel.spec
+++ b/kernel.spec
@@ -645,6 +645,10 @@ Patch26177: SCSI-add-1024-max-sectors-black-list-flag.patch
 #CVE-2015-3330 rbhz 1214030
 Patch26188: fs-take-i_mutex-during-prepare_binprm-for-set-ug-id-.patch
 
+#rhbz 1211017 1211013
+Patch26190: nfs-fix-DIO-good-bytes-calculation.patch
+Patch26191: nfs-remove-WARN_ON_ONCE-from-nfs_direct_good_bytes.patch
+
 # END OF PATCH DEFINITIONS
 
 %endif
@@ -1404,6 +1408,11 @@ ApplyPatch SCSI-add-1024-max-sectors-black-list-flag.patch
 #CVE-2015-3330 rbhz 1214030
 ApplyPatch fs-take-i_mutex-during-prepare_binprm-for-set-ug-id-.patch
 
+#rhbz 1211017 1211013
+ApplyPatch nfs-fix-DIO-good-bytes-calculation.patch
+ApplyPatch nfs-remove-WARN_ON_ONCE-from-nfs_direct_good_bytes.patch
+
+
 # END OF PATCH APPLICATIONS
 
 %endif
@@ -2254,6 +2263,9 @@ fi
 #
 # 
 %changelog
+* Mon Apr 27 2015 Josh Boyer <jwboyer at fedoraproject.org>
+- Backport NFS DIO fixes from 4.1 (rhbz 1211017 1211013)
+
 * Fri Apr 24 2015 Josh Boyer <jwboyer at fedoraproject.org>
 - CVE-2015-3339 race condition between chown and execve (rhbz 1214030)
 - Fix iscsi with QNAP devices (rhbz 1208999)
diff --git a/nfs-fix-DIO-good-bytes-calculation.patch b/nfs-fix-DIO-good-bytes-calculation.patch
new file mode 100644
index 0000000..e2f20e5
--- /dev/null
+++ b/nfs-fix-DIO-good-bytes-calculation.patch
@@ -0,0 +1,66 @@
+From: Peng Tao <tao.peng at primarydata.com>
+Date: Thu, 9 Apr 2015 23:02:16 +0800
+Subject: [PATCH] nfs: fix DIO good bytes calculation
+
+For direct read that has IO size larger than rsize, we'll split
+it into several READ requests and nfs_direct_good_bytes() would
+count completed bytes incorrectly by eating last zero count reply.
+
+Fix it by handling mirror and non-mirror cases differently such that
+we only count mirrored writes differently.
+
+This fixes 5fadeb47("nfs: count DIO good bytes correctly with mirroring").
+
+Reported-by: Jean Spector <jean at primarydata.com>
+Cc: <stable at vger.kernel.org> # v3.19+
+Signed-off-by: Peng Tao <tao.peng at primarydata.com>
+Signed-off-by: Trond Myklebust <trond.myklebust at primarydata.com>
+---
+ fs/nfs/direct.c | 29 +++++++++++++++++------------
+ 1 file changed, 17 insertions(+), 12 deletions(-)
+
+diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c
+index e907c8cf732e..5e451a75132d 100644
+--- a/fs/nfs/direct.c
++++ b/fs/nfs/direct.c
+@@ -131,20 +131,25 @@ nfs_direct_good_bytes(struct nfs_direct_req *dreq, struct nfs_pgio_header *hdr)
+ 
+ 	WARN_ON_ONCE(hdr->pgio_mirror_idx >= dreq->mirror_count);
+ 
+-	count = dreq->mirrors[hdr->pgio_mirror_idx].count;
+-	if (count + dreq->io_start < hdr->io_start + hdr->good_bytes) {
+-		count = hdr->io_start + hdr->good_bytes - dreq->io_start;
+-		dreq->mirrors[hdr->pgio_mirror_idx].count = count;
+-	}
+-
+-	/* update the dreq->count by finding the minimum agreed count from all
+-	 * mirrors */
+-	count = dreq->mirrors[0].count;
++	if (dreq->mirror_count == 1) {
++		dreq->mirrors[hdr->pgio_mirror_idx].count += hdr->good_bytes;
++		dreq->count += hdr->good_bytes;
++	} else {
++		/* mirrored writes */
++		count = dreq->mirrors[hdr->pgio_mirror_idx].count;
++		if (count + dreq->io_start < hdr->io_start + hdr->good_bytes) {
++			count = hdr->io_start + hdr->good_bytes - dreq->io_start;
++			dreq->mirrors[hdr->pgio_mirror_idx].count = count;
++		}
++		/* update the dreq->count by finding the minimum agreed count from all
++		 * mirrors */
++		count = dreq->mirrors[0].count;
+ 
+-	for (i = 1; i < dreq->mirror_count; i++)
+-		count = min(count, dreq->mirrors[i].count);
++		for (i = 1; i < dreq->mirror_count; i++)
++			count = min(count, dreq->mirrors[i].count);
+ 
+-	dreq->count = count;
++		dreq->count = count;
++	}
+ }
+ 
+ /*
+-- 
+2.1.0
+
diff --git a/nfs-remove-WARN_ON_ONCE-from-nfs_direct_good_bytes.patch b/nfs-remove-WARN_ON_ONCE-from-nfs_direct_good_bytes.patch
new file mode 100644
index 0000000..9cbdc0d
--- /dev/null
+++ b/nfs-remove-WARN_ON_ONCE-from-nfs_direct_good_bytes.patch
@@ -0,0 +1,32 @@
+From: Peng Tao <tao.peng at primarydata.com>
+Date: Thu, 9 Apr 2015 23:02:17 +0800
+Subject: [PATCH] nfs: remove WARN_ON_ONCE from nfs_direct_good_bytes
+
+For flexfiles driver, we might choose to read from mirror index other
+than 0 while mirror_count is always 1 for read.
+
+Reported-by: Jean Spector <jean at primarydata.com>
+Cc: <stable at vger.kernel.org> # v3.19+
+Cc: Weston Andros Adamson <dros at primarydata.com>
+Signed-off-by: Peng Tao <tao.peng at primarydata.com>
+Signed-off-by: Trond Myklebust <trond.myklebust at primarydata.com>
+---
+ fs/nfs/direct.c | 2 --
+ 1 file changed, 2 deletions(-)
+
+diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c
+index 5e451a75132d..ab21ef16a11a 100644
+--- a/fs/nfs/direct.c
++++ b/fs/nfs/direct.c
+@@ -129,8 +129,6 @@ nfs_direct_good_bytes(struct nfs_direct_req *dreq, struct nfs_pgio_header *hdr)
+ 	int i;
+ 	ssize_t count;
+ 
+-	WARN_ON_ONCE(hdr->pgio_mirror_idx >= dreq->mirror_count);
+-
+ 	if (dreq->mirror_count == 1) {
+ 		dreq->mirrors[hdr->pgio_mirror_idx].count += hdr->good_bytes;
+ 		dreq->count += hdr->good_bytes;
+-- 
+2.1.0
+
-- 
cgit v0.10.2


	http://pkgs.fedoraproject.org/cgit/kernel.git/commit/?h=f22&id=fa59ce88af9b68c9e15b2757c267e0b1ffe46efe


More information about the scm-commits mailing list