* [PATCH] cifs: allow syscalls to be restarted in __smb_send_rqst()
@ 2020-11-28 18:57 Paulo Alcantara
[not found] ` <CAH2r5msFYUB7RmWjCxQH8s8Amz4eET8_u8V5qZq3KMhdRFDPrA@mail.gmail.com>
2020-11-30 10:29 ` Aurélien Aptel
0 siblings, 2 replies; 7+ messages in thread
From: Paulo Alcantara @ 2020-11-28 18:57 UTC (permalink / raw)
To: linux-cifs, smfrench; +Cc: Paulo Alcantara
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@cjr.nz>
---
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
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] cifs: allow syscalls to be restarted in __smb_send_rqst()
[not found] ` <CAH2r5msFYUB7RmWjCxQH8s8Amz4eET8_u8V5qZq3KMhdRFDPrA@mail.gmail.com>
@ 2020-11-29 16:40 ` Paulo Alcantara
0 siblings, 0 replies; 7+ messages in thread
From: Paulo Alcantara @ 2020-11-29 16:40 UTC (permalink / raw)
To: Steve French; +Cc: CIFS
Steve French <smfrench@gmail.com> writes:
> Did it fix the customer application?
Yes, it did.
> Thoughts on cc:stable?
Looks like a great candidate, yes.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] cifs: allow syscalls to be restarted in __smb_send_rqst()
2020-11-28 18:57 [PATCH] cifs: allow syscalls to be restarted in __smb_send_rqst() Paulo Alcantara
[not found] ` <CAH2r5msFYUB7RmWjCxQH8s8Amz4eET8_u8V5qZq3KMhdRFDPrA@mail.gmail.com>
@ 2020-11-30 10:29 ` Aurélien Aptel
2020-11-30 13:02 ` Paulo Alcantara
1 sibling, 1 reply; 7+ messages in thread
From: Aurélien Aptel @ 2020-11-30 10:29 UTC (permalink / raw)
To: Paulo Alcantara, linux-cifs, smfrench; +Cc: Paulo Alcantara
Paulo Alcantara <pc@cjr.nz> writes:
> 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;
Can we keep the debug message call?
Cheers,
--
Aurélien Aptel / SUSE Labs Samba Team
GPG: 1839 CB5F 9F5B FB9B AA97 8C99 03C8 A49B 521B D5D3
SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg, DE
GF: Felix Imendörffer, Mary Higgins, Sri Rasiah HRB 247165 (AG München)
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] cifs: allow syscalls to be restarted in __smb_send_rqst()
2020-11-30 10:29 ` Aurélien Aptel
@ 2020-11-30 13:02 ` Paulo Alcantara
2020-11-30 16:24 ` Steve French
0 siblings, 1 reply; 7+ messages in thread
From: Paulo Alcantara @ 2020-11-30 13:02 UTC (permalink / raw)
To: Aurélien Aptel, linux-cifs, smfrench
Aurélien Aptel <aaptel@suse.com> writes:
> Paulo Alcantara <pc@cjr.nz> writes:
>> 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;
>
> Can we keep the debug message call?
Yes.
Steve, could you please update for-next with above debug msg?
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] cifs: allow syscalls to be restarted in __smb_send_rqst()
2020-11-30 13:02 ` Paulo Alcantara
@ 2020-11-30 16:24 ` Steve French
2020-11-30 16:34 ` Paulo Alcantara
0 siblings, 1 reply; 7+ messages in thread
From: Steve French @ 2020-11-30 16:24 UTC (permalink / raw)
To: Paulo Alcantara; +Cc: Aurélien Aptel, CIFS
On Mon, Nov 30, 2020 at 7:02 AM Paulo Alcantara <pc@cjr.nz> wrote:
>
> Aurélien Aptel <aaptel@suse.com> writes:
>
> > Paulo Alcantara <pc@cjr.nz> writes:
> >> 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;
> >
> > Can we keep the debug message call?
>
> Yes.
>
> Steve, could you please update for-next with above debug msg?
Done. Please check to see if my lightly modified debug message text is ok.
--
Thanks,
Steve
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] cifs: allow syscalls to be restarted in __smb_send_rqst()
2020-11-30 16:24 ` Steve French
@ 2020-11-30 16:34 ` Paulo Alcantara
2020-11-30 20:11 ` Pavel Shilovsky
0 siblings, 1 reply; 7+ messages in thread
From: Paulo Alcantara @ 2020-11-30 16:34 UTC (permalink / raw)
To: Steve French; +Cc: Aurélien Aptel, CIFS
Steve French <smfrench@gmail.com> writes:
> On Mon, Nov 30, 2020 at 7:02 AM Paulo Alcantara <pc@cjr.nz> wrote:
>>
>> Aurélien Aptel <aaptel@suse.com> writes:
>>
>> > Paulo Alcantara <pc@cjr.nz> writes:
>> >> 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;
>> >
>> > Can we keep the debug message call?
>>
>> Yes.
>>
>> Steve, could you please update for-next with above debug msg?
>
> Done. Please check to see if my lightly modified debug message text is ok.
OK for me. Thanks!
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] cifs: allow syscalls to be restarted in __smb_send_rqst()
2020-11-30 16:34 ` Paulo Alcantara
@ 2020-11-30 20:11 ` Pavel Shilovsky
0 siblings, 0 replies; 7+ messages in thread
From: Pavel Shilovsky @ 2020-11-30 20:11 UTC (permalink / raw)
To: Paulo Alcantara; +Cc: Steve French, Aurélien Aptel, CIFS
Agree with the patch. The original change was inspired by the existing
code returning -EINTR potentially after partially sending an SMB
packet. Returning -ERESTARTSYS seems like a right thing to do here.
Reviewed-by: Pavel Shilovsky <pshilov@microsoft.com>
--
Best regards,
Pavel Shilovsky
пн, 30 нояб. 2020 г. в 08:35, Paulo Alcantara <pc@cjr.nz>:
>
> Steve French <smfrench@gmail.com> writes:
>
> > On Mon, Nov 30, 2020 at 7:02 AM Paulo Alcantara <pc@cjr.nz> wrote:
> >>
> >> Aurélien Aptel <aaptel@suse.com> writes:
> >>
> >> > Paulo Alcantara <pc@cjr.nz> writes:
> >> >> 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;
> >> >
> >> > Can we keep the debug message call?
> >>
> >> Yes.
> >>
> >> Steve, could you please update for-next with above debug msg?
> >
> > Done. Please check to see if my lightly modified debug message text is ok.
>
> OK for me. Thanks!
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2020-11-30 20:12 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-28 18:57 [PATCH] cifs: allow syscalls to be restarted in __smb_send_rqst() Paulo Alcantara
[not found] ` <CAH2r5msFYUB7RmWjCxQH8s8Amz4eET8_u8V5qZq3KMhdRFDPrA@mail.gmail.com>
2020-11-29 16:40 ` Paulo Alcantara
2020-11-30 10:29 ` Aurélien Aptel
2020-11-30 13:02 ` Paulo Alcantara
2020-11-30 16:24 ` Steve French
2020-11-30 16:34 ` Paulo Alcantara
2020-11-30 20:11 ` Pavel Shilovsky
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).