Received: by 2002:ab2:3319:0:b0:1ef:7a0f:c32d with SMTP id i25csp255393lqc; Thu, 7 Mar 2024 17:06:28 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCW9O2fwXqOdtgIO8F6v+uu6fEph+n+iWq55cDLfJkgzlm7wqAg3tnDNRg2pr6SOwpLW2wUYRX2YyzQiTocTtALtJetLGut8FW2VMcf3bg== X-Google-Smtp-Source: AGHT+IHcAZ0iSSZ2TbEn8sKjd97iQv5+qF+2gBek0/n8LahKJKY8kZ+zUWeHfr8VcrrKFElYvsn3 X-Received: by 2002:a17:902:c402:b0:1db:28bd:2949 with SMTP id k2-20020a170902c40200b001db28bd2949mr11343874plk.0.1709859988278; Thu, 07 Mar 2024 17:06:28 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709859988; cv=pass; d=google.com; s=arc-20160816; b=QNK0R2gP1SJ5I7FzylisD2K4RQNJqhCKFiPCNF0OsyLRoPHPl6yH7xU+K3gimgizxp K+nQQlpCGXPnhtz6vPCWDNuy9qI4WL2XcDquoLCORJfbRK/0LPR+mz61mdRKWUFGY8wa vu2dOTlYEnaNHqh91k2+NrJ0eAiE3FmDt5hj0nAfKF84IGFKRNv/j+MCRAOJtItcgpuu r8jaxrLl72h22rdGW6b7kidgACPOU9/lri5bdrshCZj59zv6xoNv3APLs5GcAZ2n2cjV mD8Nj8+9yEIcxAYyuCPdLnZuxxkVQWH3MAZhwSU2YVkY8Lg/5m65YuUQr1R/jC1yvOMN RIyQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=Wbv4glGwGkmvfTZqqlgHYUKZqtRCP86vA85awE5s7Vk=; fh=iEWcmrAeDyB3om93eL9qYngV8KcpoU6xxGUfAkHStWM=; b=fFWfxLrR+/L1gMD3zP5gi/mNYkkDenQroKTe1o9CRtPZjP3NLB+RdYKjERV3OLr1A7 w3qMq37u9nxlYhxq3xCVzq9uD1ke9KQFF/KU+nVNRhRCT7PrDcirCRup5Ub3VbsFCw9g 7MFfIjSTh+p4O2Z0N/fzGmcFCkANNpBV24pRmw64lHL9IKRkbsnAlATJ+g7NVwPQEgQo CvMThb5BSSsZIuwCvj1HIVrpknWKHiP2xe5dm08H/l7mjsrLUqGfNNQHglfy/+WuMOvt Bl4Juf2L+Lslk3I0s71x400b3kryyWzM8Qo+DNm1y7XzoCoAey5yYsiyXASZBjt+8lLf xoQg==; 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-96412-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-96412-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 z12-20020a170902d54c00b001db98ad6ec2si15258838plf.609.2024.03.07.17.06.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Mar 2024 17:06:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-96412-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-96412-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-96412-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 39410B20E1F for ; Fri, 8 Mar 2024 01:05:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2544721344; Fri, 8 Mar 2024 01:04:53 +0000 (UTC) Received: from szxga05-in.huawei.com (szxga05-in.huawei.com [45.249.212.191]) (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 9AE1F225A8 for ; Fri, 8 Mar 2024 01:04:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.191 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709859892; cv=none; b=RapA9/9B2zomjzsau/Fc1MJ2phqwbR5Fir69PF1g7hhsfEwU2NqluiUyQ99/D97mLU9qf7edYzTiFkrcfkg1PNrHjdc7+Djt8srPvWWbwQgEl28P8r5+aHkfaNwbWbGOJC0OUr21K30Nk+iA9X2nzwUYI26B/zhOSz3RmfbrvVE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709859892; c=relaxed/simple; bh=GiTdVQy7bcAf5k45DkX69swwITTNxCxrjUbOrWnhtXs=; h=Message-ID:Date:MIME-Version:Subject:To:CC:References:From: In-Reply-To:Content-Type; b=F3UJkjmGdFv9UrEvvaseQvVnUU/iXMwhDjSEGxVh5ypLyJeidl9HJd4IN2nIcSfGjqozjaHOkaSLCNFTi2sah8sYKewbtbLbcrVn34a0/8v6xluSH0p+TsujbV2pUQMowUOpGB+7jvCYRxxQYcxoRSKmCfMMWhu7fAY4WP1VHdo= 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.191 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.163.44]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4TrSch10vFz1FM6W; Fri, 8 Mar 2024 09:04:36 +0800 (CST) Received: from dggpeml500021.china.huawei.com (unknown [7.185.36.21]) by mail.maildlp.com (Postfix) with ESMTPS id 017241400D3; Fri, 8 Mar 2024 09:04:46 +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; Fri, 8 Mar 2024 09:04:45 +0800 Message-ID: <70dae3d9-a4d3-f9e2-6c8b-ec08eb6b1321@huawei.com> Date: Fri, 8 Mar 2024 09:04:44 +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 v2] erofs: fix lockdep false positives on initializing erofs_pseudo_mnt Content-Language: en-US To: Gao Xiang , CC: , , , , , , , , , , , Baokun Li References: <20240307101018.2021925-1-libaokun1@huawei.com> <60c18887-db8a-42a8-8a04-ef9d17263b15@linux.alibaba.com> From: Baokun Li In-Reply-To: <60c18887-db8a-42a8-8a04-ef9d17263b15@linux.alibaba.com> 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/3/7 22:18, Gao Xiang wrote: > > > On 2024/3/7 18:10, Baokun Li wrote: >> Lockdep reported the following issue when mounting erofs with a >> domain_id: >> >> ============================================ >> WARNING: possible recursive locking detected >> 6.8.0-rc7-xfstests #521 Not tainted >> -------------------------------------------- >> mount/396 is trying to acquire lock: >> ffff907a8aaaa0e0 (&type->s_umount_key#50/1){+.+.}-{3:3}, >>                         at: alloc_super+0xe3/0x3d0 >> >> but task is already holding lock: >> ffff907a8aaa90e0 (&type->s_umount_key#50/1){+.+.}-{3:3}, >>                         at: alloc_super+0xe3/0x3d0 >> >> other info that might help us debug this: >>   Possible unsafe locking scenario: >> >>         CPU0 >>         ---- >>    lock(&type->s_umount_key#50/1); >>    lock(&type->s_umount_key#50/1); >> >>   *** DEADLOCK *** >> >>   May be due to missing lock nesting notation >> >> 2 locks held by mount/396: >>   #0: ffff907a8aaa90e0 (&type->s_umount_key#50/1){+.+.}-{3:3}, >>             at: alloc_super+0xe3/0x3d0 >>   #1: ffffffffc00e6f28 (erofs_domain_list_lock){+.+.}-{3:3}, >>             at: erofs_fscache_register_fs+0x3d/0x270 [erofs] >> >> stack backtrace: >> CPU: 1 PID: 396 Comm: mount Not tainted 6.8.0-rc7-xfstests #521 >> Call Trace: >>   >>   dump_stack_lvl+0x64/0xb0 >>   validate_chain+0x5c4/0xa00 >>   __lock_acquire+0x6a9/0xd50 >>   lock_acquire+0xcd/0x2b0 >>   down_write_nested+0x45/0xd0 >>   alloc_super+0xe3/0x3d0 >>   sget_fc+0x62/0x2f0 >>   vfs_get_super+0x21/0x90 >>   vfs_get_tree+0x2c/0xf0 >>   fc_mount+0x12/0x40 >>   vfs_kern_mount.part.0+0x75/0x90 >>   kern_mount+0x24/0x40 >>   erofs_fscache_register_fs+0x1ef/0x270 [erofs] >>   erofs_fc_fill_super+0x213/0x380 [erofs] >> >> This is because the file_system_type of both erofs and the pseudo-mount >> point of domain_id is erofs_fs_type, so two successive calls to >> alloc_super() are considered to be using the same lock and trigger the >> warning above. >> >> Therefore add a nodev file_system_type called erofs_anon_fs_type in >> fscache.c to silence this complaint. Because kern_mount() takes a >> pointer to struct file_system_type, not its (string) name. So we don't >> need to call register_filesystem(). In addition, call init_pseudo() in >> erofs_anon_init_fs_context() as suggested by Al Viro, so that we can >> remove erofs_fc_fill_pseudo_super(), erofs_fc_anon_get_tree(), and >> erofs_anon_context_ops. >> >> Signed-off-by: Baokun Li > > I will add > > Suggested-by: Al Viro > > when applying.. Okay, thanks for adding it. > > Also since it's a false positive and too close to the > final so let's keep this patch in -next for a while and > then aim for v6.9-rc1 instead. > > Thanks, > Gao Xiang Fine! Thanks! -- With Best Regards, Baokun Li .