Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp3398910ioo; Mon, 30 May 2022 00:45:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz32q7rZOflcrfi+DrhAk1i3v1fo0ZwfcNycsPZAoEuQAcKwIASR7PLksFNhLnrP5ODm7AO X-Received: by 2002:a65:6b94:0:b0:3fb:16f4:3620 with SMTP id d20-20020a656b94000000b003fb16f43620mr17208780pgw.464.1653896712336; Mon, 30 May 2022 00:45:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653896712; cv=none; d=google.com; s=arc-20160816; b=iDrN5Oj4YYDQe6NeuKbfsLVmSYq+CLq3GsN3Vd1T9emQa03JRN6ct6coBRIJserQyQ 692hD/QOrR7wD+2t9T7XymW2O+NRsV0YxeBWvUEeUkiyyz37csUAfvMVA4gJwYx6Vo1Q O8TcsBiPZ2MiuO0gs0DiQEh2kizywtizbJlNhzZPju+MqdBo4hUtZ6ngvPiZcbdQ9GcV i9q6gpo3ISZGCGbxGDAiBv97but9Pfu0FxZspVtmhQ8XtgJZKs24L5dKy15gOL5QrWFj aF/HnbPRld6UCNXo2TB3bsGs/mNUoz2lpKLN8BdJptB3vaDfZo8StuLD9ihtlY4nbnnW fXYQ== 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=1WE4ZVE8mQoLaImrVIMYbwRDn6NJ35hOANqsO3uh5lM=; b=0gkilXLIn7Kpcd3MQnWhNIBPZWcz2exFVESOZgDmSb065tw3EBs6H8HT/12agsP8IW IvvNQ1SajW/AOvEfhDkc0YLMQXZb0QGVIEErIfyc7hbW86zOWgvrxZXfVgDHDvkxsx7h 6FVh9Dcn24ELLDZOGKDLr78AXN5EAH+fgP3Nlb3rbPsCUAVLuqWBNrKgxrgV0BvDqO9x g/Dqp7xWKIWhy4atFrANkDUFbL56JwrvrBFCWbEZ/7s7MJsxx7WVgBjLtNPd21+j0d4T zWoTDlI8avgVebgHIyXnEaO9XB/sdJu9sU3Wzdnz4NFn54W4Cbzwx/7qg/nYA1IUGwvb uCFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=NWwIBWvB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id iz3-20020a170902ef8300b00163f185b031si726733plb.378.2022.05.30.00.45.00; Mon, 30 May 2022 00:45:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=NWwIBWvB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231754AbiE3Bkj (ORCPT + 99 others); Sun, 29 May 2022 21:40:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52054 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230402AbiE3Bkh (ORCPT ); Sun, 29 May 2022 21:40:37 -0400 Received: from mail-pg1-x52f.google.com (mail-pg1-x52f.google.com [IPv6:2607:f8b0:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B57393EA91 for ; Sun, 29 May 2022 18:40:36 -0700 (PDT) Received: by mail-pg1-x52f.google.com with SMTP id j21so8851423pga.13 for ; Sun, 29 May 2022 18:40:36 -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=1WE4ZVE8mQoLaImrVIMYbwRDn6NJ35hOANqsO3uh5lM=; b=NWwIBWvB0YV3Tnf2sRXxtscP+89AFxcEvDESpqQY3z7LIrszbTvIzkBkoy6z/ZIwD4 hkMrGWl2PMC31bN/Hjeoy+7raLOCb8bzc8fCSHS3LQ00dXdBEpYYnTc1YrLZrJk4P55V J+uCFVfiX4tlbE3WfjTZFNlyaBlQBvdnB/Wgk= 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=1WE4ZVE8mQoLaImrVIMYbwRDn6NJ35hOANqsO3uh5lM=; b=LuARB5pyvpfw3k2JWg7sOeoIQsOUmrS967pxBza1adrYRwBwf9NLvTfovaZr2fIOO5 u6MTtpOl86iBFo5SYrWhSVJk98MLCoX4ezKp5uVymvbSKc1Rahjk+MTG74pDIdxB/bcc SP9xzpOVXGTzcgpy3RM96lS11kpJ+fIlBsPE6YIak56TgRmlLEg6oyQRZnrEL5N48wMz dEEyFXDS6cebSyTmragj5OE/9dqqd6LMVKzJNtXO7m5ZLQztmjXl6MwbkSdeW+SAOJpI UrwolImS6bbJ14j09Z9ecW+GcU9yX+3ePYQVOpC9GGg5OnQcGEMC5VDW7f/WTobJsXbr PIiw== X-Gm-Message-State: AOAM531jiznL0OUb9tL96z3G11Ebw4I7+g+ggpbbGO2WPSPn0t+63l/6 78UhDfw737rPG4GI+bMUO+tN1w== X-Received: by 2002:a05:6a02:117:b0:3fa:de2:357a with SMTP id bg23-20020a056a02011700b003fa0de2357amr34734443pgb.169.1653874836237; Sun, 29 May 2022 18:40:36 -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 l9-20020a170902eb0900b0015f2d549b46sm662285plb.237.2022.05.29.18.40.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 May 2022 18:40:35 -0700 (PDT) From: Daniil Lunev To: linux-fsdevel@vger.kernel.org, miklos@szeredi.hu, viro@zeniv.linux.org.uk, hch@infradead.org, tytso@mit.edu Cc: fuse-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, Daniil Lunev Subject: [PATCH v3 0/2] Prevent re-use of FUSE superblock after force unmount Date: Mon, 30 May 2022 11:39:56 +1000 Message-Id: <20220530013958.577941-1-dlunev@chromium.org> X-Mailer: git-send-email 2.31.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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-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 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 | 32 ++++++++++++++++++++++++++++---- include/linux/fs.h | 2 ++ 3 files changed, 35 insertions(+), 6 deletions(-) -- 2.31.0