Backport NFS DIO fixes from 4.1 (rhbz 1211017 1211013)
This commit is contained in:
parent
eff5420f79
commit
fa59ce88af
12
kernel.spec
12
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@fedoraproject.org>
|
||||
- Backport NFS DIO fixes from 4.1 (rhbz 1211017 1211013)
|
||||
|
||||
* Fri Apr 24 2015 Josh Boyer <jwboyer@fedoraproject.org>
|
||||
- CVE-2015-3339 race condition between chown and execve (rhbz 1214030)
|
||||
- Fix iscsi with QNAP devices (rhbz 1208999)
|
||||
|
|
|
@ -0,0 +1,66 @@
|
|||
From: Peng Tao <tao.peng@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@primarydata.com>
|
||||
Cc: <stable@vger.kernel.org> # v3.19+
|
||||
Signed-off-by: Peng Tao <tao.peng@primarydata.com>
|
||||
Signed-off-by: Trond Myklebust <trond.myklebust@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
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
From: Peng Tao <tao.peng@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@primarydata.com>
|
||||
Cc: <stable@vger.kernel.org> # v3.19+
|
||||
Cc: Weston Andros Adamson <dros@primarydata.com>
|
||||
Signed-off-by: Peng Tao <tao.peng@primarydata.com>
|
||||
Signed-off-by: Trond Myklebust <trond.myklebust@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
|
||||
|
Loading…
Reference in New Issue