From patchwork Fri Jan 3 17:37:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Stancek X-Patchwork-Id: 11317229 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5952C138C for ; Fri, 3 Jan 2020 17:37:43 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 1DF1D215A4 for ; Fri, 3 Jan 2020 17:37:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="ewY9NTJS" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1DF1D215A4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 4F8BE8E0005; Fri, 3 Jan 2020 12:37:42 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 4A9538E0003; Fri, 3 Jan 2020 12:37:42 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3BF348E0005; Fri, 3 Jan 2020 12:37:42 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0081.hostedemail.com [216.40.44.81]) by kanga.kvack.org (Postfix) with ESMTP id 271098E0003 for ; Fri, 3 Jan 2020 12:37:42 -0500 (EST) Received: from smtpin01.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id DBF4F181AC550 for ; Fri, 3 Jan 2020 17:37:41 +0000 (UTC) X-FDA: 76337030322.01.oil48_8d323b335e16 X-Spam-Summary: 1,0,0,,d41d8cd98f00b204,jstancek@redhat.com,:mike.kravetz@oracle.com:akpm@linux-foundation.org::linux-kernel@vger.kernel.org:jstancek@redhat.com,RULES_HIT:30054:30070:30090,0,RBL:207.211.31.81:@redhat.com:.lbl8.mailshell.net-62.18.0.100 66.10.201.10,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:34,LUA_SUMMARY:none X-HE-Tag: oil48_8d323b335e16 X-Filterd-Recvd-Size: 2743 Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by imf33.hostedemail.com (Postfix) with ESMTP for ; Fri, 3 Jan 2020 17:37:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1578073059; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc; bh=lE502Wp8axSPxP1a0NqFJAAmRZDHUYV86o+n/g9pdRs=; b=ewY9NTJSQB249mZKC/BXgKY9dXKDBciJ1+8g23m2rolbsQVWh4Vw1A+QGwPG+1toojy6XX zQvY9BzfviyW3lnsUYtEUG6QVFYcKFdjjs6cktkN2R9Rw1BQJqrdbIxCmSUN2oaK27aIW2 vwXAVc6FjpsBZFOZu/gLF5vHtxaC6/g= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-335-97xtMnvZM9OIJ9L2EblzHQ-1; Fri, 03 Jan 2020 12:37:36 -0500 X-MC-Unique: 97xtMnvZM9OIJ9L2EblzHQ-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DCA571005514; Fri, 3 Jan 2020 17:37:34 +0000 (UTC) Received: from dustball.brq.redhat.com (unknown [10.43.17.163]) by smtp.corp.redhat.com (Postfix) with ESMTP id A09321001281; Fri, 3 Jan 2020 17:37:33 +0000 (UTC) From: Jan Stancek To: mike.kravetz@oracle.com, akpm@linux-foundation.org, linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org, jstancek@redhat.com Subject: [PATCH] mm/hugetlbfs: fix for_each_hstate() loop in init_hugetlbfs_fs() Date: Fri, 3 Jan 2020 18:37:18 +0100 Message-Id: X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: LTP memfd_create04 started failing for some huge page sizes after v5.4-10135-gc3bfc5dd73c6. Problem is check introduced to for_each_hstate() loop that should skip default_hstate_idx. Since it doesn't update 'i' counter, all subsequent huge page sizes are skipped as well. Fixes: 8fc312b32b25 ("mm/hugetlbfs: fix error handling when setting up mounts") Signed-off-by: Jan Stancek Reviewed-by: Mike Kravetz --- fs/hugetlbfs/inode.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index d5c2a3158610..a66e425884d1 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c @@ -1498,8 +1498,10 @@ static int __init init_hugetlbfs_fs(void) /* other hstates are optional */ i = 0; for_each_hstate(h) { - if (i == default_hstate_idx) + if (i == default_hstate_idx) { + i++; continue; + } mnt = mount_one_hugetlbfs(h); if (IS_ERR(mnt))