stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] CIFS: return correct errors when pinning memory failed for direct I/O
@ 2018-12-16 22:41 Long Li
  2018-12-17  3:54 ` Sasha Levin
  2018-12-18  5:07 ` Steve French
  0 siblings, 2 replies; 3+ messages in thread
From: Long Li @ 2018-12-16 22:41 UTC (permalink / raw)
  To: Steve French, linux-cifs, samba-technical, linux-kernel,
	linux-rdma
  Cc: Long Li, stable, Murphy Zhou

From: Long Li <longli@microsoft.com>

When pinning memory failed, we should return the correct error code and
rewind the SMB credits.

Reported-by: Murphy Zhou <jencce.kernel@gmail.com>
Signed-off-by: Long Li <longli@microsoft.com>
Cc: stable@vger.kernel.org
Cc: Murphy Zhou <jencce.kernel@gmail.com>
---
 fs/cifs/file.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index c9bc56b..3467351 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -2630,6 +2630,9 @@ cifs_write_from_iter(loff_t offset, size_t len, struct iov_iter *from,
 					result, from->type,
 					from->iov_offset, from->count);
 				dump_stack();
+
+				rc = result;
+				add_credits_and_wake_if(server, credits, 0);
 				break;
 			}
 			cur_len = (size_t)result;
@@ -3313,13 +3316,16 @@ cifs_send_async_read(loff_t offset, size_t len, struct cifsFileInfo *open_file,
 					cur_len, &start);
 			if (result < 0) {
 				cifs_dbg(VFS,
-					"couldn't get user pages (cur_len=%zd)"
+					"couldn't get user pages (rc=%zd)"
 					" iter type %d"
 					" iov_offset %zd count %zd\n",
 					result, direct_iov.type,
 					direct_iov.iov_offset,
 					direct_iov.count);
 				dump_stack();
+
+				rc = result;
+				add_credits_and_wake_if(server, credits, 0);
 				break;
 			}
 			cur_len = (size_t)result;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] CIFS: return correct errors when pinning memory failed for direct I/O
  2018-12-16 22:41 [PATCH] CIFS: return correct errors when pinning memory failed for direct I/O Long Li
@ 2018-12-17  3:54 ` Sasha Levin
  2018-12-18  5:07 ` Steve French
  1 sibling, 0 replies; 3+ messages in thread
From: Sasha Levin @ 2018-12-17  3:54 UTC (permalink / raw)
  To: Sasha Levin, Long Li, Long Li, Steve French, linux-cifs
  Cc: Long Li, stable, , stable, Murphy Zhou, stable

Hi,

[This is an automated email]

This commit has been processed because it contains a -stable tag.
The stable tag indicates that it's relevant for the following trees: all

The bot has tested the following trees: v4.19.9, v4.14.88, v4.9.145, v4.4.167, v3.18.129, 

v4.19.9: Failed to apply! Possible dependencies:
    6e6e2b86c29c ("CIFS: Add support for direct I/O read")
    8c5f9c1ab7cb ("CIFS: Add support for direct I/O write")

v4.14.88: Failed to apply! Possible dependencies:
    1dbe3466b4d2 ("CIFS: Use offset when reading pages")
    6e6e2b86c29c ("CIFS: Add support for direct I/O read")
    8c5f9c1ab7cb ("CIFS: Add support for direct I/O write")
    bd3dcc6a22a9 ("CIFS: SMBD: Upper layer performs SMB read via RDMA write through memory registration")

v4.9.145: Failed to apply! Possible dependencies:
    31473fc4f965 ("CIFS: Separate SMB2 header structure")
    7fb8986e7449 ("CIFS: Add capability to transform requests before sending")
    8c5f9c1ab7cb ("CIFS: Add support for direct I/O write")
    9bb17e0916a0 ("CIFS: Add transform header handling callbacks")
    c610c4b619e5 ("CIFS: Add asynchronous write support through kernel AIO")
    ccf7f4088af2 ("CIFS: Add asynchronous context to support kernel AIO")
    da502f7df03d ("CIFS: Make SendReceive2() takes resp iov")
    ef65aaede23f ("smb2: Enforce sec= mount option")

v4.4.167: Failed to apply! Possible dependencies:
    141891f4727c ("SMB3: Add mount parameter to allow user to override max credits")
    166cea4dc3a4 ("SMB2: Separate RawNTLMSSP authentication from SMB2_sess_setup")
    16c568efff82 ("cifs: merge the hash calculation helpers")
    275516cdcfa4 ("Print IP address of unresponsive server")
    31473fc4f965 ("CIFS: Separate SMB2 header structure")
    373512ec5c10 ("Prepare for encryption support (first part). Add decryption and encryption key generation. Thanks to Metze for helping with this.")
    3baf1a7b9215 ("SMB2: Separate Kerberos authentication from SMB2_sess_setup")
    7fb8986e7449 ("CIFS: Add capability to transform requests before sending")
    8c5f9c1ab7cb ("CIFS: Add support for direct I/O write")
    9bb17e0916a0 ("CIFS: Add transform header handling callbacks")
    adfeb3e00e8e ("cifs: Make echo interval tunable")
    c610c4b619e5 ("CIFS: Add asynchronous write support through kernel AIO")
    ccf7f4088af2 ("CIFS: Add asynchronous context to support kernel AIO")
    da502f7df03d ("CIFS: Make SendReceive2() takes resp iov")
    ef65aaede23f ("smb2: Enforce sec= mount option")

