Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp7526706rwb; Tue, 6 Dec 2022 06:55:01 -0800 (PST) X-Google-Smtp-Source: AA0mqf6umb7gd8grH4djqB+YSpo1Tp4t0d5VHjE6mwoP7avBNtst6uCUVfPoMNXib8nm7uwaAuZn X-Received: by 2002:a63:5b01:0:b0:477:e3df:13ac with SMTP id p1-20020a635b01000000b00477e3df13acmr47410467pgb.321.1670338501114; Tue, 06 Dec 2022 06:55:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670338501; cv=none; d=google.com; s=arc-20160816; b=fntEUExuhTAzqHIPPFkr7OKNTb/Wm1x/m8l3RGt+sjD7pMizbJgAbezqAcRSmYN5D4 gO3XlCIkTIBC0r0F6q+G2O2UP8aBtVy33PSHbg6dM68HVuGwZ+QWBbwDLH55CkSkejIf uob48t7gRYC0jTfawmp/+/W66SCjEgSNOIl75W0Pt7PrMe5qjljWALf3+HXK6DcGFG/I yH8rs5Wl1bodTIAPQ28456VuqRQe/17zRUjiVgFt7oWZuqV6H7h8EzuBXN9k0ikQSDTU ubT4wxBqzDv5iVX78dmb0pD2gZXio3Vph3m9mfScwlLU7rIQHaGZgXfHnrY+WFZIRJ0B 0YsQ== 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:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=ZhCFd5RASjwAueyNJi6mP6iGQ9E4hl6kefT4MLYnozg=; b=aFEMUfTWhkGU+t8gQqDQRLc+ECYM5AL1Em9QK2lVeYjAzJMTFhCv3eDuL4EGt6bFFX 3MBH1bOycQXmkLB2Uyqg6XTF6VM/IffsENcw4CDFcNOK8fvh1Hqe2MbVPvNW7pGg2Pnw pEr6wCD1kG4XHsvZcttTN+JV8Mw6Z+LxW9kyoWquDfijQPm8dKKuPB8iLWwL3LIPNP8y 84yH6qtnd58CckEnELIYoXsgLpec9srzYfjJoSKNl/Z8Rl9XukQJD6PgH3DNOKoVhjW1 6v7AXpAcU1TuI+3VVvYHfJMvIqLKI0T5UY4o9OyHQ3T+S2qN9LxCnm7bLWQKm4pWYHAq kmhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="Mb/Ru5/q"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j184-20020a6380c1000000b00478ca0483aesi4084631pgd.170.2022.12.06.06.54.50; Tue, 06 Dec 2022 06:55:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="Mb/Ru5/q"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234773AbiLFONX (ORCPT + 79 others); Tue, 6 Dec 2022 09:13:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57882 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233613AbiLFONV (ORCPT ); Tue, 6 Dec 2022 09:13:21 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5DFC01C11A for ; Tue, 6 Dec 2022 06:13:20 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 0762DB81A26 for ; Tue, 6 Dec 2022 14:13:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D5EF3C433C1; Tue, 6 Dec 2022 14:13:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1670335997; bh=RqKUFOm6xgQtUE8V/nJGF8hXR7BXywwkkSZ7s9W50pU=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=Mb/Ru5/qIdyiLedMDt6uvFXrogylyQlT73joXZLVAXX3BgKsCPmfWgtKtn6MO2FQ4 1lXjAXozPQBr/tM5/udqwsveqgjNjTTcMh8J/g/OoWHHw7/vSXc1USyBqL04rXMYZb U+Vq5igoBdhxq8I35VGcXfJ/R7x/zle8k6p2hFURoY373AZigWfEoqMEI1ZocFIaqF wn13SHXT6ybkxb63YBbmDDbmhT8BwGF5PGdLqO1ZJZO9t7IENzSGNyEqhljtjO1fOV k1kKSmZuRE2joEw5LT0yyXqKlHL4HzPOE3FnXR7ZAG27jFOypR9e3pntJsWDiJfaKk BwGohDeL9v4cA== Message-ID: <8b35a625-d5ea-7093-01a4-0e73c3bfe493@kernel.org> Date: Tue, 6 Dec 2022 22:13:14 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.5.1 Subject: Re: [PATCH v2] erofs: check the uniqueness of fsid in shared domain in advance Content-Language: en-US To: Hou Tao , linux-erofs@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org, Gao Xiang , Yue Hu , Jeffle Xu , Jia Zhu , houtao1@huawei.com References: <20221125110822.3812942-1-houtao@huaweicloud.com> From: Chao Yu In-Reply-To: <20221125110822.3812942-1-houtao@huaweicloud.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS 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-kernel@vger.kernel.org On 2022/11/25 19:08, Hou Tao wrote: > From: Hou Tao > > When shared domain is enabled, doing mount twice with the same fsid and > domain_id will trigger sysfs warning as shown below: > > sysfs: cannot create duplicate filename '/fs/erofs/d0,meta.bin' > CPU: 15 PID: 1051 Comm: mount Not tainted 6.1.0-rc6+ #1 > Hardware name: QEMU Standard PC (i440FX + PIIX, 1996) > Call Trace: > > dump_stack_lvl+0x38/0x49 > dump_stack+0x10/0x12 > sysfs_warn_dup.cold+0x17/0x27 > sysfs_create_dir_ns+0xb8/0xd0 > kobject_add_internal+0xb1/0x240 > kobject_init_and_add+0x71/0xa0 > erofs_register_sysfs+0x89/0x110 > erofs_fc_fill_super+0x98c/0xaf0 > vfs_get_super+0x7d/0x100 > get_tree_nodev+0x16/0x20 > erofs_fc_get_tree+0x20/0x30 > vfs_get_tree+0x24/0xb0 > path_mount+0x2fa/0xa90 > do_mount+0x7c/0xa0 > __x64_sys_mount+0x8b/0xe0 > do_syscall_64+0x30/0x60 > entry_SYSCALL_64_after_hwframe+0x46/0xb0 > > The reason is erofs_fscache_register_cookie() doesn't guarantee the primary > data blob (aka fsid) is unique in the shared domain and > erofs_register_sysfs() invoked by the second mount will fail due to the > duplicated fsid in the shared domain and report warning. > > It would be better to check the uniqueness of fsid before doing > erofs_register_sysfs(), so adding a new flags parameter for > erofs_fscache_register_cookie() and doing the uniqueness check if > EROFS_REG_COOKIE_NEED_NOEXIST is enabled. > > After the patch, the error in dmesg for the duplicated mount would be: > > erofs: ...: erofs_domain_register_cookie: XX already exists in domain YY > > Reviewed-by: Jia Zhu > Signed-off-by: Hou Tao Reviewed-by: Chao Yu Thanks,