diff options
author | Ritvik Budhiraja <rbudhiraja@microsoft.com> | 2024-04-02 14:01:28 -0500 |
---|---|---|
committer | Steve French <stfrench@microsoft.com> | 2024-04-03 14:43:24 -0500 |
commit | 173217bd73365867378b5e75a86f0049e1069ee8 (patch) | |
tree | 4357a373f7c39bbd02b98fa3f20aec7089f1cd0b /fs/smb/client/cached_dir.c | |
parent | 93cee45ccfebc62a3bb4cd622b89e00c8c7d8493 (diff) | |
download | linux-stable-173217bd73365867378b5e75a86f0049e1069ee8.tar.gz linux-stable-173217bd73365867378b5e75a86f0049e1069ee8.tar.bz2 linux-stable-173217bd73365867378b5e75a86f0049e1069ee8.zip |
smb3: retrying on failed server close
In the current implementation, CIFS close sends a close to the
server and does not check for the success of the server close.
This patch adds functionality to check for server close return
status and retries in case of an EBUSY or EAGAIN error.
This can help avoid handle leaks
Cc: stable@vger.kernel.org
Signed-off-by: Ritvik Budhiraja <rbudhiraja@microsoft.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Diffstat (limited to 'fs/smb/client/cached_dir.c')
-rw-r--r-- | fs/smb/client/cached_dir.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/smb/client/cached_dir.c b/fs/smb/client/cached_dir.c index a0017724d523..13a9d7acf8f8 100644 --- a/fs/smb/client/cached_dir.c +++ b/fs/smb/client/cached_dir.c @@ -417,6 +417,7 @@ smb2_close_cached_fid(struct kref *ref) { struct cached_fid *cfid = container_of(ref, struct cached_fid, refcount); + int rc; spin_lock(&cfid->cfids->cfid_list_lock); if (cfid->on_list) { @@ -430,9 +431,10 @@ smb2_close_cached_fid(struct kref *ref) cfid->dentry = NULL; if (cfid->is_open) { - SMB2_close(0, cfid->tcon, cfid->fid.persistent_fid, + rc = SMB2_close(0, cfid->tcon, cfid->fid.persistent_fid, cfid->fid.volatile_fid); - atomic_dec(&cfid->tcon->num_remote_opens); + if (rc != -EBUSY && rc != -EAGAIN) + atomic_dec(&cfid->tcon->num_remote_opens); } free_cached_dir(cfid); |