diff mbox series

cifs: dump_stack() only when non-interrupt error in AIO

Message ID 20220914185417.32509-1-ematsumiya@suse.de (mailing list archive)
State New, archived
Headers show
Series cifs: dump_stack() only when non-interrupt error in AIO | expand

Commit Message

Enzo Matsumiya Sept. 14, 2022, 6:54 p.m. UTC
Int cifs_send_async_read() and cifs_write_from_iter(), check if rc is an
interrupt code and only call dump_stack() if it's not.

In SMB2_{read,write}, show a different error message if rc is an
interrupt code, as it gives more context to the users, e.g. the
operation was aborted by the user, so not really an error.

This can be observed when, e.g., running xfstests generic/208, where the
stack dump in ring buffer can be confusing, as the test actually passes.

Signed-off-by: Enzo Matsumiya <ematsumiya@suse.de>
---
 fs/cifs/file.c    |  8 ++++++--
 fs/cifs/smb2pdu.c | 10 ++++++++--
 2 files changed, 14 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index 6f38b134a346..e54c0144b71d 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -3278,7 +3278,9 @@  cifs_write_from_iter(loff_t offset, size_t len, struct iov_iter *from,
 					 "direct_writev couldn't get user pages (rc=%zd) iter type %d iov_offset %zd count %zd\n",
 					 result, iov_iter_type(from),
 					 from->iov_offset, from->count);
-				dump_stack();
+
+				if (!is_interrupt_error(result))
+					dump_stack();
 
 				rc = result;
 				add_credits_and_wake_if(server, credits, 0);
@@ -4018,7 +4020,9 @@  cifs_send_async_read(loff_t offset, size_t len, struct cifsFileInfo *open_file,
 					 result, iov_iter_type(&direct_iov),
 					 direct_iov.iov_offset,
 					 direct_iov.count);
-				dump_stack();
+
+				if (!is_interrupt_error(result))
+					dump_stack();
 
 				rc = result;
 				add_credits_and_wake_if(server, credits, 0);
diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
index 6352ab32c7e7..c9f5adc0d0d0 100644
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -4313,7 +4313,10 @@  SMB2_read(const unsigned int xid, struct cifs_io_parms *io_parms,
 	if (rc) {
 		if (rc != -ENODATA) {
 			cifs_stats_fail_inc(io_parms->tcon, SMB2_READ_HE);
-			cifs_dbg(VFS, "Send error in read = %d\n", rc);
+			if (is_interrupt_error(rc))
+				cifs_dbg(VFS, "Read interrupted (%d), aborting\n", rc);
+			else
+				cifs_dbg(VFS, "Send error in read, rc=%d\n", rc);
 			trace_smb3_read_err(xid,
 					    req->PersistentFileId,
 					    io_parms->tcon->tid, ses->Suid,
@@ -4656,7 +4659,10 @@  SMB2_write(const unsigned int xid, struct cifs_io_parms *io_parms,
 				     io_parms->tcon->ses->Suid,
 				     io_parms->offset, io_parms->length, rc);
 		cifs_stats_fail_inc(io_parms->tcon, SMB2_WRITE_HE);
-		cifs_dbg(VFS, "Send error in write = %d\n", rc);
+		if (is_interrupt_error(rc))
+			cifs_dbg(VFS, "Write interrupted (%d), aborting\n", rc);
+		else
+			cifs_dbg(VFS, "Send error in write, rc=%d\n", rc);
 	} else {
 		*nbytes = le32_to_cpu(rsp->DataLength);
 		trace_smb3_write_done(xid,