Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp465903rwd; Wed, 7 Jun 2023 02:25:47 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5nW/jjpVZPEnif+ueN8BhhNO4KiuBCCyB0l73vI23YsvfZrnos+7rUPhsoHfNA+V1cYwoW X-Received: by 2002:a17:902:c202:b0:1b1:bcea:c8f7 with SMTP id 2-20020a170902c20200b001b1bceac8f7mr13943077pll.15.1686129947152; Wed, 07 Jun 2023 02:25:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686129947; cv=none; d=google.com; s=arc-20160816; b=hs6IBeA6NV0b6UWF9P7cWlTz3h/MwT94SnmbGTp80c32fEJRJ3vKMp1ezXIGrOzu9l fFEq3BaxM/I3nakcrT8kFgoxiO2fPVDrSsqojFpNP0VAQn/vHLgHZ1ItGgx6Mit5r8oX Sy2hRT9IRpyABiZ8WRl7XMgIGr4VyduMsIB7Y4sSsbFug1YTnyfKVqvrbHLYjQ+Z3TBB ++sLDtGeCZf7hrW/D0RebyGp6k4lso1PT+gC+ZK26Vea/LlA05D1h4CprF0WgbgrBkEA B4upZCdaof0R+V9KrPQebhULPQ8lM0SDrv06Fat1fRdRKgubXZAeMeJe5EuEb9UmzY6U zhbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:references:cc :to:from:subject; bh=5wdyThoOlUWTHjoY00dNrIAsyC+d8udeUN3IlWogrNI=; b=xJSo1z/ckykEnGfgBYAu1ZOTBvZQKlaFvP2FedVzM6Hrv440wpGLKOl+lv4BwuSBgb VZzy4JM/VmY8R1UNl7qmoQt7y1Y6/V3LFITik1tc5lXz7e2MN3DJde7j4R0ugcAy9oZ1 tPyF6QB23n7QAWmOXcuJQ48NISXvcQLFN6ffJ+FwyaPfDuyd/hMHFh+lATPXt3AoYLHA Wn05cmQ/5yHneUTJvOjOeFagQ1UAqWzHtrmdZnyZMgH9Q04lQAQzGNhUWAjgnr8s0pJt xRZHlR3UCUnXil+9LdU4F1EVVSucNUUwK2RffxhbXGIqB0J1GLI4VD7S1ji/y3m1l5/R AzCw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g14-20020a17090a300e00b0024b27e48a27si847476pjb.74.2023.06.07.02.25.30; Wed, 07 Jun 2023 02:25:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-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; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239875AbjFGJOg (ORCPT + 99 others); Wed, 7 Jun 2023 05:14:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37434 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239900AbjFGJOQ (ORCPT ); Wed, 7 Jun 2023 05:14:16 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 68EDC19B6 for ; Wed, 7 Jun 2023 02:13:38 -0700 (PDT) Received: from kwepemm600003.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4QbhNH6dVCzqTRg; Wed, 7 Jun 2023 17:08:47 +0800 (CST) Received: from [10.174.179.254] (10.174.179.254) by kwepemm600003.china.huawei.com (7.193.23.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Wed, 7 Jun 2023 17:13:35 +0800 Subject: Re: [PATCH] tune2fs: check whether filesystem is in use for I_flag and Q_flag test From: Zhiqiang Liu To: CC: "Theodore Y. Ts'o" , , Jan Kara , linfeilong , wuguanghao , zhanchengbin , References: <28455341-ca26-d203-8b54-792bae002251@huawei.com> Message-ID: <46beb688-7f39-7184-1b83-5d14743fd083@huawei.com> Date: Wed, 7 Jun 2023 17:13:34 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 In-Reply-To: <28455341-ca26-d203-8b54-792bae002251@huawei.com> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.179.254] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To kwepemm600003.china.huawei.com (7.193.23.202) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,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-ext4@vger.kernel.org friendly ping... On 2023/3/20 13:04, Zhiqiang Liu wrote: > From: Zhiqiang Liu > > For changing inode size (-I) and setting quota fearture (-Q), tune2fs > only check whether the filesystem is umounted. Considering mount > namepspaces, the filesystem is umounted, however it already be left > in other mount namespace. > So we add one check whether the filesystem is not in use with using > EXT2_MF_BUSY flag, which can indicate the device is already opened > with O_EXCL, as suggested by Ted. > > Reported-by: Baokun Li > Signed-off-by: Zhiqiang Liu > Signed-off-by: zhanchengbin > --- > misc/tune2fs.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/misc/tune2fs.c b/misc/tune2fs.c > index 458f7cf6..d75f4d94 100644 > --- a/misc/tune2fs.c > +++ b/misc/tune2fs.c > @@ -3520,9 +3520,9 @@ _("Warning: The journal is dirty. You may wish to replay the journal like:\n\n" > } > > if (Q_flag) { > - if (mount_flags & EXT2_MF_MOUNTED) { > + if (mount_flags & (EXT2_MF_BUSY | EXT2_MF_MOUNTED)) { > fputs(_("The quota feature may only be changed when " > - "the filesystem is unmounted.\n"), stderr); > + "the filesystem is unmounted and not in use.\n"), stderr); > rc = 1; > goto closefs; > } > @@ -3673,10 +3673,10 @@ _("Warning: The journal is dirty. You may wish to replay the journal like:\n\n" > } > > if (I_flag) { > - if (mount_flags & EXT2_MF_MOUNTED) { > + if (mount_flags & (EXT2_MF_BUSY | EXT2_MF_MOUNTED)) { > fputs(_("The inode size may only be " > "changed when the filesystem is " > - "unmounted.\n"), stderr); > + "unmounted and not in use.\n"), stderr); > rc = 1; > goto closefs; > } >