Skip to content

Commit 520da3c

Browse files
namjaejeonsmfrench
authored andcommitted
ksmbd: avoid reclaiming expired durable opens by the client
The expired durable opens should not be reclaimed by client. This patch add ->durable_scavenger_timeout to fp and check it in ksmbd_lookup_durable_fd(). Signed-off-by: Namjae Jeon <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent 051d469 commit 520da3c

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

fs/smb/server/vfs_cache.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,10 @@ struct ksmbd_file *ksmbd_lookup_durable_fd(unsigned long long id)
477477
struct ksmbd_file *fp;
478478

479479
fp = __ksmbd_lookup_fd(&global_ft, id);
480-
if (fp && fp->conn) {
480+
if (fp && (fp->conn ||
481+
(fp->durable_scavenger_timeout &&
482+
(fp->durable_scavenger_timeout <
483+
jiffies_to_msecs(jiffies))))) {
481484
ksmbd_put_durable_fd(fp);
482485
fp = NULL;
483486
}
@@ -718,6 +721,10 @@ static bool session_fd_check(struct ksmbd_tree_connect *tcon,
718721
fp->tcon = NULL;
719722
fp->volatile_id = KSMBD_NO_FID;
720723

724+
if (fp->durable_timeout)
725+
fp->durable_scavenger_timeout =
726+
jiffies_to_msecs(jiffies) + fp->durable_timeout;
727+
721728
return true;
722729
}
723730

fs/smb/server/vfs_cache.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ struct ksmbd_file {
101101
struct list_head lock_list;
102102

103103
int durable_timeout;
104+
int durable_scavenger_timeout;
104105

105106
/* if ls is happening on directory, below is valid*/
106107
struct ksmbd_readdir_data readdir_data;

0 commit comments

Comments
 (0)