Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp1297165ybg; Fri, 18 Oct 2019 15:25:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqynYZciN0l98usuUVvyR6OHBDf2x8AAYGkwrLdo1lo9ZGe+lhlrwwbDN3tqG5SXXLa1ZDP+ X-Received: by 2002:a05:6402:886:: with SMTP id e6mr12458275edy.152.1571437510909; Fri, 18 Oct 2019 15:25:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571437510; cv=none; d=google.com; s=arc-20160816; b=xzszhg8FMFMujvQuSuz6Vh40XREsNYLwQxgKyDFd2Y06EkjAHTKy1AEMhWkxhqdTzG LlW6dNCcgcodX+0gd3wnNKOaUw/lI03Yt8kZvbDXcrokKR/TpPxerE+ORt50bOwoDWlh ffnXTPWctG86uKT88e5z7e5oRZ6w8h1HJ81lsO/Sq9jXP3I2OwQ4o+iFH72j33M22rHb 6BR8apyOdB4mSXJX/yiT9BYam5DzyTtHyXZVkttOhJm5se2ZzUPCAJeRrXdJ6Ofw9Gvm ZrY3MAgLZi2EaxThnvgGH1ycH5sR3PZneBZjd2FpEGBzxK84ybITlyxdMpB0KipSs3zb x7Rw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:references:cc:to:from:subject:dkim-signature; bh=xOteuv/hucrhRyVuvpzt4Om0EvOQwTqguA72Fbv6uHE=; b=ciACeTQPK+ZKR9C2iHuWLHDA0p+3GieLUMqZg9ZltnxKYZgA7PBnDQBMV4W2fFr+IG xjKZy6czlBTxSXRSEMu8U7a+T8LsyEmrqzlwNPS5D0s+qvWdUjV+WJ2JNh4ORiecDAF0 M8QbMNYN3Hd6P9ETiIHtoO43RdlYau2D9Cz5e30XNF7wmZ1HNrTmgxTat9d4NQA7HPOs AUkgWDG8QXpOVfVQZ20EA4qSiEWhwB2TyfY2vTqEvonrgDRjZUlIajx8o2URr93hDtt2 J3in2XbmOYxbpDiOVNTvw5iziPL4MWMev6LLSxM/vFwluntmLcnQb27GT5aHnXhzGk18 Mriw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2019-08-05 header.b=LxXhWjj4; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q46si4557253eda.44.2019.10.18.15.24.47; Fri, 18 Oct 2019 15:25:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2019-08-05 header.b=LxXhWjj4; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2407003AbfJRArf (ORCPT + 99 others); Thu, 17 Oct 2019 20:47:35 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:45682 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726951AbfJRAre (ORCPT ); Thu, 17 Oct 2019 20:47:34 -0400 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x9I0iDGT068362; Fri, 18 Oct 2019 00:47:16 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : from : to : cc : references : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=corp-2019-08-05; bh=xOteuv/hucrhRyVuvpzt4Om0EvOQwTqguA72Fbv6uHE=; b=LxXhWjj4U4EHNr7wkcLHjUiyUGyurRvALfeYKnbhVJ5hiYxnTFbni0yCIPtWTiQWin/g RM0DdPCpN16jg3DvNMA+oZbshCf0XBqA9hmdhHHz5aMbHcYRbmafqhOhMCITgJVqALY3 jx/K/9Afuw7b+M54rZZ8bq1dPWXEyJmVTTfga222wZLx+S0MydUaYPRQ7z+Giv0Pc9rd PCSfOJmtyfRgGWTkfX3PUi5tllMg1CBNyBpjCcWZgThdUov2R2LgX/12Cd9tf94CyUvz 7TxltS3w79s6KL1y357qex3gH+0cqg1HbKo44T7U2ZLqGVjNJiGL2EDISTpYG2TZBICw Lg== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2130.oracle.com with ESMTP id 2vq0q48g0m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 18 Oct 2019 00:47:16 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x9I0h9Ko018419; Fri, 18 Oct 2019 00:47:16 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userp3030.oracle.com with ESMTP id 2vq0dw8rwu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 18 Oct 2019 00:47:15 +0000 Received: from abhmp0002.oracle.com (abhmp0002.oracle.com [141.146.116.8]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x9I0lAB7013883; Fri, 18 Oct 2019 00:47:10 GMT Received: from [192.168.1.222] (/71.63.128.209) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 18 Oct 2019 00:47:10 +0000 Subject: Re: [PATCH] hugetlbfs: fix error handling in init_hugetlbfs_fs() From: Mike Kravetz To: Chengguang Xu , David Howells Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <20191017103822.8610-1-cgxu519@mykernel.net> Message-ID: <49ec37c4-bb74-d0d2-1dee-00778e08b8cb@oracle.com> Date: Thu, 17 Oct 2019 17:47:09 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.1.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9413 signatures=668684 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1908290000 definitions=main-1910180004 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9413 signatures=668684 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1908290000 definitions=main-1910180004 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Sorry for noise, left off David On 10/17/19 5:08 PM, Mike Kravetz wrote: > Cc: David > On 10/17/19 3:38 AM, Chengguang Xu wrote: >> In order to avoid using incorrect mnt, we should set >> mnt to NULL when we get error from mount_one_hugetlbfs(). >> >> Signed-off-by: Chengguang Xu >> --- >> fs/hugetlbfs/inode.c | 9 ++++++--- >> 1 file changed, 6 insertions(+), 3 deletions(-) >> >> diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c >> index a478df035651..427d845e7706 100644 >> --- a/fs/hugetlbfs/inode.c >> +++ b/fs/hugetlbfs/inode.c >> @@ -1470,9 +1470,12 @@ static int __init init_hugetlbfs_fs(void) >> i = 0; >> for_each_hstate(h) { >> mnt = mount_one_hugetlbfs(h); >> - if (IS_ERR(mnt) && i == 0) { >> - error = PTR_ERR(mnt); >> - goto out; >> + if (IS_ERR(mnt)) { >> + if (i == 0) { >> + error = PTR_ERR(mnt); >> + goto out; >> + } >> + mnt = NULL; >> } >> hugetlbfs_vfsmount[i] = mnt; >> i++; > > Thanks! > > That should be fixed. It was introduced with commit 32021982a324 ("hugetlbfs: > Convert to fs_context"). > > That commit also changed the condition for which init_hugetlbfs_fs() would > 'error' and remove the inode cache. Previously, it would do that if there > was an error creating a mount for the default_hstate_idx hstate. It now does > that for the '0' hstate, and 0 is not always equal to default_hstate_idx. > > David was that intentional or an oversight? I can fix up, just wanted to > make sure there was not some reason for the change. > -- Mike Kravetz