提交 b6bc8a7b 编写于 作者: L Long Li 提交者: Steve French

CIFS: use the correct length when pinning memory for direct I/O for write

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: NLong Li <longli@microsoft.com>
Cc: stable@vger.kernel.org
Signed-off-by: NSteve French <stfrench@microsoft.com>
Reviewed-by: NJoey Pabalinas <joeypabalinas@gmail.com>
上级 59a63e47
...@@ -2617,11 +2617,13 @@ cifs_write_from_iter(loff_t offset, size_t len, struct iov_iter *from, ...@@ -2617,11 +2617,13 @@ cifs_write_from_iter(loff_t offset, size_t len, struct iov_iter *from,
if (rc) if (rc)
break; break;
cur_len = min_t(const size_t, len, wsize);
if (ctx->direct_io) { if (ctx->direct_io) {
ssize_t result; ssize_t result;
result = iov_iter_get_pages_alloc( result = iov_iter_get_pages_alloc(
from, &pagevec, wsize, &start); from, &pagevec, cur_len, &start);
if (result < 0) { if (result < 0) {
cifs_dbg(VFS, cifs_dbg(VFS,
"direct_writev couldn't get user pages " "direct_writev couldn't get user pages "
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册