v3.18.129: Failed to apply! Possible dependencies:
    064bcc0702a8 ("Fix coverity warning")
    141891f4727c ("SMB3: Add mount parameter to allow user to override max credits")
    275516cdcfa4 ("Print IP address of unresponsive server")
    31473fc4f965 ("CIFS: Separate SMB2 header structure")
    373512ec5c10 ("Prepare for encryption support (first part). Add decryption and encryption key generation. Thanks to Metze for helping with this.")
    3baf1a7b9215 ("SMB2: Separate Kerberos authentication from SMB2_sess_setup")
    5f7fbf733c9d ("Allow parsing vers=3.11 on cifs mount")
    7d414f396c91 ("cifs: Limit the overall credit acquired")
    7fb8986e7449 ("CIFS: Add capability to transform requests before sending")
    8c5f9c1ab7cb ("CIFS: Add support for direct I/O write")
    9235d0987331 ("Convert MessageID in smb2_hdr to LE")
    9bb17e0916a0 ("CIFS: Add transform header handling callbacks")
    aab1893d5fbe ("Add SMB3.11 mount option synonym for new dialect")
    adfeb3e00e8e ("cifs: Make echo interval tunable")
    b618f001a20e ("[SMB3] Enable checking for continuous availability and persistent handle support")
    bc09d141ebb2 ("fs/cifs: remove obsolete __constant")
    c2afb8147e69 ("Set previous session id correctly on SMB3 reconnect")
    c610c4b619e5 ("CIFS: Add asynchronous write support through kernel AIO")
    ccf7f4088af2 ("CIFS: Add asynchronous context to support kernel AIO")
    eed0e1753cbe ("Add defines and structs for smb3.1 dialect")
    ef65aaede23f ("smb2: Enforce sec= mount option")


How should we proceed with this patch?

--
Thanks,
Sasha

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] CIFS: return correct errors when pinning memory failed for direct I/O
  2018-12-16 22:41 [PATCH] CIFS: return correct errors when pinning memory failed for direct I/O Long Li
  2018-12-17  3:54 ` Sasha Levin
@ 2018-12-18  5:07 ` Steve French
  1 sibling, 0 replies; 3+ messages in thread
From: Steve French @ 2018-12-18  5:07 UTC (permalink / raw)
  To: Long Li
  Cc: Steve French, CIFS, samba-technical, LKML, linux-rdma, Stable,
	jencce.kernel

merged into cifs-2.6.git for-next

On Sun, Dec 16, 2018 at 4:44 PM Long Li <longli@linuxonhyperv.com> wrote:
>
> From: Long Li <longli@microsoft.com>
>
> When pinning memory failed, we should return the correct error code and
> rewind the SMB credits.
>
> Reported-by: Murphy Zhou <jencce.kernel@gmail.com>
> Signed-off-by: Long Li <longli@microsoft.com>
> Cc: stable@vger.kernel.org
> Cc: Murphy Zhou <jencce.kernel@gmail.com>
> ---
>  fs/cifs/file.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/fs/cifs/file.c b/fs/cifs/file.c
> index c9bc56b..3467351 100644
> --- a/fs/cifs/file.c
> +++ b/fs/cifs/file.c
> @@ -2630,6 +2630,9 @@ cifs_write_from_iter(loff_t offset, size_t len, struct iov_iter *from,
>                                         result, from->type,
>                                         from->iov_offset, from->count);
>                                 dump_stack();
> +
> +                               rc = result;
> +                               add_credits_and_wake_if(server, credits, 0);
>                                 break;
>                         }
>                         cur_len = (size_t)result;
> @@ -3313,13 +3316,16 @@ cifs_send_async_read(loff_t offset, size_t len, struct cifsFileInfo *open_file,
>                                         cur_len, &start);
>                         if (result < 0) {
>                                 cifs_dbg(VFS,
> -                                       "couldn't get user pages (cur_len=%zd)"
> +                                       "couldn't get user pages (rc=%zd)"
>                                         " iter type %d"
>                                         " iov_offset %zd count %zd\n",
>                                         result, direct_iov.type,
>                                         direct_iov.iov_offset,
>                                         direct_iov.count);
>                                 dump_stack();
> +
> +                               rc = result;
> +                               add_credits_and_wake_if(server, credits, 0);
>                                 break;
>                         }
>                         cur_len = (size_t)result;
> --
> 2.7.4
>


-- 
Thanks,

Steve

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-12-18  5:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-16 22:41 [PATCH] CIFS: return correct errors when pinning memory failed for direct I/O Long Li
2018-12-17  3:54 ` Sasha Levin
2018-12-18  5:07 ` Steve French

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).