Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp5687680pxb; Thu, 20 Jan 2022 02:29:44 -0800 (PST) X-Google-Smtp-Source: ABdhPJzaZTmh1z+ezRigNeg8jKa69W+X6XqHFJivqz1+Mc5JiCRLWIJ3phmKkbvJzZ6jkOr0cNQU X-Received: by 2002:a63:6c03:: with SMTP id h3mr30499191pgc.604.1642674584543; Thu, 20 Jan 2022 02:29:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642674584; cv=none; d=google.com; s=arc-20160816; b=xbC+03mcL65TmjWFOTYQin7ka431HP521Fp1Jd7IZjWyNJnRrEhXX54bWiJSOq+PM/ 7iPm7D+uz3GATdO2PPOJZSCVWOAk0Oa+JHAV+w1TJW922bNQryw96NIfHVbkEb/8EqCN EgQJy2dalaQ8T9+XQ4unoxp4xYq0+wtbS2/d0YyT00fK21gZwL8swLYzsDuGJvSZ6sZ7 ZyKPzq2yO0AJMhIrixh8GEXjL83P3qO1hYNaG/3ullfBegodNBSmZVDjqH82DcevHEqG XJid8LTsvzNp+j8GwdstJdaTb1kqjH+YQzzub/dFEoBufl6GjT8xDdK/pRwykO4HuCPI 37pQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=Ox+treBE2rkm3fnEbPul2vLnJnUXUOxD2NtDUgbryMQ=; b=ORaj08yxgs+7xQbYCW7+wfORG/Nz4O02+UwPdwnjLuDYRJ06pGO4FfZB5F3PaiX2sG cZ4V+S9xvnldo3aPwuHdPs5UDh4DupQWmBVpL14EHLrKVfGBwYEvSujwV7xyda6QmY27 6NXFBFdPsWgPDUQYgG9Rnu4xsIctF0xGbio9QDGjNKXBBBB1Fk6+3PQ7asJaUFXGXQ0O L9R1fgrGuJH/3zLOrO2PlKQCKN3DKtGFjNzVaqs6qiQtMulEuiM83pNCAIz6bjHSdjAb WJgm0uGHLWnwvksXJY0z6wEE3WjT2GBjF47Bh0tWmn3+70dR2oQNgn1ddFar8qTo9Ic1 65Rw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id pf2si11705408pjb.13.2022.01.20.02.29.32; Thu, 20 Jan 2022 02:29:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235924AbiARNNM (ORCPT + 99 others); Tue, 18 Jan 2022 08:13:12 -0500 Received: from out30-42.freemail.mail.aliyun.com ([115.124.30.42]:40489 "EHLO out30-42.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242285AbiARNMf (ORCPT ); Tue, 18 Jan 2022 08:12:35 -0500 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R861e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04426;MF=jefflexu@linux.alibaba.com;NM=1;PH=DS;RN=12;SR=0;TI=SMTPD_---0V2C1oyQ_1642511552; Received: from localhost(mailfrom:jefflexu@linux.alibaba.com fp:SMTPD_---0V2C1oyQ_1642511552) by smtp.aliyun-inc.com(127.0.0.1); Tue, 18 Jan 2022 21:12:32 +0800 From: Jeffle Xu To: dhowells@redhat.com, linux-cachefs@redhat.com, xiang@kernel.org, chao@kernel.org, linux-erofs@lists.ozlabs.org Cc: linux-fsdevel@vger.kernel.org, joseph.qi@linux.alibaba.com, bo.liu@linux.alibaba.com, tao.peng@linux.alibaba.com, gerry@linux.alibaba.com, eguan@linux.alibaba.com, linux-kernel@vger.kernel.org Subject: [PATCH v2 13/20] erofs: register cookie context for bootstrap blob Date: Tue, 18 Jan 2022 21:12:09 +0800 Message-Id: <20220118131216.85338-14-jefflexu@linux.alibaba.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220118131216.85338-1-jefflexu@linux.alibaba.com> References: <20220118131216.85338-1-jefflexu@linux.alibaba.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Registers fscache_cookie for the bootstrap blob file. The bootstrap blob file can be specified by a new mount option, which is going to be introduced by a following patch. Something worth mentioning about the cleanup routine. 1. The init routine is prior to when the root inode gets initialized, and thus the corresponding cleanup routine shall be placed under .kill_sb() callback. 2. The init routine will instantiate anonymous inodes under the super_block, and thus .put_super() callback shall also contain the cleanup routine. Or we'll get "VFS: Busy inodes after unmount." warning. Signed-off-by: Jeffle Xu --- fs/erofs/internal.h | 3 +++ fs/erofs/super.c | 13 +++++++++++++ 2 files changed, 16 insertions(+) diff --git a/fs/erofs/internal.h b/fs/erofs/internal.h index bb5e992fe0df..277dcd5888ea 100644 --- a/fs/erofs/internal.h +++ b/fs/erofs/internal.h @@ -75,6 +75,7 @@ struct erofs_mount_opts { unsigned int max_sync_decompress_pages; #endif unsigned int mount_opt; + char *uuid; }; struct erofs_dev_context { @@ -152,6 +153,8 @@ struct erofs_sb_info { /* sysfs support */ struct kobject s_kobj; /* /sys/fs/erofs/ */ struct completion s_kobj_unregister; + + struct erofs_fscache_context *bootstrap; }; #define EROFS_SB(sb) ((struct erofs_sb_info *)(sb)->s_fs_info) diff --git a/fs/erofs/super.c b/fs/erofs/super.c index 798f0c379e35..8c5783c6f71f 100644 --- a/fs/erofs/super.c +++ b/fs/erofs/super.c @@ -598,6 +598,16 @@ static int erofs_fc_fill_super(struct super_block *sb, struct fs_context *fc) sbi->devs = ctx->devs; ctx->devs = NULL; + if (!erofs_bdev_mode(sb)) { + struct erofs_fscache_context *bootstrap; + + bootstrap = erofs_fscache_get_ctx(sb, ctx->opt.uuid, true); + if (IS_ERR(bootstrap)) + return PTR_ERR(bootstrap); + + sbi->bootstrap = bootstrap; + } + err = erofs_read_superblock(sb); if (err) return err; @@ -753,6 +763,7 @@ static void erofs_kill_sb(struct super_block *sb) return; erofs_free_dev_context(sbi->devs); + erofs_fscache_put_ctx(sbi->bootstrap); fs_put_dax(sbi->dax_dev); kfree(sbi); sb->s_fs_info = NULL; @@ -771,6 +782,8 @@ static void erofs_put_super(struct super_block *sb) iput(sbi->managed_cache); sbi->managed_cache = NULL; #endif + erofs_fscache_put_ctx(sbi->bootstrap); + sbi->bootstrap = NULL; } static struct file_system_type erofs_fs_type = { -- 2.27.0