[PATCH] cifs: allow syscalls to be restarted in __smb_send_rqst()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



A customer has reported that several files in their multi-threaded app
were left with size of 0 because most of the read(2) calls returned
-EINTR and they assumed no bytes were read.  Obviously, they could
have fixed it by simply retrying on -EINTR.

We noticed that most of the -EINTR on read(2) were due to real-time
signals sent by glibc to process wide credential changes (SIGRT_1),
and its signal handler had been established with SA_RESTART, in which
case those calls could have been automatically restarted by the
kernel.

Let me the kernel decide to whether or not restart the syscalls when
there is a signal pending in __smb_send_rqst() by returing
-ERESTARTSYS.  If it can't, it will return -EINTR anyway.

Signed-off-by: Paulo Alcantara (SUSE) <pc@xxxxxx>
---
 fs/cifs/transport.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c
index e27e255d40dd..55853b9ed13d 100644
--- a/fs/cifs/transport.c
+++ b/fs/cifs/transport.c
@@ -338,10 +338,8 @@ __smb_send_rqst(struct TCP_Server_Info *server, int num_rqst,
 	if (ssocket == NULL)
 		return -EAGAIN;
 
-	if (signal_pending(current)) {
-		cifs_dbg(FYI, "signal is pending before sending any data\n");
-		return -EINTR;
-	}
+	if (signal_pending(current))
+		return -ERESTARTSYS;
 
 	/* cork the socket */
 	tcp_sock_set_cork(ssocket->sk, true);
-- 
2.29.2




[Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux