From patchwork Tue Sep 26 09:55:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Konstantin Komarov X-Patchwork-Id: 144902 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp1938979vqu; Tue, 26 Sep 2023 07:03:39 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH9aM9TxxjaK0SWODXDEEGX7SYYIagHQaPeryJzwf3H1rojAfHi2oL7jq+9NuB5rM/PTrc6 X-Received: by 2002:a17:903:22d1:b0:1c0:93b6:2e4b with SMTP id y17-20020a17090322d100b001c093b62e4bmr8836936plg.33.1695737019106; Tue, 26 Sep 2023 07:03:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695737019; cv=none; d=google.com; s=arc-20160816; b=vmLRM/SMDHEMTr7VmWgUGj69DfjY+hE5FYeAs2UK0zFXwKonfVlsSNUR8VzrMcXaIE Q5e62SeA8JdBCnWOFLrFA76fk6dMZqOz2W4oF84Cl3oD14F03k2MRRJhKiD5IdMWFtzB 6nlPi0TVX/AkQF1iFqf0Kww4lMrV9rUdETo+sh53NJKdiwbIk/S00L49XaqK6qlByNRM 14QzTxM/p+BTssHBvxipCAIzjEKH19aAfBwrxmjxr6MwCQzk1EbaPRVCDv1xsEbjraif lku0Y9uGhK3Z6YhR1j9GPQvMV/y6T2P3FdcVRlm0GzhtJyIDEDxfbyGszw0tHNY4LH9e BVXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:references :cc:to:from:content-language:subject:user-agent:mime-version:date :message-id:dkim-signature:dkim-signature; bh=zfpCmKTIrrX/Tm3omQLSw+qcCQMVXlnwzcY50MQ9HGI=; fh=P7I85FIabZcM8ojWdeG8ABpTZepe/Xtte9jKWDfUHBM=; b=xUGA2ceqUD34bZaW2W3zWbi7VjsjornVoaJW6VEtrBsMXV5gfmFcoZbfWpB96Rqfro bH6QXbQW67kOKvfpUFqLdqS4mZ6Mw71/Aj3gOh2a2uWohJptRU1fKxya+xECJMEmDAvp 9XqGXXeoR9/gPvyheh//AclCwX3KxN03hyz8AGII0wRYmH9Aa3JPIJTVt+1NJyrsaz+L OgswaCYAWmMVHUhrSiW/Il2VQxcAVDcS60X7bNVrBiq7QRe1gwebJHf7VNLB4mJaG5Z/ 2Pzfc2tKt4JB7UkVL8CaiEPfLzeJO07O1NzX1zJu+4NoyDN8w+GTy1GkkZzGJAwPwk4g Ezrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@paragon-software.com header.s=mail header.b=r2zvMgty; dkim=pass header.i=@paragon-software.com header.s=mail header.b=sGwkdNut; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=paragon-software.com Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id l12-20020a63da4c000000b00565f0e91894si12819584pgj.394.2023.09.26.07.03.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Sep 2023 07:03:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@paragon-software.com header.s=mail header.b=r2zvMgty; dkim=pass header.i=@paragon-software.com header.s=mail header.b=sGwkdNut; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=paragon-software.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 994E78082845; Tue, 26 Sep 2023 02:55:53 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234252AbjIZJzv (ORCPT + 27 others); Tue, 26 Sep 2023 05:55:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40792 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233768AbjIZJzl (ORCPT ); Tue, 26 Sep 2023 05:55:41 -0400 X-Greylist: delayed 69 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Tue, 26 Sep 2023 02:55:33 PDT Received: from relayaws-01.paragon-software.com (relayaws-01.paragon-software.com [35.157.23.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 89D00F3; Tue, 26 Sep 2023 02:55:32 -0700 (PDT) Received: from relayfre-01.paragon-software.com (unknown [172.30.72.12]) by relayaws-01.paragon-software.com (Postfix) with ESMTPS id AD98621BC; Tue, 26 Sep 2023 09:49:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1695721780; bh=zfpCmKTIrrX/Tm3omQLSw+qcCQMVXlnwzcY50MQ9HGI=; h=Date:Subject:From:To:CC:References:In-Reply-To; b=r2zvMgty3J9zp812qs5vRyTGyhzL4ji93J7KqP6mRh+wYZyf81AwZM3JekNdNREfc IbCdHVL/ZUFIjro0fgcAi47CjY+xbxSoMH9BlQlueLTJlDy3YBD16zx3D3LCgOobbz Tk8hyV0LgKJTIvDAXJkonFNTdH4mxk3CdDJLjZrg= Received: from dlg2.mail.paragon-software.com (vdlg-exch-02.paragon-software.com [172.30.1.105]) by relayfre-01.paragon-software.com (Postfix) with ESMTPS id 08C121D45; Tue, 26 Sep 2023 09:55:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1695722131; bh=zfpCmKTIrrX/Tm3omQLSw+qcCQMVXlnwzcY50MQ9HGI=; h=Date:Subject:From:To:CC:References:In-Reply-To; b=sGwkdNutAIoorXYu/T6+JY8sssgHV7lXRSTMrVQjslvRO+0aOJMbH4UQ9yBUZMGFk wHz1Z0bt62kPwnvZEKtzPbbRV33DUTwOT6hvkkRrW2nL6joHqFkhlCAAmTLa4N7Iy+ REc7lvXd35mxwZBaXLtqaAr86MbWhI1S4UW6HUgg= Received: from [172.16.192.129] (192.168.211.137) by vdlg-exch-02.paragon-software.com (172.30.1.105) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.7; Tue, 26 Sep 2023 12:55:29 +0300 Message-ID: <18681891-e588-4745-8cfc-2fe5fc0eee54@paragon-software.com> Date: Tue, 26 Sep 2023 12:55:29 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH 2/8] fs/ntfs3: Allow repeated call to ntfs3_put_sbi Content-Language: en-US From: Konstantin Komarovc To: CC: , References: <7c217d7d-6ee4-4603-b5f1-ebe7b68cf430@paragon-software.com> In-Reply-To: <7c217d7d-6ee4-4603-b5f1-ebe7b68cf430@paragon-software.com> X-Originating-IP: [192.168.211.137] X-ClientProxiedBy: vdlg-exch-02.paragon-software.com (172.30.1.105) To vdlg-exch-02.paragon-software.com (172.30.1.105) X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Tue, 26 Sep 2023 02:55:53 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778109140784002211 X-GMAIL-MSGID: 1778109140784002211 Signed-off-by: Konstantin Komarov ---  fs/ntfs3/bitmap.c |  1 +  fs/ntfs3/super.c  | 21 ++++++++++++++++-----  2 files changed, 17 insertions(+), 5 deletions(-) @@ -1577,6 +1587,7 @@ static int ntfs_fill_super(struct super_block *sb, struct fs_context *fc)      iput(inode);  out:      kfree(boot2); +    ntfs3_put_sbi(sbi);      return err;  } diff --git a/fs/ntfs3/bitmap.c b/fs/ntfs3/bitmap.c index d66055e30aff..63f14a0232f6 100644 --- a/fs/ntfs3/bitmap.c +++ b/fs/ntfs3/bitmap.c @@ -125,6 +125,7 @@ void wnd_close(struct wnd_bitmap *wnd)      struct rb_node *node, *next;      kfree(wnd->free_bits); +    wnd->free_bits = NULL;      run_close(&wnd->run);      node = rb_first(&wnd->start_tree); diff --git a/fs/ntfs3/super.c b/fs/ntfs3/super.c index f78c67452b2a..71c80c578feb 100644 --- a/fs/ntfs3/super.c +++ b/fs/ntfs3/super.c @@ -576,20 +576,30 @@ static noinline void ntfs3_put_sbi(struct ntfs_sb_info *sbi)      wnd_close(&sbi->mft.bitmap);      wnd_close(&sbi->used.bitmap); -    if (sbi->mft.ni) +    if (sbi->mft.ni) {          iput(&sbi->mft.ni->vfs_inode); +        sbi->mft.ni = NULL; +    } -    if (sbi->security.ni) +    if (sbi->security.ni) {          iput(&sbi->security.ni->vfs_inode); +        sbi->security.ni = NULL; +    } -    if (sbi->reparse.ni) +    if (sbi->reparse.ni) {          iput(&sbi->reparse.ni->vfs_inode); +        sbi->reparse.ni = NULL; +    } -    if (sbi->objid.ni) +    if (sbi->objid.ni) {          iput(&sbi->objid.ni->vfs_inode); +        sbi->objid.ni = NULL; +    } -    if (sbi->volume.ni) +    if (sbi->volume.ni) {          iput(&sbi->volume.ni->vfs_inode); +        sbi->volume.ni = NULL; +    }      ntfs_update_mftmirr(sbi, 0);