Skip to contentSkip to conversation

CIFS: return correct errors when pinning memory failed for direct I/O

PATCH Applied Long Li 3 participants 3 messages Dec 16, 2018 – Dec 18, 2018

Subsystems (4)
lore
Share & tools
lore

Long Li

author
#0 lore raw

PATCH 1/1 CIFS: return correct errors when pinning memory failed for direct I/O

From: Long Li <[email protected]>

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

---
 fs/cifs/file.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
fs/cifs/file.c +7 -1
index c9bc56b..3467351 100644
@@ -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;
Signature · 1 line
2.7.4
maintainer
#1 lore raw

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

Applied
#2 lore raw
In reply to Long Li

merged into cifs-2.6.git for-next

Quoted 49 lines · Long Li

From: Long Li <[email protected]>

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

---
 fs/cifs/file.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
fs/cifs/file.c +7 -2
index c9bc56b..3467351 100644
@@ -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

Signature · 3 lines
Thanks,

Steve