[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190107104454.179028436@linuxfoundation.org>
Date: Mon, 7 Jan 2019 13:32:47 +0100
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: linux-kernel@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
stable@...r.kernel.org, Long Li <longli@...rosoft.com>,
Steve French <stfrench@...rosoft.com>,
Joey Pabalinas <joeypabalinas@...il.com>
Subject: [PATCH 4.20 130/145] CIFS: use the correct length when pinning memory for direct I/O for write
4.20-stable review patch. If anyone has any objections, please let me know.
------------------
From: Long Li <longli@...rosoft.com>
commit b6bc8a7b993e62f82415a5e3e4a6469e80fea19c upstream.
The current code attempts to pin memory using the largest possible wsize
based on the currect SMB credits. This doesn't cause kernel oops but this
is not optimal as we may pin more pages then actually needed.
Fix this by only pinning what are needed for doing this write I/O.
Signed-off-by: Long Li <longli@...rosoft.com>
Cc: stable@...r.kernel.org
Signed-off-by: Steve French <stfrench@...rosoft.com>
Reviewed-by: Joey Pabalinas <joeypabalinas@...il.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
---
fs/cifs/file.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -2617,11 +2617,13 @@ cifs_write_from_iter(loff_t offset, size
if (rc)
break;
+ cur_len = min_t(const size_t, len, wsize);
+
if (ctx->direct_io) {
ssize_t result;
result = iov_iter_get_pages_alloc(
- from, &pagevec, wsize, &start);
+ from, &pagevec, cur_len, &start);
if (result < 0) {
cifs_dbg(VFS,
"direct_writev couldn't get user pages "
Powered by blists - more mailing lists