Skip to content

Commit

Permalink
cifs: allow syscalls to be restarted in __smb_send_rqst()
Browse files Browse the repository at this point in the history
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 the kernel decide to whether or not restart the syscalls when
there is a signal pending in __smb_send_rqst() by returning
-ERESTARTSYS.  If it can't, it will return -EINTR anyway.

Signed-off-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
CC: Stable <stable@vger.kernel.org>
Reviewed-by: Ronnie Sahlberg <lsahlber@redhat.com>
Reviewed-by: Pavel Shilovsky <pshilov@microsoft.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
  • Loading branch information
pcacjr authored and Steve French committed Nov 30, 2020
1 parent b650545 commit 6988a61
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions fs/cifs/transport.c
Original file line number Diff line number Diff line change
Expand Up @@ -339,8 +339,8 @@ __smb_send_rqst(struct TCP_Server_Info *server, int num_rqst,
return -EAGAIN;

if (signal_pending(current)) {
cifs_dbg(FYI, "signal is pending before sending any data\n");
return -EINTR;
cifs_dbg(FYI, "signal pending before send request\n");
return -ERESTARTSYS;
}

/* cork the socket */
Expand Down

0 comments on commit 6988a61

Please sign in to comment.