Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp5872564ioo; Wed, 1 Jun 2022 14:36:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJypkHK0SHcP8qq3GIDKPA0sxVUYKjybsRNjU79kFP3YpoV7DLom/UWQsPTrM8ZLXcAtxgBU X-Received: by 2002:a17:902:7c83:b0:162:64e:8c19 with SMTP id y3-20020a1709027c8300b00162064e8c19mr1440955pll.9.1654119395783; Wed, 01 Jun 2022 14:36:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654119395; cv=none; d=google.com; s=arc-20160816; b=UdFZorovFB8+EOQjfkmDISLALE3dSQ1B6Ld+awCLnVNDNmWd42whgJ+qffAk2pmp6F zTnjpm56VMb17MBK1ElPXqvZAshjOCvM6K385emet6jLWAiOadqD7WfoWmG4AV7y0M/P AiPirgVPN6nXvaoxWu8lK0BvishD1w/urO5JANiPwrRPQbqbxcflWB/SpBruQ8NYKh/W eh4hlddpPsooRXwm24skLO3R70vKRusrk11hyZxaAp7knWGVOayESNU2PMu/MGrFrA3o wz735Q0F1qgNHHq5mBpUy1ED4l39zRQq8nDbXepA3KpGx6x0pvDir6D4SB0Didy/cXvR 5+XA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=PY52JYSItUrD0Mk4PEiJ0pqT4TM+vNP414Zt5LGtliE=; b=Kq8yfYs7WNvD/i5XE6wAP0c6pdM5O978P3poNHX2WIWPnHkWK4Vup9QAqlyGaPIxs9 vfJnInbWrXytUz1TPa/7GbPNWWcpejqJNVOX8IgW34CoBBKSG/NcHhPN1QQGoe2VT0c1 DM7xTVSQWhjxwA9ZOGYa6fTyIDDzEbKjKD2up9RiGstfjggNO/73PJkHkfhOnbX6vLrz yROBM++RHXl9ixFKK4bwvGsMk2ZV2gF9U03StGlKB53dXt3JRx98q3SH5x92kX2L/Qhj EWsQpLgCdI+ElSQpE9gMKBq1OaVvoS6Q8QKyeGYIhz215fIhJpa0H1SUUegcfDUOD8Up GGDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=PAW8k48q; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id b17-20020a631b51000000b003fc907b0e09si3334853pgm.607.2022.06.01.14.36.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jun 2022 14:36:35 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=PAW8k48q; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 74733268566; Wed, 1 Jun 2022 13:43:16 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230105AbiFABLT (ORCPT + 99 others); Tue, 31 May 2022 21:11:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43552 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229849AbiFABLS (ORCPT ); Tue, 31 May 2022 21:11:18 -0400 Received: from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com [IPv6:2607:f8b0:4864:20::102b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C5D418BD14 for ; Tue, 31 May 2022 18:11:16 -0700 (PDT) Received: by mail-pj1-x102b.google.com with SMTP id j7so515070pjn.4 for ; Tue, 31 May 2022 18:11:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=PY52JYSItUrD0Mk4PEiJ0pqT4TM+vNP414Zt5LGtliE=; b=PAW8k48qlNqQflXlFpEJ0cX8I5KIPtuqqme5jdgYIyESn5OZDzntu7JT7gqsB4mWDH gtiliobRdEBNFVdLZ2q/orekQSS9fxq50GYUVTopeXIBONpf/cENekuuqeZd9L0MD099 FgDDvH80EefjJDmahtzu/bT0h6YMoN1rU+vRc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=PY52JYSItUrD0Mk4PEiJ0pqT4TM+vNP414Zt5LGtliE=; b=LZBqDMc4J8caSk7aIBcKUxT0aP3X5+3X3HenG1CH/EtN8EC3wzQPlQCveweM7vxUgq ahn7QJNoSDBtz/bp0POHHhsHOP0bcCyzVJsu7QC9m/RK44IRodtsuOdIU4MjP7b/Ota1 9JZYnuinuty9w7SPlw1NAcekvAOqRa9Gn1O2yF2xo7K+0fgZTXv1PRrbyrRue14kHmXI stAFDEHpHG3i9yx7lbqlZtDYz4mLGnB9pv2HRxR8SwZ1mtsDct4erGRvViRJtavj+STY 43JFOuiAwbZwB9qCdDDIIzdXGzZzIjIwXo52WSkEAe6K5Wl91EDjxkeLCy1FV3NkNOMB RUsQ== X-Gm-Message-State: AOAM5316IlddPh3hcdqTYEVFrgqrGbbYYZwIGoakRAO4yHp+ZYfReWlE C1RD9wSp7NR2BUaqYwDfcgRfiw== X-Received: by 2002:a17:902:a585:b0:14d:58ef:65 with SMTP id az5-20020a170902a58500b0014d58ef0065mr62807127plb.139.1654045876273; Tue, 31 May 2022 18:11:16 -0700 (PDT) Received: from dlunevwfh.roam.corp.google.com (n122-107-196-14.sbr2.nsw.optusnet.com.au. [122.107.196.14]) by smtp.gmail.com with ESMTPSA id mi16-20020a17090b4b5000b001df6173700dsm2621916pjb.49.2022.05.31.18.11.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 May 2022 18:11:15 -0700 (PDT) From: Daniil Lunev X-Google-Original-From: Daniil Lunev To: linux-fsdevel@vger.kernel.org, miklos@szeredi.hu, viro@zeniv.linux.org.uk, hch@infradead.org, tytso@mit.edu Cc: linux-kernel@vger.kernel.org, fuse-devel@lists.sourceforge.net, Daniil Lunev Subject: [PATCH v4 0/2] Prevent re-use of FUSE superblock after force unmount Date: Wed, 1 Jun 2022 11:11:01 +1000 Message-Id: <20220601011103.12681-1-dlunev@google.com> X-Mailer: git-send-email 2.31.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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-kernel@vger.kernel.org Force unmount of fuse severes the connection between FUSE driver and its userspace counterpart. However, open file handles will prevent the superblock from being reclaimed. An attempt to remount the filesystem at the same endpoint will try re-using the superblock, if still present. Since the superblock re-use path doesn't go through the fs-specific superblock setup code, its state in FUSE case is already disfunctional, and that will prevent the mount from succeeding. Changes in v4: - Simplify condition according to Christoph Hellwig's comments. Changes in v3: - Back to state tracking from v1 - Use s_iflag to mark superblocked ignored - Only unregister private bdi in retire, without freeing Changes in v2: - Remove super from list of superblocks instead of using a flag Daniil Lunev (2): fs/super: function to prevent super re-use FUSE: Retire superblock on force unmount fs/fuse/inode.c | 7 +++++-- fs/super.c | 28 ++++++++++++++++++++++++++-- include/linux/fs.h | 2 ++ 3 files changed, 33 insertions(+), 4 deletions(-) -- 2.31.0