Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp36424pxb; Wed, 30 Mar 2022 22:15:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwN5437RFxa9Cf4OF1lKL90kMc7F/gFGw3n7JmwC9czwERX9nIRtZbavGbptLsPMVjxRiEO X-Received: by 2002:a65:5941:0:b0:375:9bfd:473d with SMTP id g1-20020a655941000000b003759bfd473dmr9244133pgu.348.1648703707122; Wed, 30 Mar 2022 22:15:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648703707; cv=none; d=google.com; s=arc-20160816; b=J6jhR9Z7Dr/L5an8pgIMjOCVPuDB5jKRAqRth81spjI5O5Vj1Gdv9lN3A0zRz0jHST 9F2FsTJQM4b3EELTNjGB/U0hLbnfu0ZI7142uxiThuwEFhvGw0kfytpQCrYVlrnpEK/V DOpLCoIxL4V1l6gTvO3Xunn+6id2SjNcOxmF4hVXCHL40EGu9TfIDynMuSwuvxLgkaT0 1CesjE8He5QWd+s2LhnSicqDr5poHn9xiCUaNB8/3H+WLQRRPgF1j3QDOZlTABBf3DB5 EMlWmJBZfj5ag+EVtO2AsGSAUC2osINVUcqObG/DQ0bSTQd15HcgpLIN7GUk6MlTvF/v lMuQ== 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 :mime-version:user-agent:date:message-id:from:cc:references:to :subject; bh=1yuaJff4MoWkdF7F/eT24ZNJBhNuOSsRBSnIEaMPl64=; b=nbNPslTO4vXN3rnxFlBL/I2KHOu57e7OFYZ/72BN/uFOKzJ25oraPKnS/MVdv0YhSg 9jOnJVZwaXH3QBc9qSQcRwxGf5tTg33+TAH1CWGYJehAIrwp+PKRfzvSy697QTiQ85oY Xz8y751wdHVz3nxY3rOijjw5LM16LENi/baNIvEerWoSV3UykTessbN5k7sZksAPF6LR Bm5sE86G0GCMOvf6Ib8gbTdNsCOKqtIFUn524Toetbc4ImzrhWzS3W/wd0Jc1ChClOeA O7RLOjMgXxA071MChTIjvtUhqSAcvu01Dj7pECnU57sOTDuhQzcchczv+OHVenQPQmOZ 77fg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id s18-20020a63f052000000b003816043f09esi24002072pgj.659.2022.03.30.22.15.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Mar 2022 22:15:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 13FBD18A3E1; Wed, 30 Mar 2022 21:19:37 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229938AbiCaEPa (ORCPT + 99 others); Thu, 31 Mar 2022 00:15:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39470 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230075AbiCaEO4 (ORCPT ); Thu, 31 Mar 2022 00:14:56 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 25B1529E4ED for ; Wed, 30 Mar 2022 20:49:11 -0700 (PDT) Received: from dggpemm500021.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4KTTkl5BWJzCqvT; Thu, 31 Mar 2022 11:46:55 +0800 (CST) Received: from dggpemm100009.china.huawei.com (7.185.36.113) by dggpemm500021.china.huawei.com (7.185.36.109) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Thu, 31 Mar 2022 11:49:09 +0800 Received: from [10.174.179.24] (10.174.179.24) by dggpemm100009.china.huawei.com (7.185.36.113) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Thu, 31 Mar 2022 11:49:09 +0800 Subject: Re: [PATCH -next] fs: sysv: check sbi->s_firstdatazone in complete_read_super To: Christoph Hellwig References: <20220330104215.530223-1-liushixin2@huawei.com> CC: From: Liu Shixin Message-ID: Date: Thu, 31 Mar 2022 11:49:08 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.7.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.179.24] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggpemm100009.china.huawei.com (7.185.36.113) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 The type I used is sysv v7. I discovered this problem through a syzkaller use case. The use case first create a file via memfd and bind it to loop0. Then mount it to a folder with type v7. No error is reported for preceding operations. Finally when create a file, the warning in inc_nlink is triggered. I want to look the filesystem information, so I execute 'df' command and find this problem. Btw, I think the warning may be a follow-up problem caused by the filesystem being created or mounted incorrectly. Thanks, On 2022/3/30 23:42, Christoph Hellwig wrote: > On Wed, Mar 30, 2022 at 06:42:15PM +0800, Liu Shixin wrote: >> sbi->s_firstinodezone is initialized to 2 and sbi->s_firstdatazone is read >> from sbd. There's no guarantee that sbi->s_firstdatazone must bigger than >> sbi->s_firstinodezone. If sbi->s_firstdatazone less than 2, the filesystem >> can still be mounted unexpetly. At this point, sbi->s_ninodes flip to very >> large value and this filesystem is broken. We can observe this by >> executing 'df' command. When we execute, we will get an error message: >> "sysv_count_free_inodes: unable to read inode table" > This looks fine. Just curious: which variant of the sysv fs do you > use and what is the use case? > . >