Message ID | 20230508190103.601678-1-bharathsm.hsk@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | SMB3: Close all deferred handles of inode in case of handle lease break | expand |
Attached updated patch with expanded commit message. On Tue, May 9, 2023 at 12:32 AM Bharath SM <bharathsm.hsk@gmail.com> wrote: > > Oplock break may occur for different file handle than the deferred handle. > Check for inode deferred closes list, if it's not empty then close all the > deferred handles of inode. > > Fixes: 9e31678fb403 ("SMB3: fix lease break timeout when multiple deferred close handles for the same file.") > Signed-off-by: Bharath SM <bharathsm@microsoft.com> > --- > fs/cifs/file.c | 9 +-------- > 1 file changed, 1 insertion(+), 8 deletions(-) > > diff --git a/fs/cifs/file.c b/fs/cifs/file.c > index 791a12575109..260d5ec878e8 100644 > --- a/fs/cifs/file.c > +++ b/fs/cifs/file.c > @@ -4886,8 +4886,6 @@ void cifs_oplock_break(struct work_struct *work) > struct TCP_Server_Info *server = tcon->ses->server; > int rc = 0; > bool purge_cache = false; > - struct cifs_deferred_close *dclose; > - bool is_deferred = false; > > wait_on_bit(&cinode->flags, CIFS_INODE_PENDING_WRITERS, > TASK_UNINTERRUPTIBLE); > @@ -4928,14 +4926,9 @@ void cifs_oplock_break(struct work_struct *work) > * file handles but cached, then schedule deferred close immediately. > * So, new open will not use cached handle. > */ > - spin_lock(&CIFS_I(inode)->deferred_lock); > - is_deferred = cifs_is_deferred_close(cfile, &dclose); > - spin_unlock(&CIFS_I(inode)->deferred_lock); > > - if (!CIFS_CACHE_HANDLE(cinode) && is_deferred && > - cfile->deferred_close_scheduled && delayed_work_pending(&cfile->deferred)) { > + if (!CIFS_CACHE_HANDLE(cinode) && !list_empty(&cinode->deferred_closes)) > cifs_close_deferred_file(cinode); > - } > > /* > * releasing stale oplock after recent reconnect of smb session using > -- > 2.34.1 >
On Tue, May 16, 2023 at 2:19 AM Bharath SM <bharathsm.hsk@gmail.com> wrote: > > Attached updated patch with expanded commit message. > > On Tue, May 9, 2023 at 12:32 AM Bharath SM <bharathsm.hsk@gmail.com> wrote: > > > > Oplock break may occur for different file handle than the deferred handle. > > Check for inode deferred closes list, if it's not empty then close all the > > deferred handles of inode. > > > > Fixes: 9e31678fb403 ("SMB3: fix lease break timeout when multiple deferred close handles for the same file.") > > Signed-off-by: Bharath SM <bharathsm@microsoft.com> > > --- > > fs/cifs/file.c | 9 +-------- > > 1 file changed, 1 insertion(+), 8 deletions(-) > > > > diff --git a/fs/cifs/file.c b/fs/cifs/file.c > > index 791a12575109..260d5ec878e8 100644 > > --- a/fs/cifs/file.c > > +++ b/fs/cifs/file.c > > @@ -4886,8 +4886,6 @@ void cifs_oplock_break(struct work_struct *work) > > struct TCP_Server_Info *server = tcon->ses->server; > > int rc = 0; > > bool purge_cache = false; > > - struct cifs_deferred_close *dclose; > > - bool is_deferred = false; > > > > wait_on_bit(&cinode->flags, CIFS_INODE_PENDING_WRITERS, > > TASK_UNINTERRUPTIBLE); > > @@ -4928,14 +4926,9 @@ void cifs_oplock_break(struct work_struct *work) > > * file handles but cached, then schedule deferred close immediately. > > * So, new open will not use cached handle. > > */ > > - spin_lock(&CIFS_I(inode)->deferred_lock); > > - is_deferred = cifs_is_deferred_close(cfile, &dclose); > > - spin_unlock(&CIFS_I(inode)->deferred_lock); > > > > - if (!CIFS_CACHE_HANDLE(cinode) && is_deferred && > > - cfile->deferred_close_scheduled && delayed_work_pending(&cfile->deferred)) { > > + if (!CIFS_CACHE_HANDLE(cinode) && !list_empty(&cinode->deferred_closes)) > > cifs_close_deferred_file(cinode); > > - } > > > > /* > > * releasing stale oplock after recent reconnect of smb session using > > -- > > 2.34.1 > > Changes look good to me.
diff --git a/fs/cifs/file.c b/fs/cifs/file.c index 791a12575109..260d5ec878e8 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c @@ -4886,8 +4886,6 @@ void cifs_oplock_break(struct work_struct *work) struct TCP_Server_Info *server = tcon->ses->server; int rc = 0; bool purge_cache = false; - struct cifs_deferred_close *dclose; - bool is_deferred = false; wait_on_bit(&cinode->flags, CIFS_INODE_PENDING_WRITERS, TASK_UNINTERRUPTIBLE); @@ -4928,14 +4926,9 @@ void cifs_oplock_break(struct work_struct *work) * file handles but cached, then schedule deferred close immediately. * So, new open will not use cached handle. */ - spin_lock(&CIFS_I(inode)->deferred_lock); - is_deferred = cifs_is_deferred_close(cfile, &dclose); - spin_unlock(&CIFS_I(inode)->deferred_lock); - if (!CIFS_CACHE_HANDLE(cinode) && is_deferred && - cfile->deferred_close_scheduled && delayed_work_pending(&cfile->deferred)) { + if (!CIFS_CACHE_HANDLE(cinode) && !list_empty(&cinode->deferred_closes)) cifs_close_deferred_file(cinode); - } /* * releasing stale oplock after recent reconnect of smb session using
Oplock break may occur for different file handle than the deferred handle. Check for inode deferred closes list, if it's not empty then close all the deferred handles of inode. Fixes: 9e31678fb403 ("SMB3: fix lease break timeout when multiple deferred close handles for the same file.") Signed-off-by: Bharath SM <bharathsm@microsoft.com> --- fs/cifs/file.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-)