linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Mike Kravetz <mike.kravetz@oracle.com>
To: Chengguang Xu <cgxu519@mykernel.net>,
	David Howells <dhowells@redhat.com>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] hugetlbfs: fix error handling in init_hugetlbfs_fs()
Date: Thu, 17 Oct 2019 17:47:09 -0700	[thread overview]
Message-ID: <49ec37c4-bb74-d0d2-1dee-00778e08b8cb@oracle.com> (raw)
In-Reply-To: <ccfddf19-630f-ad38-68b3-16003e740113@oracle.com>

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 <cgxu519@mykernel.net>
>> ---
>>  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


  reply	other threads:[~2019-10-18  0:47 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-17 10:38 [PATCH] hugetlbfs: fix error handling in init_hugetlbfs_fs() Chengguang Xu
2019-10-18  0:08 ` Mike Kravetz
2019-10-18  0:47   ` Mike Kravetz [this message]
2019-10-28 21:27 ` Mike Kravetz
2019-10-29  4:36   ` Chengguang Xu
2019-10-29 20:47     ` Mike Kravetz
2019-10-29 22:24       ` Andrew Morton
2019-10-29 22:36         ` Mike Kravetz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=49ec37c4-bb74-d0d2-1dee-00778e08b8cb@oracle.com \
    --to=mike.kravetz@oracle.com \
    --cc=cgxu519@mykernel.net \
    --cc=dhowells@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).