Received: by 2002:a05:6500:1b45:b0:1f5:f2ab:c469 with SMTP id cz5csp369543lqb; Tue, 16 Apr 2024 20:30:46 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVApL5FYhmvtQFnqACfsgSZ78is4jSvCIYTm6e9WUgY7l1SYa88+EILAVrhFUO/2yJL7lB4LD5Xdn8E6Y9GEBn6eiJ9kPeWRZRJWXmThQ== X-Google-Smtp-Source: AGHT+IHN7jj98muePHdiaspz/WPNo4A+qewfXKlt61m3rcQIIpmOAnPkkLTyLfd1EFbG0WuBEJli X-Received: by 2002:a05:6359:4dc5:b0:186:1de0:c19c with SMTP id pj5-20020a0563594dc500b001861de0c19cmr15949175rwb.14.1713324646430; Tue, 16 Apr 2024 20:30:46 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713324646; cv=pass; d=google.com; s=arc-20160816; b=YEKn8/K1YAQan1N72tTmlkj0t7o7j+zHK48b4If4iK91F0DMUZaOvQx5unqiJo50VK 1I2Rbp9OIXj4jA4C+NbFGWCQk5b2D8YCnta5BqjfGEvgZeBkZe2w0/OBSK8n+W93YFfp bI5IB9vQ416U7IelnT+bwbuOuaTA5NXvWFZSmzhq9cJ2evIQ5VmSxPMZZ3POAT5VqN/U NgGDKK3lI5MyHxo3P5G5PEyulAdlKj0QWsHHck7CElWu/PE9XECMSYsRkz45JjlLWmy/ oaannLvD0wY5gl2oz3XCo3NW9A8p6wzaGPj1yH60aUVvDdMItK3t/FM5fl5Ua06mfScd DPKQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:cc:from:references:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=8kaLg8Q9JIbpEHXO/hXIQSAI33272QFNpBk1I/533tg=; fh=R36cQ43PvBk/7Dlpjlldkysz4tGjkVOcmINAXrsyrt8=; b=vl1QnFOVVtI/MjxYISbBg1NzTiWb/aDBwqIOcj1+GNpMdqKoRIm2VQReXGiNoIktIK oUqg/bsFUOF7c8U3DuM4LB4MAsvM8EiNUkjA+d+KXQuO4zUmliX7I7xNABbl3SyOCahR MxZnU3EWWXztFX6RruqAaidgC7/Rd4nCclecGm35LXL2netqKSXmxh7ehN88jbQpQ7HE OWWfzoNXNUSIp40IeqmWvuh1tc2fhLNRiDycFDSKDg6nrBfgMKRK3JtIBIO7llj3Tr51 fHGAC4h91AGg+cPholCzTmyzvaxZOQdKG/kc6vXDZ5EF/f0PNbbwF2vgzs54nmFAyw9/ neDA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-147895-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-147895-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id i126-20020a636d84000000b005dc529adfbdsi10838921pgc.735.2024.04.16.20.30.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Apr 2024 20:30:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-147895-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-147895-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-147895-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id E6E71B23018 for ; Wed, 17 Apr 2024 03:26:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8827B8BF3; Wed, 17 Apr 2024 03:26:25 +0000 (UTC) Received: from szxga07-in.huawei.com (szxga07-in.huawei.com [45.249.212.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 438BE748F for ; Wed, 17 Apr 2024 03:26:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.35 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713324385; cv=none; b=t7dx8g1trAnwWN2sm4s/bgZ8X0PRzZNK7KUyOfa9/UG28ifKuBHN9WKJieg5GhxzlKaMKMuzJZe9W2AMRgTTFfsZiiG7Q4m3bZCw1NXEw65f2XbZacipXfsCoDpQEUxnMAitaGFajAh+tOt+rrS/hVE5vKGzwWNsLnADkjzHP18= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713324385; c=relaxed/simple; bh=ZpvtkNlCfStNJiGm15ETpvK4/3ZMSGK0defN46MiN2Y=; h=Message-ID:Date:MIME-Version:Subject:To:References:From:CC: In-Reply-To:Content-Type; b=pJnYNj+TP6ElHYM6uFRbC4inbtrpYJu3JUjTm5eRSb0R0pxU/LUsI98YaF2yjcKc8Byvj0z1tsUplRUB8SfXtZKq4bEFg7s40Tuoqi0lMNN9H6DiN5biuLF/nQsdPhWxmoi5PJ3RvYh7mel2ruS2pNTRBfMYovBYTkhrrwdXQfU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.35 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.88.214]) by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4VK5pJ759Sz1RDd9; Wed, 17 Apr 2024 11:23:20 +0800 (CST) Received: from dggpeml500021.china.huawei.com (unknown [7.185.36.21]) by mail.maildlp.com (Postfix) with ESMTPS id 262A91A016C; Wed, 17 Apr 2024 11:26:19 +0800 (CST) Received: from [10.174.177.174] (10.174.177.174) by dggpeml500021.china.huawei.com (7.185.36.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Wed, 17 Apr 2024 11:26:18 +0800 Message-ID: <47247f78-eafb-cb4f-495f-e91a647c3f3c@huawei.com> Date: Wed, 17 Apr 2024 11:26:18 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.1.2 Subject: Re: [PATCH] erofs: set SB_NODEV sb_flags when mounting with fsid Content-Language: en-US To: Christian Brauner , References: <20240415121746.1207242-1-libaokun1@huawei.com> <20240415-betagten-querlatte-feb727ed56c1@brauner> <15ab9875-5123-7bc2-bb25-fc683129ad9e@huawei.com> <20240416-blumig-dachgeschoss-bc683f4ef1bf@brauner> <779ff32f-3f3b-c602-5da8-c88b361716ac@huawei.com> From: Baokun Li CC: , , , , , , , , Baokun Li In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpeml500021.china.huawei.com (7.185.36.21) On 2024/4/17 11:11, Gao Xiang wrote: > On Wed, Apr 17, 2024 at 10:59:53AM +0800, Baokun Li wrote: >> On 2024/4/16 22:49, Gao Xiang wrote: >>> On Tue, Apr 16, 2024 at 02:35:08PM +0200, Christian Brauner wrote: >>>>>> I'm not sure how to resolve it in EROFS itself, anyway... >>>> Instead of allocating the erofs_sb_info in fill_super() allocate it >>>> during erofs_get_tree() and then you can ensure that you always have the >>>> info you need available during erofs_kill_sb(). See the appended >>>> (untested) patch. >>> Hi Christian, >>> >>> Yeah, that is a good way I think. Although sbi will be allocated >>> unconditionally instead but that is minor. >>> >>> I'm on OSSNA this week, will test this patch more when returning. >>> >>> Hi Baokun, >>> >>> Could you also check this on your side? >>> >>> Thanks, >>> Gao Xiang >> Hi Xiang, >> >> This patch does fix the initial problem. >> >> >> Hi Christian, >> >> Thanks for the patch, this is a good idea. Just with nits below. >> Otherwise feel free to add. >> >> Reviewed-and-tested-by: Baokun Li >>>> From e4f586a41748b6edc05aca36d49b7b39e55def81 Mon Sep 17 00:00:00 2001 >>>> From: Christian Brauner >>>> Date: Mon, 15 Apr 2024 20:17:46 +0800 >>>> Subject: [PATCH] erofs: reliably distinguish block based and fscache mode >>>> >> SNIP >> >>>> diff --git a/fs/erofs/super.c b/fs/erofs/super.c >>>> index c0eb139adb07..4ed80154edf8 100644 >>>> --- a/fs/erofs/super.c >>>> +++ b/fs/erofs/super.c >>>> @@ -581,7 +581,7 @@ static const struct export_operations erofs_export_ops = { >>>> static int erofs_fc_fill_super(struct super_block *sb, struct fs_context *fc) >>>> { >>>> struct inode *inode; >>>> - struct erofs_sb_info *sbi; >>>> + struct erofs_sb_info *sbi = EROFS_SB(sb); >>>> struct erofs_fs_context *ctx = fc->fs_private; >>>> int err; >>>> @@ -590,15 +590,10 @@ static int erofs_fc_fill_super(struct super_block *sb, struct fs_context *fc) >>>> sb->s_maxbytes = MAX_LFS_FILESIZE; >>>> sb->s_op = &erofs_sops; >>>> - sbi = kzalloc(sizeof(*sbi), GFP_KERNEL); >>>> - if (!sbi) >>>> - return -ENOMEM; >>>> - >>>> sb->s_fs_info = sbi; >> This line is no longer needed. >>>> sbi->opt = ctx->opt; >>>> sbi->devs = ctx->devs; >>>> ctx->devs = NULL; >>>> - sbi->fsid = ctx->fsid; >>>> ctx->fsid = NULL; >>>> sbi->domain_id = ctx->domain_id; >>>> ctx->domain_id = NULL; >> Since erofs_sb_info is now allocated in erofs_fc_get_tree(), why not >> encapsulate the above lines as erofs_ctx_to_info() helper function >> to be called in erofs_fc_get_tree()?Then erofs_fc_fill_super() wouldn't >> have to use erofs_fs_context and would prevent the fsid from being >> freed twice. > Hi Baokun, > > I'm not sure if Christian has enough time to polish the whole > codebase (I'm happy if do so). Basically, that is just a hint > to the issue, if you have more time, I guess you could also help > revive this patch together (also because you also have a real > EROFS test environment). > > Let me also check this next week after OSSNA travelling. > > Thanks, > Gao Xiang Hi Xiang, Ok, then I will polish the patch and send it out as a v2. Thanks, Baokun