From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pg1-f172.google.com (mail-pg1-f172.google.com [209.85.215.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6AC3317C3 for ; Sun, 31 Dec 2023 07:20:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pg1-f172.google.com with SMTP id 41be03b00d2f7-5ce74ea4bf2so761109a12.0 for ; Sat, 30 Dec 2023 23:20:30 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704007230; x=1704612030; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Q9WXDUTHdJPdq5Ugq7bQZyZRDVbawi4P1uOGzQryv+E=; b=CeXrYqnGlEIKrbSFvoSpz1OoZwrjkZf8GBCgPM4Hmvb3vpxPNb1iToy26oXy1mC3dd aKi5ZK9EcpB+Md5QuJB4zSr96h9Ns47oavDYhZNZckAUEh8/u245bFbqWaeHWkbLnQUq LcPyHBOAfVTJS4PQXYvRkv0T/+cBYIYg2W9cGDGS4iomjOLSqTy1FDw/QEF4QkNXqXVv EHoy3zch2UCRYkuupFKNUoc0cDA2/3l5juFdCWqIM1+WG/ZJIAwD3LZ5J2LYXQ0Szsgm WodsLU0/dgod8oM2JZDfZlRxQ+n+5xw2bT0RYBaEpgqC/sm3EGhzfSPNEBJME4emz1N1 UCfA== X-Gm-Message-State: AOJu0YzpTy0rggT09CsoOdoxkF9QGxtlEuNqx7H6EF/MxZcXCGCZfuxQ SqBlDGNwTNtHlL4vAz0yBlk= X-Google-Smtp-Source: AGHT+IFzW7qn97JccBN5WpmLbusSaPZE1P+kICERaiAdXHZ0bYyOszXPvSQ/GdSHlyANEEYmlWMPaQ== X-Received: by 2002:a05:6a21:3296:b0:196:28a2:c8d with SMTP id yt22-20020a056a21329600b0019628a20c8dmr6727603pzb.46.1704007229847; Sat, 30 Dec 2023 23:20:29 -0800 (PST) Received: from localhost.localdomain ([110.14.71.32]) by smtp.gmail.com with ESMTPSA id s16-20020a63f050000000b005b7dd356f75sm17425312pgj.32.2023.12.30.23.20.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Dec 2023 23:20:29 -0800 (PST) From: Namjae Jeon To: gregkh@linuxfoundation.org, stable@vger.kernel.org, sashal@kernel.org Cc: smfrench@gmail.com, Namjae Jeon , Steve French Subject: [PATCH 6.6.y 15/19] ksmbd: set v2 lease capability Date: Sun, 31 Dec 2023 16:19:15 +0900 Message-Id: <20231231071919.32103-16-linkinjeon@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231231071919.32103-1-linkinjeon@kernel.org> References: <20231231071919.32103-1-linkinjeon@kernel.org> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit [ Upstream commit 18dd1c367c31d0a060f737d48345747662369b64 ] Set SMB2_GLOBAL_CAP_DIRECTORY_LEASING to ->capabilities to inform server support directory lease to client. Signed-off-by: Namjae Jeon Signed-off-by: Steve French --- fs/smb/server/oplock.c | 4 ---- fs/smb/server/smb2ops.c | 9 ++++++--- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/fs/smb/server/oplock.c b/fs/smb/server/oplock.c index ff5c83b1fb85..5ef6af68d0de 100644 --- a/fs/smb/server/oplock.c +++ b/fs/smb/server/oplock.c @@ -1105,10 +1105,6 @@ int smb_grant_oplock(struct ksmbd_work *work, int req_op_level, u64 pid, bool prev_op_has_lease; __le32 prev_op_state = 0; - /* not support directory lease */ - if (S_ISDIR(file_inode(fp->filp)->i_mode)) - return 0; - opinfo = alloc_opinfo(work, pid, tid); if (!opinfo) return -ENOMEM; diff --git a/fs/smb/server/smb2ops.c b/fs/smb/server/smb2ops.c index aed7704a0672..27a9dce3e03a 100644 --- a/fs/smb/server/smb2ops.c +++ b/fs/smb/server/smb2ops.c @@ -221,7 +221,8 @@ void init_smb3_0_server(struct ksmbd_conn *conn) conn->signing_algorithm = SIGNING_ALG_AES_CMAC_LE; if (server_conf.flags & KSMBD_GLOBAL_FLAG_SMB2_LEASES) - conn->vals->capabilities |= SMB2_GLOBAL_CAP_LEASING; + conn->vals->capabilities |= SMB2_GLOBAL_CAP_LEASING | + SMB2_GLOBAL_CAP_DIRECTORY_LEASING; if (server_conf.flags & KSMBD_GLOBAL_FLAG_SMB2_ENCRYPTION && conn->cli_cap & SMB2_GLOBAL_CAP_ENCRYPTION) @@ -245,7 +246,8 @@ void init_smb3_02_server(struct ksmbd_conn *conn) conn->signing_algorithm = SIGNING_ALG_AES_CMAC_LE; if (server_conf.flags & KSMBD_GLOBAL_FLAG_SMB2_LEASES) - conn->vals->capabilities |= SMB2_GLOBAL_CAP_LEASING; + conn->vals->capabilities |= SMB2_GLOBAL_CAP_LEASING | + SMB2_GLOBAL_CAP_DIRECTORY_LEASING; if (server_conf.flags & KSMBD_GLOBAL_FLAG_SMB2_ENCRYPTION || (!(server_conf.flags & KSMBD_GLOBAL_FLAG_SMB2_ENCRYPTION_OFF) && @@ -270,7 +272,8 @@ int init_smb3_11_server(struct ksmbd_conn *conn) conn->signing_algorithm = SIGNING_ALG_AES_CMAC_LE; if (server_conf.flags & KSMBD_GLOBAL_FLAG_SMB2_LEASES) - conn->vals->capabilities |= SMB2_GLOBAL_CAP_LEASING; + conn->vals->capabilities |= SMB2_GLOBAL_CAP_LEASING | + SMB2_GLOBAL_CAP_DIRECTORY_LEASING; if (server_conf.flags & KSMBD_GLOBAL_FLAG_SMB2_ENCRYPTION || (!(server_conf.flags & KSMBD_GLOBAL_FLAG_SMB2_ENCRYPTION_OFF) && -- 2.25.1