diff mbox series

missing update to deferred_close_scheduled field

Message ID CAH2r5mvShnJidFDQkdULTDQFteSKimcphT_GGfVb0zXx9PkNcQ@mail.gmail.com (mailing list archive)
State New, archived
Headers show
Series missing update to deferred_close_scheduled field | expand

Commit Message

Steve French Aug. 19, 2022, 4:48 p.m. UTC
> we are missing a line like this:
>
>        cfile->deferred_close_scheduled = false;
>
> in cifs_open here:
>
>         /* Get the cached handle as SMB2 close is deferred */
>         rc = cifs_get_readable_path(tcon, full_path, &cfile);
>         if (rc == 0) {
>                 if (file->f_flags == cfile->f_flags) {
>                         file->private_data = cfile;
>                         spin_lock(&CIFS_I(inode)->deferred_lock);
>                         cifs_del_deferred_close(cfile);
>                         spin_unlock(&CIFS_I(inode)->deferred_lock);
>                         goto use_cache;

So move set of deferred_close_scheduled = false into cifs_del_deferred_close

See attached

Comments

Steve French Aug. 19, 2022, 7:24 p.m. UTC | #1
forgot to attach the correct version of the patch (had a cut-n-paste
error on one line)


On Fri, Aug 19, 2022 at 11:48 AM Steve French <smfrench@gmail.com> wrote:
>
> > we are missing a line like this:
> >
> >        cfile->deferred_close_scheduled = false;
> >
> > in cifs_open here:
> >
> >         /* Get the cached handle as SMB2 close is deferred */
> >         rc = cifs_get_readable_path(tcon, full_path, &cfile);
> >         if (rc == 0) {
> >                 if (file->f_flags == cfile->f_flags) {
> >                         file->private_data = cfile;
> >                         spin_lock(&CIFS_I(inode)->deferred_lock);
> >                         cifs_del_deferred_close(cfile);
> >                         spin_unlock(&CIFS_I(inode)->deferred_lock);
> >                         goto use_cache;
>
> So move set of deferred_close_scheduled = false into cifs_del_deferred_close
>
> See attached
>
> --
> Thanks,
>
> Steve
Steve French Aug. 19, 2022, 9:33 p.m. UTC | #2
This patch seems to cause an rmmod failure (after unmount) - will need
to test it more

On Fri, Aug 19, 2022 at 2:24 PM Steve French <smfrench@gmail.com> wrote:
>
> forgot to attach the correct version of the patch (had a cut-n-paste
> error on one line)
>
>
> On Fri, Aug 19, 2022 at 11:48 AM Steve French <smfrench@gmail.com> wrote:
> >
> > > we are missing a line like this:
> > >
> > >        cfile->deferred_close_scheduled = false;
> > >
> > > in cifs_open here:
> > >
> > >         /* Get the cached handle as SMB2 close is deferred */
> > >         rc = cifs_get_readable_path(tcon, full_path, &cfile);
> > >         if (rc == 0) {
> > >                 if (file->f_flags == cfile->f_flags) {
> > >                         file->private_data = cfile;
> > >                         spin_lock(&CIFS_I(inode)->deferred_lock);
> > >                         cifs_del_deferred_close(cfile);
> > >                         spin_unlock(&CIFS_I(inode)->deferred_lock);
> > >                         goto use_cache;
> >
> > So move set of deferred_close_scheduled = false into cifs_del_deferred_close
> >
> > See attached
> >
> > --
> > Thanks,
> >
> > Steve
>
>
>
> --
> Thanks,
>
> Steve
diff mbox series

Patch

From 90153ed5351576b3f1a4943593664d52c7f8d82c Mon Sep 17 00:00:00 2001
From: Steve French <stfrench@microsoft.com>
Date: Fri, 19 Aug 2022 11:33:44 -0500
Subject: [PATCH] smb3: missing update to whether a close is deferred in a
 reopen path

When deleting a file handle from the deferred close list we
were missing update to cfile->deferred_close_scheduled

Reviewed-by: Shyam Prasad N <sprasad@microsoft.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
---
 fs/cifs/file.c | 1 -
 fs/cifs/misc.c | 1 +
 2 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index fa738adc031f..12bf0414dc84 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -930,7 +930,6 @@  void smb2_deferred_work_close(struct work_struct *work)
 
 	spin_lock(&CIFS_I(d_inode(cfile->dentry))->deferred_lock);
 	cifs_del_deferred_close(cfile);
-	cfile->deferred_close_scheduled = false;
 	spin_unlock(&CIFS_I(d_inode(cfile->dentry))->deferred_lock);
 	_cifsFileInfo_put(cfile, true, false);
 }
diff --git a/fs/cifs/misc.c b/fs/cifs/misc.c
index 87f60f736731..3e99dd4085eb 100644
--- a/fs/cifs/misc.c
+++ b/fs/cifs/misc.c
@@ -718,6 +718,7 @@  cifs_del_deferred_close(struct cifsFileInfo *cfile)
 	is_deferred = cifs_is_deferred_close(cfile, &dclose);
 	if (!is_deferred)
 		return;
+	deferred_close_scheduled = false;
 	list_del(&dclose->dlist);
 	kfree(dclose);
 }
-- 
2.34.1