Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp6222717pxu; Wed, 23 Dec 2020 17:57:53 -0800 (PST) X-Google-Smtp-Source: ABdhPJy7IHcKxb9PRcNFCLPPUka1vk584nmr4LaR/kmRx8KnGNOZpXmG+lfmX7jT8WoLValkzMys X-Received: by 2002:a17:906:369a:: with SMTP id a26mr25268039ejc.276.1608775073374; Wed, 23 Dec 2020 17:57:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608775073; cv=none; d=google.com; s=arc-20160816; b=VjBUSeUxIbrMpEwHSmcX5hnqnZTgn9ikLlD0f+lDTfEHaXC+85nuYZNYwoMz4q1LK5 dIuJmWfbQoinmucow3hn0LSVqI1vjhkxfL+pEaddhXIXK+udd0YvKRJlMpFyGkPeQmVh AwZcLFtEw5pMUkWtPPHTPL3YF4unAwRGoWmVnqJL9Lhrpkdfmg8Vco8GOTwCQotnuxLW 18AFgAfxDvpP7OPkgbUjO3Kvgfd0EzeDiR+ZFwsrR3JuV5pT+Ug1jcaU8ozRHWFk7ir5 rHWHHy2Z8hf39OvX2Zj3EuiN7C78NDWp5VSJz+vCMt7MU+KwQDlv2+DXuy4sNpAahdWV NLaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=SyGJCQlqwRbn9529zrQxdqqafuB/gNmpGl+2Io8jQ3M=; b=ioCQuJz0Trcz6rMw1A9wScqFpE53ghMb5PH8wjEYsUwlN3gd66jI62dlRztA2PP4qr eFNe0GEnuWKz9vFAJIUDnuwBDiwYmF3hv0MocQzakA/rx1QCpXcWSi6gTHkb1DGeqJh6 nLx+fnWlHgEPstmB7FFbEf840fRr0QLbhUQji+owZZDeRtz6i0qBgCJ5uXywG0nWGzUY AP0WKgi1QucnBCtP/InVfoovlPg+sebZIOY9L4OUhCI7NOjUyKR6pP2LBWCgRwX3w+65 i0vrjh1H8u5jqmW9VNZn7nksAKumYLqxVGKM/Gdtr/MmtBWJSujMspo6Xzkcff4Y3xMT ipmQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id mb3si12528357ejb.126.2020.12.23.17.57.24; Wed, 23 Dec 2020 17:57:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-ext4-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-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728132AbgLXB5W (ORCPT + 99 others); Wed, 23 Dec 2020 20:57:22 -0500 Received: from outgoing-auth-1.mit.edu ([18.9.28.11]:41023 "EHLO outgoing.mit.edu" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726288AbgLXB5W (ORCPT ); Wed, 23 Dec 2020 20:57:22 -0500 Received: from callcc.thunk.org (pool-72-74-133-215.bstnma.fios.verizon.net [72.74.133.215]) (authenticated bits=0) (User authenticated as tytso@ATHENA.MIT.EDU) by outgoing.mit.edu (8.14.7/8.12.4) with ESMTP id 0BO1tjeZ014478 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 23 Dec 2020 20:55:46 -0500 Received: by callcc.thunk.org (Postfix, from userid 15806) id E7142420280; Wed, 23 Dec 2020 20:55:44 -0500 (EST) Date: Wed, 23 Dec 2020 20:55:44 -0500 From: "Theodore Y. Ts'o" To: Zheng Yongjun Cc: adilger.kernel@dilger.ca, linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH -next] ext4: use DEFINE_MUTEX (and mutex_init() had been too late) Message-ID: References: <20201223141254.559-1-zhengyongjun3@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201223141254.559-1-zhengyongjun3@huawei.com> Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Wed, Dec 23, 2020 at 10:12:54PM +0800, Zheng Yongjun wrote: > Signed-off-by: Zheng Yongjun Why is mutex_init() too late? We only take the mutex after we mounting an ext4 file system, and that can't happen until ext4_init_fs is called. - Ted > fs/ext4/super.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/fs/ext4/super.c b/fs/ext4/super.c > index 94472044f4c1..8776f06a639d 100644 > --- a/fs/ext4/super.c > +++ b/fs/ext4/super.c > @@ -59,7 +59,7 @@ > #include > > static struct ext4_lazy_init *ext4_li_info; > -static struct mutex ext4_li_mtx; > +static DEFINE_MUTEX(ext4_li_mtx); > static struct ratelimit_state ext4_mount_msg_ratelimit; > > static int ext4_load_journal(struct super_block *, struct ext4_super_block *, > @@ -6640,7 +6640,6 @@ static int __init ext4_init_fs(void) > > ratelimit_state_init(&ext4_mount_msg_ratelimit, 30 * HZ, 64); > ext4_li_info = NULL; > - mutex_init(&ext4_li_mtx); > > /* Build-time check for flags consistency */ > ext4_check_flag_values(); > -- > 2.22.0 >