Commit 520da3c4 authored by Namjae Jeon's avatar Namjae Jeon Committed by Steve French
Browse files

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: default avatarNamjae Jeon <linkinjeon@kernel.org>
Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
parent 051d469b
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -477,7 +477,10 @@ struct ksmbd_file *ksmbd_lookup_durable_fd(unsigned long long id)
	struct ksmbd_file *fp;

	fp = __ksmbd_lookup_fd(&global_ft, id);
	if (fp && fp->conn) {
	if (fp && (fp->conn ||
		   (fp->durable_scavenger_timeout &&
		    (fp->durable_scavenger_timeout <
		     jiffies_to_msecs(jiffies))))) {
		ksmbd_put_durable_fd(fp);
		fp = NULL;
	}
@@ -718,6 +721,10 @@ static bool session_fd_check(struct ksmbd_tree_connect *tcon,
	fp->tcon = NULL;
	fp->volatile_id = KSMBD_NO_FID;

	if (fp->durable_timeout)
		fp->durable_scavenger_timeout =
			jiffies_to_msecs(jiffies) + fp->durable_timeout;

	return true;
}

+1 −0
Original line number Diff line number Diff line
@@ -101,6 +101,7 @@ struct ksmbd_file {
	struct list_head		lock_list;

	int				durable_timeout;
	int				durable_scavenger_timeout;

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