From patchwork Fri Feb 5 20:21:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Seth Forshee X-Patchwork-Id: 12070847 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7C93CC433DB for ; Fri, 5 Feb 2021 20:22:06 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C184A64FBB for ; Fri, 5 Feb 2021 20:22:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C184A64FBB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=canonical.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 036DA6B0006; Fri, 5 Feb 2021 15:22:05 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id F29A46B006C; Fri, 5 Feb 2021 15:22:04 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E414E6B006E; Fri, 5 Feb 2021 15:22:04 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0069.hostedemail.com [216.40.44.69]) by kanga.kvack.org (Postfix) with ESMTP id CF9846B0006 for ; Fri, 5 Feb 2021 15:22:04 -0500 (EST) Received: from smtpin24.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 832EE181AEF1E for ; Fri, 5 Feb 2021 20:22:04 +0000 (UTC) X-FDA: 77785335768.24.grip18_5a06a66275e7 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin24.hostedemail.com (Postfix) with ESMTP id 6A3631A4A0 for ; Fri, 5 Feb 2021 20:22:04 +0000 (UTC) X-HE-Tag: grip18_5a06a66275e7 X-Filterd-Recvd-Size: 4316 Received: from youngberry.canonical.com (youngberry.canonical.com [91.189.89.112]) by imf48.hostedemail.com (Postfix) with ESMTP for ; Fri, 5 Feb 2021 20:22:03 +0000 (UTC) Received: from mail-oi1-f197.google.com ([209.85.167.197]) by youngberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1l87cA-0006NO-IC for linux-mm@kvack.org; Fri, 05 Feb 2021 20:22:02 +0000 Received: by mail-oi1-f197.google.com with SMTP id g76so2800251oib.2 for ; Fri, 05 Feb 2021 12:22:02 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=0bw6oVJwOT2t9qNI5fK7SsA/zUrGWqj0vb55juGkY3Q=; b=F+EU502Ud4dwL9FZsxWnkFps/kfFVZMitiF6Sf/frdCaVJDVxgVrkFgvyYnbYeHN8z MmsO8d7VY3cxODl75iQMAStCHR1wHqQNHj0zg+mX+m00TmYm50eDgRMUcx+u+LX8oUvS mWyTFKD3XSriq7PouniUhlp3snzZIcxaKqF4alStgq1o2NVTqpISwTdoW3LENbCH4gr0 sp2tSOOiwzET9c4XS2f1NFs1TQWd5C+3LlA88BFISJxcfCP/L9Zt9x/KAgwc7L/AIJYn vnVT9fREFWhdNpdWDTQyK30AZwOXXh4o4yZx24tRlv1B3TIcLe82dflkDOBVQoagNMit 3+Bw== X-Gm-Message-State: AOAM532MOEhJW2/X2BnzDuY9Nk4MPg/68rFSNAkUwhYEPaerepD/ps/h sPfh3m5z7wyI1WZbno7f8bosIIaH10AGvVfFByQZY2OJl3gPN4mLg2p9CQF+Cc5bNvZYB5+2d+P 4oIXjKvVy0MjCE1ftfhIG5XID5BFI X-Received: by 2002:a9d:4e8d:: with SMTP id v13mr4872234otk.12.1612556521520; Fri, 05 Feb 2021 12:22:01 -0800 (PST) X-Google-Smtp-Source: ABdhPJzeRYO0Gii1AiiU6vwb6xkD5hVvY7rrtIc7AlQKKKr/BBUQ9P2nvMQroMv9GQCIOuiVz/HXyw== X-Received: by 2002:a9d:4e8d:: with SMTP id v13mr4872214otk.12.1612556521299; Fri, 05 Feb 2021 12:22:01 -0800 (PST) Received: from localhost ([2605:a601:ac0f:820:2b7:eb67:ff8d:8b15]) by smtp.gmail.com with ESMTPSA id y24sm2018025oos.44.2021.02.05.12.22.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Feb 2021 12:22:00 -0800 (PST) From: Seth Forshee To: Hugh Dickins , Andrew Morton Cc: Chris Down , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH] tmpfs: Don't use 64-bit inodes by defulat with 32-bit ino_t Date: Fri, 5 Feb 2021 14:21:59 -0600 Message-Id: <20210205202159.505612-1-seth.forshee@canonical.com> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 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: Currently there seems to be an assumption in tmpfs that 64-bit architectures also have a 64-bit ino_t. This is not true; s390 at least has a 32-bit ino_t. With CONFIG_TMPFS_INODE64=y tmpfs mounts will get 64-bit inode numbers and display "inode64" in the mount options, but passing the "inode64" mount option will fail. This leads to the following behavior: # mkdir mnt # mount -t tmpfs nodev mnt # mount -o remount,rw mnt mount: /home/ubuntu/mnt: mount point not mounted or bad option. As mount sees "inode64" in the mount options and thus passes it in the options for the remount. Ideally CONFIG_TMPFS_INODE64 would depend on sizeof(ino_t) < 8, but I don't think it's possible to test for this (potentially CONFIG_ARCH_HAS_64BIT_INO_T or similar could be added, but I'm not sure whether or not that is wanted). So fix this by simply refusing to honor the CONFIG_TMPFS_INODE64 setting when sizeof(ino_t) < 8. Fixes: ea3271f7196c ("tmpfs: support 64-bit inums per-sb") Signed-off-by: Seth Forshee --- mm/shmem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/shmem.c b/mm/shmem.c index 7c6b6d8f6c39..efde42acdc7a 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -3733,7 +3733,7 @@ static int shmem_fill_super(struct super_block *sb, struct fs_context *fc) ctx->blocks = shmem_default_max_blocks(); if (!(ctx->seen & SHMEM_SEEN_INODES)) ctx->inodes = shmem_default_max_inodes(); - if (!(ctx->seen & SHMEM_SEEN_INUMS)) + if (!(ctx->seen & SHMEM_SEEN_INUMS) && sizeof(ino_t) >= 8) ctx->full_inums = IS_ENABLED(CONFIG_TMPFS_INODE64); } else { sb->s_flags |= SB_NOUSER;