Skip to content

Commit

Permalink
cifs: release leases for deferred close handles when freezing
Browse files Browse the repository at this point in the history
commit d39fc59 upstream.

We should not be caching closed files when freeze is invoked on an fs
(so we can release resources more gracefully).

Fixes xfstests generic/068 generic/390 generic/491

Reviewed-by: David Howells <dhowells@redhat.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Steve French authored and gregkh committed May 17, 2023
1 parent 187f89c commit b886ad6
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions fs/cifs/cifsfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -758,6 +758,20 @@ static void cifs_umount_begin(struct super_block *sb)
return;
}

static int cifs_freeze(struct super_block *sb)
{
struct cifs_sb_info *cifs_sb = CIFS_SB(sb);
struct cifs_tcon *tcon;

if (cifs_sb == NULL)
return 0;

tcon = cifs_sb_master_tcon(cifs_sb);

cifs_close_all_deferred_files(tcon);
return 0;
}

#ifdef CONFIG_CIFS_STATS2
static int cifs_show_stats(struct seq_file *s, struct dentry *root)
{
Expand Down Expand Up @@ -796,6 +810,7 @@ static const struct super_operations cifs_super_ops = {
as opens */
.show_options = cifs_show_options,
.umount_begin = cifs_umount_begin,
.freeze_fs = cifs_freeze,
#ifdef CONFIG_CIFS_STATS2
.show_stats = cifs_show_stats,
#endif
Expand Down

0 comments on commit b886ad6

Please sign in to comment.