diff mbox series

cifs: fix interrupted close commands

Message ID 20210113171616.11730-1-pc@cjr.nz (mailing list archive)
State New, archived
Headers show
Series cifs: fix interrupted close commands | expand

Commit Message

Paulo Alcantara Jan. 13, 2021, 5:16 p.m. UTC
Retry close command if it gets interrupted to not leak open handles on
the server.

Signed-off-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
Reported-by: Duncan Findlay <duncf@duncf.ca>
Suggested-by: Pavel Shilovsky <pshilov@microsoft.com>
Fixes: 6988a619f5b7 ("cifs: allow syscalls to be restarted in __smb_send_rqst()")
Cc: stable@vger.kernel.org
---
 fs/cifs/smb2pdu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Pavel Shilovsky Jan. 13, 2021, 6:28 p.m. UTC | #1
ср, 13 янв. 2021 г. в 09:16, Paulo Alcantara <pc@cjr.nz>:
>
> Retry close command if it gets interrupted to not leak open handles on
> the server.
>
> Signed-off-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
> Reported-by: Duncan Findlay <duncf@duncf.ca>
> Suggested-by: Pavel Shilovsky <pshilov@microsoft.com>
> Fixes: 6988a619f5b7 ("cifs: allow syscalls to be restarted in __smb_send_rqst()")
> Cc: stable@vger.kernel.org
> ---
>  fs/cifs/smb2pdu.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
> index 067eb44c7baa..794fc3b68b4f 100644
> --- a/fs/cifs/smb2pdu.c
> +++ b/fs/cifs/smb2pdu.c
> @@ -3248,7 +3248,7 @@ __SMB2_close(const unsigned int xid, struct cifs_tcon *tcon,
>         free_rsp_buf(resp_buftype, rsp);
>
>         /* retry close in a worker thread if this one is interrupted */
> -       if (rc == -EINTR) {
> +       if (is_interrupt_error(rc)) {
>                 int tmp_rc;
>
>                 tmp_rc = smb2_handle_cancelled_close(tcon, persistent_fid,
> --
> 2.29.2
>

Thanks for the fix!

Reviewed-by: Pavel Shilovsky <pshilov@microsoft.com>

--
Best regards,
Pavel Shilovsky
Shyam Prasad N Jan. 14, 2021, 7:32 a.m. UTC | #2
Hi Paulo,

Does is_interrupt_error contain a list of all errors for which server
can leave the file handle open?
What about EAGAIN? I see that the server error STATUS_RETRY maps to EAGAIN.

Regards,
Shyam

On Thu, Jan 14, 2021 at 12:01 AM Pavel Shilovsky <piastryyy@gmail.com> wrote:
>
> ср, 13 янв. 2021 г. в 09:16, Paulo Alcantara <pc@cjr.nz>:
> >
> > Retry close command if it gets interrupted to not leak open handles on
> > the server.
> >
> > Signed-off-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
> > Reported-by: Duncan Findlay <duncf@duncf.ca>
> > Suggested-by: Pavel Shilovsky <pshilov@microsoft.com>
> > Fixes: 6988a619f5b7 ("cifs: allow syscalls to be restarted in __smb_send_rqst()")
> > Cc: stable@vger.kernel.org
> > ---
> >  fs/cifs/smb2pdu.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
> > index 067eb44c7baa..794fc3b68b4f 100644
> > --- a/fs/cifs/smb2pdu.c
> > +++ b/fs/cifs/smb2pdu.c
> > @@ -3248,7 +3248,7 @@ __SMB2_close(const unsigned int xid, struct cifs_tcon *tcon,
> >         free_rsp_buf(resp_buftype, rsp);
> >
> >         /* retry close in a worker thread if this one is interrupted */
> > -       if (rc == -EINTR) {
> > +       if (is_interrupt_error(rc)) {
> >                 int tmp_rc;
> >
> >                 tmp_rc = smb2_handle_cancelled_close(tcon, persistent_fid,
> > --
> > 2.29.2
> >
>
> Thanks for the fix!
>
> Reviewed-by: Pavel Shilovsky <pshilov@microsoft.com>
>
> --
> Best regards,
> Pavel Shilovsky
Pavel Shilovskiy Jan. 14, 2021, 5:22 p.m. UTC | #3
Hi Shyam,

Is_interrupt_error contains a list of errors that correspond to interrupted requests that haven't made it to the server.

Best regards,
Pavel Shilovsky

-----Original Message-----
From: Shyam Prasad N <nspmangalore@gmail.com> 
Sent: Wednesday, January 13, 2021 11:33 PM
To: Pavel Shilovsky <piastryyy@gmail.com>
Cc: pc <pc@cjr.nz>; linux-cifs <linux-cifs@vger.kernel.org>; Steve French <smfrench@gmail.com>; Aurelien Aptel <aaptel@suse.com>; Duncan Findlay <duncf@duncf.ca>; Pavel Shilovskiy <pshilov@microsoft.com>; Stable <stable@vger.kernel.org>
Subject: [EXTERNAL] Re: [PATCH] cifs: fix interrupted close commands

Hi Paulo,

Does is_interrupt_error contain a list of all errors for which server can leave the file handle open?
What about EAGAIN? I see that the server error STATUS_RETRY maps to EAGAIN.

Regards,
Shyam

On Thu, Jan 14, 2021 at 12:01 AM Pavel Shilovsky <piastryyy@gmail.com> wrote:
>
> ср, 13 янв. 2021 г. в 09:16, Paulo Alcantara <pc@cjr.nz>:
> >
> > Retry close command if it gets interrupted to not leak open handles 
> > on the server.
> >
> > Signed-off-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
> > Reported-by: Duncan Findlay <duncf@duncf.ca>
> > Suggested-by: Pavel Shilovsky <pshilov@microsoft.com>
> > Fixes: 6988a619f5b7 ("cifs: allow syscalls to be restarted in 
> > __smb_send_rqst()")
> > Cc: stable@vger.kernel.org
> > ---
> >  fs/cifs/smb2pdu.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c index 
> > 067eb44c7baa..794fc3b68b4f 100644
> > --- a/fs/cifs/smb2pdu.c
> > +++ b/fs/cifs/smb2pdu.c
> > @@ -3248,7 +3248,7 @@ __SMB2_close(const unsigned int xid, struct cifs_tcon *tcon,
> >         free_rsp_buf(resp_buftype, rsp);
> >
> >         /* retry close in a worker thread if this one is interrupted */
> > -       if (rc == -EINTR) {
> > +       if (is_interrupt_error(rc)) {
> >                 int tmp_rc;
> >
> >                 tmp_rc = smb2_handle_cancelled_close(tcon, 
> > persistent_fid,
> > --
> > 2.29.2
> >
>
> Thanks for the fix!
>
> Reviewed-by: Pavel Shilovsky <pshilov@microsoft.com>
>
> --
> Best regards,
> Pavel Shilovsky



--
-Shyam
diff mbox series

Patch

diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
index 067eb44c7baa..794fc3b68b4f 100644
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -3248,7 +3248,7 @@  __SMB2_close(const unsigned int xid, struct cifs_tcon *tcon,
 	free_rsp_buf(resp_buftype, rsp);
 
 	/* retry close in a worker thread if this one is interrupted */
-	if (rc == -EINTR) {
+	if (is_interrupt_error(rc)) {
 		int tmp_rc;
 
 		tmp_rc = smb2_handle_cancelled_close(tcon, persistent_fid,