Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp18820879ybl; Fri, 3 Jan 2020 09:38:38 -0800 (PST) X-Google-Smtp-Source: APXvYqxTJAajYwJgtX6wOlGd730r/2K4bTUVdkQoDGSxAMZWoilBGbzafuqwmTld0TE/utwJuDX7 X-Received: by 2002:a9d:588d:: with SMTP id x13mr94566788otg.6.1578073118065; Fri, 03 Jan 2020 09:38:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578073118; cv=none; d=google.com; s=arc-20160816; b=GeoZD8fKTfn51u/Tlomuqdqaahqx61aUGIII8EUCym88fMOjWweFDeXxuun6x9I8c0 9YRyZhTPYdNzaiulChsms3PTAf2D8uGiQSUQ2AJy56UZKnVqOG2bqA5i8dJAXx2/2b00 SH4qMl0PVdqBLl7+I0xWrIHTJTWuujpDKA4UrcdQQKGSIhMxCaTFDgApWwnuN13XwKc9 ogCgDGVTTcJ1TaGpA/F5MCWP6GyTzmk84jHcqbDTQJEnmeuTI1hsCviwilTPDUVrg9bj R35eCnVUiP0ekWcPIXOYFlfwEmEfu4CafqJPfVk+zu72jNPFmpssA4OVdzrBDZIsrtS1 ywYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=lE502Wp8axSPxP1a0NqFJAAmRZDHUYV86o+n/g9pdRs=; b=FyQbyKAM7XYp0mT1IJqkL2FVvgz/Dyo1Dr4s9rFZ87Y/kY3d4MkCOGJ1dnnXT3slaC GqQF35lG0PhIAANhO/sY69kL6ZWjnxySgqFwNg2c579PqVbs3AhCzkN+TVT0qGhQsXGj iU8UnjPQ5oSfhKbD0QHQCnZ85wclqZWw1Cu0M4CQ3amqfSng66tgUea4cOkrCrTbMzUU Z8erxGRWVHHIAYLunLc1GWTbORNA59ZL2RmtxZaC3kTqOBBXDKWpuqWikSb9Bp6Jve6G 9mSjEWUt1fSQjEqFA5jNstiw/uRfxwXzYHeQMSUQwgm0t4RNk7EpWK22gFIHnR1Y0ff+ x4fA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ewY9NTJS; 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l6si24715756otq.132.2020.01.03.09.38.25; Fri, 03 Jan 2020 09:38:38 -0800 (PST) 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=@redhat.com header.s=mimecast20190719 header.b=ewY9NTJS; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728115AbgACRhk (ORCPT + 99 others); Fri, 3 Jan 2020 12:37:40 -0500 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:22207 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726077AbgACRhk (ORCPT ); Fri, 3 Jan 2020 12:37:40 -0500 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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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)) -- 1.8.3.1