From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F0534C4345F for ; Wed, 17 Apr 2024 03:26:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lists.ozlabs.org; s=201707; t=1713324393; bh=8kaLg8Q9JIbpEHXO/hXIQSAI33272QFNpBk1I/533tg=; h=Date:Subject:To:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=eapRKThZjMYwiECQJXM95D2XER50LV0n2LgPegVHllT+VYmaNAmP8F5GX94tsPq7R TuTF/IbtUjG1SQ4enXEhnfPGW47yusOGLCroeL113vbUbBGA9Zj1iBqfDOk1VEyeLM GqDgFpAP4o/IEZNuqMCIfxo/rQLlbqVlGPUQSMuHtPw5MQ7pkhucyEapRdgUbQmjEE GrQa+WVjrl37Zf2KM0dFYzUn8bOFNwdEHSoMEh64PBGa6Wf0xQuKMQzDN2509Xcchg j1zK2QXyJHSUH2DXEhs6741Ac80tVi93SOYSjxLMlD+4QFp5xhZ/87hebou45mvOuR rvtbVNH2IG7TQ== Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4VK5t148RRz3dWb for ; Wed, 17 Apr 2024 13:26:33 +1000 (AEST) Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=huawei.com (client-ip=45.249.212.35; helo=szxga07-in.huawei.com; envelope-from=libaokun1@huawei.com; receiver=lists.ozlabs.org) 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 lists.ozlabs.org (Postfix) with ESMTPS id 4VK5sv5Kx0z3bmY for ; Wed, 17 Apr 2024 13:26:24 +1000 (AEST) 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 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> In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.174.177.174] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpeml500021.china.huawei.com (7.185.36.21) X-BeenThere: linux-erofs@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development of Linux EROFS file system List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Baokun Li via Linux-erofs Reply-To: Baokun Li Cc: yangerkun@huawei.com, linux-kernel@vger.kernel.org, huyue2@coolpad.com, viro@zeniv.linux.org.uk, linux-erofs@lists.ozlabs.org Errors-To: linux-erofs-bounces+linux-erofs=archiver.kernel.org@lists.ozlabs.org Sender: "Linux-erofs" 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 From mboxrd@z Thu Jan 1 00:00:00 1970 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