From patchwork Fri Nov 12 19:13:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve French X-Patchwork-Id: 1554530 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=pomQorS5; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=linux-cifs-owner@vger.kernel.org; receiver=) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by bilbo.ozlabs.org (Postfix) with ESMTP id 4HrSsw1dvFz9s0r for ; Sat, 13 Nov 2021 06:13:23 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235483AbhKLTQN (ORCPT ); Fri, 12 Nov 2021 14:16:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49750 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235379AbhKLTQM (ORCPT ); Fri, 12 Nov 2021 14:16:12 -0500 Received: from mail-lf1-x12a.google.com (mail-lf1-x12a.google.com [IPv6:2a00:1450:4864:20::12a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 624E6C061766 for ; Fri, 12 Nov 2021 11:13:21 -0800 (PST) Received: by mail-lf1-x12a.google.com with SMTP id m27so343073lfj.12 for ; Fri, 12 Nov 2021 11:13:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:from:date:message-id:subject:to:cc; bh=2ME2XxSedMtGMH3gWRIcGR0XC5Xt7Rmzvk2hCvjwdz8=; b=pomQorS5cfLvCOLmjPYTBuUMUC1GjDR9S+gf9l6pAXQeVwTgsuktOQjKwesoDRGxSJ RmzVb3TMHBhQWPzCfPMjrPT1I19OCnjaR1FU+bulK6vmy7tA4iEEuSN7ZV+DSpivKqyz rwTq+nFxpm4fkDnr4f9wg5Ki6V/aZtB7GhC/0sLTFPv49ypJ0DEGdbtIcNEjuxG+eLs2 vmUkZKj0CAsd2wKutzfTRxhzrsxXxogeaZj1FfsRi0GCFCq9FqyG1NvneJLsANLMqZ5n rVvLOa7g0zbCGCaHAQlTLh0184wh+stphHB1eGgtlarWc+S0EoFznUPy5f4ZgueC2lR6 3+Rg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc; bh=2ME2XxSedMtGMH3gWRIcGR0XC5Xt7Rmzvk2hCvjwdz8=; b=cGP+AgM7ViIM0SZZrxkMJWPjh8GqLNJtnWoefIghA1ea7x55A64qE0CBxNfdWZ00tR yOp4XXng9ot050tXzm0p6zkvbRD4qB9o2b1F9W1iORj7Kk/xUU4M96PkocRtvJMPtdLr TPpkueFDUWol2/5pDRdZy6Gqf907J7EkWzDxahGa/0dygFeGq57t2vn/owk++Vw147Uh bpc+yR0pnG/iDAbLf+VNUWHT231aZCxCOde3PAg6kYpYxCoqxucVmzzekgG8ZCR1stbc YUr88+1/UU/EzKk9/O0YwA1Cl5WSaRMEbKXTN5TKH8SQjQsv+rhZknU9HMgL1iNJmmhB Qy8g== X-Gm-Message-State: AOAM531ui+ejDYxUI4yoknh+PXQfVwm1HnVKMfkO4qYCMCUVgdAz95C/ 3qfeQ0Ea0OVlEiLvjX+PKLF6ViNeJeU2VQi5EmNmfPsj X-Google-Smtp-Source: ABdhPJyvQAZjSvt6cHYzTI7MOfHi+dyrO5FwoAXd2K289vDpQgoUHwWnNY7t1OhWHgE+FpZGskUHjbAi3zg8t0KgNtU= X-Received: by 2002:a05:6512:3991:: with SMTP id j17mr15841937lfu.545.1636744399529; Fri, 12 Nov 2021 11:13:19 -0800 (PST) MIME-Version: 1.0 From: Steve French Date: Fri, 12 Nov 2021 13:13:08 -0600 Message-ID: Subject: [PATCH] updated version of the get_fscache_super_cookie fix To: CIFS Cc: David Howells , Paulo Alcantara Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org Had a build issue when DFS was disabled in the build - fixed in attached. From 02102744d364c1bca4a0da13c2a72656037f64eb Mon Sep 17 00:00:00 2001 From: Steve French Date: Wed, 10 Nov 2021 03:15:29 -0600 Subject: [PATCH] smb3: do not setup the fscache_super_cookie until fsinfo initialized We were calling cifs_fscache_get_super_cookie after tcon but before we queried the info (QFS_Info) we need to initialize the cookie properly. Also includes an additional check suggested by Paulo to make sure we don't initialize super cookie twice. Suggested-by: David Howells Reviewed-by: Paulo Alcantara (SUSE) Signed-off-by: Steve French --- fs/cifs/connect.c | 8 ++++++-- fs/cifs/fscache.c | 8 ++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 5c506f6ecd65..084605f7ce96 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c @@ -2350,8 +2350,6 @@ cifs_get_tcon(struct cifs_ses *ses, struct smb3_fs_context *ctx) list_add(&tcon->tcon_list, &ses->tcon_list); spin_unlock(&cifs_tcp_ses_lock); - cifs_fscache_get_super_cookie(tcon); - return tcon; out_fail: @@ -3003,6 +3001,12 @@ static int mount_get_conns(struct mount_ctx *mnt_ctx) cifs_dbg(VFS, "read only mount of RW share\n"); /* no need to log a RW mount of a typical RW share */ } + /* + * The cookie is initialized from volume info returned above. + * Inside cifs_fscache_get_super_cookie it checks + * that we do not get super cookie twice. + */ + cifs_fscache_get_super_cookie(tcon); } /* diff --git a/fs/cifs/fscache.c b/fs/cifs/fscache.c index 8eedd20c44ab..7e409a38a2d7 100644 --- a/fs/cifs/fscache.c +++ b/fs/cifs/fscache.c @@ -87,6 +87,14 @@ void cifs_fscache_get_super_cookie(struct cifs_tcon *tcon) char *sharename; struct cifs_fscache_super_auxdata auxdata; + /* + * Check if cookie was already initialized so don't reinitialize it. + * In the future, as we integrate with newer fscache features, + * we may want to instead add a check if cookie has changed + */ + if (tcon->fscache == NULL) + return; + sharename = extract_sharename(tcon->treeName); if (IS_ERR(sharename)) { cifs_dbg(FYI, "%s: couldn't extract sharename\n", __func__); -- 2.32.0