From patchwork Tue May 9 06:48:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve French X-Patchwork-Id: 1778758 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2620:137:e000::1:20; helo=out1.vger.email; envelope-from=linux-cifs-owner@vger.kernel.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=sbsWcyzd; dkim-atps=neutral Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by legolas.ozlabs.org (Postfix) with ESMTP id 4QFpfj4ZHKz20fl for ; Tue, 9 May 2023 16:49:17 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235023AbjEIGtO (ORCPT ); Tue, 9 May 2023 02:49:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234871AbjEIGsp (ORCPT ); Tue, 9 May 2023 02:48:45 -0400 Received: from mail-lj1-x234.google.com (mail-lj1-x234.google.com [IPv6:2a00:1450:4864:20::234]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1976AD043 for ; Mon, 8 May 2023 23:48:43 -0700 (PDT) Received: by mail-lj1-x234.google.com with SMTP id 38308e7fff4ca-2ac7462d9f1so60582351fa.2 for ; Mon, 08 May 2023 23:48:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1683614921; x=1686206921; h=cc:to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=bo9V9ZKkmXLgx/8ns8SX7trpZLoUO2dWHdvtCr5IC/c=; b=sbsWcyzdo8CQGv450/ek06kWa+pRia7srzpqZT/f3zS0aKsPVdi1nx7wFqbU/zFyUB hQazOBI1HOx6S0JQ4jq80EPq8tvBr3HvOv1CB1C4I7WWU4MSz1MPDrhIrSMI8ZuFM1w0 M6CNJrTxfK0mxu9bf4r2gLT057L0ZTPJ6J068xSEnvCueR6kojPWU781byW5R9jOT8bN xk2iCD+wY2PSho0DNsv42AU0DpuuKbjAHVFGSIU4C0DHvRUKeK5BgRXF3RHWArqbiwQk pNbNiiPZFCshIifBNd293w1NuwteR6QgT7Tw8M8PHcOaIU4snY/7o8zjypTdFi2IFqlB sNdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683614921; x=1686206921; h=cc:to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=bo9V9ZKkmXLgx/8ns8SX7trpZLoUO2dWHdvtCr5IC/c=; b=WYFvGlDwBEkDXKYQSVJ+t/frIb6xeuwhoWgGYe7GEJjXQMoPDRIwp+hgrHvy53+W0T q4LzN7zMoLiyeTBHWxk5wzAL1U2w3e5Ij4PW4KkR5txWs8Pe9K5sDw/dA5O5c6jVX4o9 sYOBdSnPmiQ04gN4kDfu8vkZrfar8otGfoUhk27jNDkje64h8oqQeQ7HvyW04mDA2v87 KaOA/0jBLlIdLT8R5G7FtrKf97KlfB5yvmvikC0CZqmlsesH/OwDboN3Shez5Kb6up+Y 2oo0v8VY0ShoHDONOCweWNKb0Y0QgZv4Minmdj3ZyuDnpMZDyEFo8sF6vVZUcIr/Sfol rPAQ== X-Gm-Message-State: AC+VfDyEJ0ELJyFwFsISOd1Arw46+o/Wf0NAKL2g3d9O+ojGouNlRC+5 msuVXZ95GXV+LFf0dD5ZR9gDfLHgzG82AhpixrrgB/VTwu1I3Q== X-Google-Smtp-Source: ACHHUZ7Vt/QUy5pAHpRyUVMRICD/rtF5Qryf0udnts+4icl79d4zQvdfb0sdCTwH31i62SbIBY3hedOKRmp0pswD1aM= X-Received: by 2002:a2e:8883:0:b0:2a8:e53f:c174 with SMTP id k3-20020a2e8883000000b002a8e53fc174mr544275lji.26.1683614920436; Mon, 08 May 2023 23:48:40 -0700 (PDT) MIME-Version: 1.0 From: Steve French Date: Tue, 9 May 2023 01:48:29 -0500 Message-ID: Subject: [PATCH] smb3: fix problem remounting a share after shutdown To: CIFS Cc: David Howells X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org xfstests generic/392 showed a problem where even after a shutdown call was made on a mount, we would still attempt to use the (now inaccessible) superblock if another mount was attempted for the same share. Reported-by: David Howells Reviewed-by: David Howells Cc: Fixes: 087f757b0129 ("cifs: add shutdown support") See attached From ce3df8169d31579f173e852b13dbb7e113693c2d Mon Sep 17 00:00:00 2001 From: Steve French Date: Tue, 9 May 2023 01:37:19 -0500 Subject: [PATCH] smb3: fix problem remounting a share after shutdown xfstests generic/392 showed a problem where even after a shutdown call was made on a mount, we would still attempt to use the (now inaccessible) superblock if another mount was attempted for the same share. Reported-by: David Howells Reviewed-by: David Howells Cc: Fixes: 087f757b0129 ("cifs: add shutdown support") Signed-off-by: Steve French --- fs/cifs/connect.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index eeeed6fda13b..8e9a672320ab 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c @@ -2709,6 +2709,13 @@ cifs_match_super(struct super_block *sb, void *data) spin_lock(&cifs_tcp_ses_lock); cifs_sb = CIFS_SB(sb); + + /* We do not want to use a superblock that has been shutdown */ + if (CIFS_MOUNT_SHUTDOWN & cifs_sb->mnt_cifs_flags) { + spin_unlock(&cifs_tcp_ses_lock); + return 0; + } + tlink = cifs_get_tlink(cifs_sb_master_tlink(cifs_sb)); if (tlink == NULL) { /* can not match superblock if tlink were ever null */ -- 2.34.1