Received: by 2002:ab2:788f:0:b0:1ee:8f2e:70ae with SMTP id b15csp588055lqi; Thu, 7 Mar 2024 06:18:58 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWPRdialu5HyjFIeKE7kxIWHz06hb9S7Hgau9eUkFRLtOjm+fW2jHKbUQIpk2+R+TklP5SAz9m4tjo0JoGOE4oB3EabqmWsC5Fh6nYBmw== X-Google-Smtp-Source: AGHT+IFA3uYcePJZukgptmBUDRpP0mo0ZinAa/VTEYKeoB5Pqqv5NjHRh6/1JtgM4nL1f5ZcUPIt X-Received: by 2002:a0c:e951:0:b0:690:9de9:e9 with SMTP id n17-20020a0ce951000000b006909de900e9mr2868384qvo.43.1709821138039; Thu, 07 Mar 2024 06:18:58 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709821138; cv=pass; d=google.com; s=arc-20160816; b=0UrJB8zYcI8DuhSh1UjU04pg/ufy3anKKDPRpO9A3v78CsRa2uoWc7lEg4HCUqqYjx DZXeqs+eED/nHErsLZdlu/BP1alXeRxbb5iponkCLt1+y3CJrhieI2WCm3QDH6Hk0VLo NfE3L8vqN/j8SAGpPnHjkSWdpFfqhgejUAP//xnJzvaq7ryDcugrMRXMKmLyYhTkNgat xy8cfGpWGOiQ2gxhbYMQKw7GC+VvtGH/gsXanLolyCVdm9GjwSA1tzSYxA1v5dVGkWUZ DFoMU6nj3GArhbwBAWpIr88Y6M/zPWj+CE7+ox/da5fO2qV3oiTKQyGjQSZedLqRfGx8 BdkQ== 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:subject :user-agent:mime-version:list-unsubscribe:list-subscribe:list-id :precedence:date:message-id:dkim-signature; bh=npQu2INO/FdrwYje2DMJLJdc7DyZiThgqLfsw/glcu8=; fh=3ad4L4ECD1Lf3snEWim5dLGHbvXCuC8kjouCowX+cXE=; b=z7f8+wb3I0ALavfopi+4ybN2CL74VG/r/BAyKWF55M1wPQ/0402mOIHlRR5V+u0Jkf wrwpQf/xH1xR4fq2tia/fNp2nNrSZVvzjWC4a9aIlMgRI8p6oHldHmOFW1dv7ckfVmPS RRv8QFM06/2xK6+NkxCyuQagnoA00my28+xZ5VAMf7g9Xhc/0j1w9Za533P/yvDLVy1Q 0pAbUL/BNf7ymergzbIGyQYqHCfHcoO97yUg+YyCeAnLnma2dchoM3fR8GXYAS1OV1dP e/h3giPAXbfWsolMetEZoe/BiYjg/YWKPqJGzZahOkqjDtFXN3YAMcPvd/uSOOZxiKVs Mf4g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.alibaba.com header.s=default header.b=Ys1ocksK; arc=pass (i=1 spf=pass spfdomain=linux.alibaba.com dkim=pass dkdomain=linux.alibaba.com dmarc=pass fromdomain=linux.alibaba.com); spf=pass (google.com: domain of linux-kernel+bounces-95717-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-95717-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.alibaba.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id gv4-20020a056214262400b006900f254febsi17386954qvb.365.2024.03.07.06.18.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Mar 2024 06:18:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-95717-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.alibaba.com header.s=default header.b=Ys1ocksK; arc=pass (i=1 spf=pass spfdomain=linux.alibaba.com dkim=pass dkdomain=linux.alibaba.com dmarc=pass fromdomain=linux.alibaba.com); spf=pass (google.com: domain of linux-kernel+bounces-95717-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-95717-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.alibaba.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 ny.mirrors.kernel.org (Postfix) with ESMTPS id B35BF1C242A1 for ; Thu, 7 Mar 2024 14:18:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C802612CD84; Thu, 7 Mar 2024 14:18:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b="Ys1ocksK" Received: from out30-110.freemail.mail.aliyun.com (out30-110.freemail.mail.aliyun.com [115.124.30.110]) (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 5E8C712D760 for ; Thu, 7 Mar 2024 14:18:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.110 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709821132; cv=none; b=FSRQN9YSTXnj5rkurgT9hevzwtia7l6F7THlfUWDv4VjRF1DnuK+q+scNhiUwhk3dqoX0iw19QtDHmdd8jPOh/qZ1IKk1L3IuxYU3KQ7N+s99avH7YmqKdMu/QoEcwBYlCdPsbmdTYx7beTMVp+a4eTxrhk+urjFyT8OzZcKj6g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709821132; c=relaxed/simple; bh=4s9GucHXufG/nCQ8eR0wFkr2F1XCrbV+EKzCFQTECf4=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=huuzXOHZfMigfvhOS/Bp3e1mpgcb/d/hGVyFjOPJCKZap/ML43vOHJm0Igs1f4a2plVn4SW+RXJqvuGpS01wfDFdkp2CV7RLWmayLnJMq2TghInEkipucnAHiQ+lONPx4RFgjNZ0MTJ4/FsX3jzIuFVCk3fnsdU0r++IGcPwGys= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com; spf=pass smtp.mailfrom=linux.alibaba.com; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b=Ys1ocksK; arc=none smtp.client-ip=115.124.30.110 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1709821121; h=Message-ID:Date:MIME-Version:Subject:To:From:Content-Type; bh=npQu2INO/FdrwYje2DMJLJdc7DyZiThgqLfsw/glcu8=; b=Ys1ocksK5MEvzTX0Q5KeCp3cHbA0DdNEtxbp9aVZVfw2fnS3zfgRIY48dK+TdsNZLP5vQsB4ZapjwyFDhjPJJ253+bCJrJRz1Pc5HgrgdZRGw7DkGtvJDbnraFH4gAMcjrp9StG276h4xlQMW7QoimnykiEbB4sQC6cLQEmxolY= X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R961e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045192;MF=hsiangkao@linux.alibaba.com;NM=1;PH=DS;RN=13;SR=0;TI=SMTPD_---0W2-lSin_1709821117; Received: from 30.25.211.60(mailfrom:hsiangkao@linux.alibaba.com fp:SMTPD_---0W2-lSin_1709821117) by smtp.aliyun-inc.com; Thu, 07 Mar 2024 22:18:40 +0800 Message-ID: <60c18887-db8a-42a8-8a04-ef9d17263b15@linux.alibaba.com> Date: Thu, 7 Mar 2024 22:18:36 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2] erofs: fix lockdep false positives on initializing erofs_pseudo_mnt To: Baokun Li , linux-erofs@lists.ozlabs.org Cc: xiang@kernel.org, chao@kernel.org, huyue2@coolpad.com, jefflexu@linux.alibaba.com, viro@zeniv.linux.org.uk, brauner@kernel.org, linux-kernel@vger.kernel.org, yangerkun@huawei.com, houtao1@huawei.com, yukuai3@huawei.com, chengzhihao1@huawei.com References: <20240307101018.2021925-1-libaokun1@huawei.com> From: Gao Xiang In-Reply-To: <20240307101018.2021925-1-libaokun1@huawei.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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.. 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