From mboxrd@z Thu Jan 1 00:00:00 1970 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.1 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1, USER_IN_DEF_DKIM_WL 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 D83E1C433DF for ; Sun, 2 Aug 2020 02:37:54 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 76DB120725 for ; Sun, 2 Aug 2020 02:37:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="cwdgDJlg" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 76DB120725 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 849678D00AB; Sat, 1 Aug 2020 22:37:53 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7D3288D00AA; Sat, 1 Aug 2020 22:37:53 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 69B5A8D00AB; Sat, 1 Aug 2020 22:37:53 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0108.hostedemail.com [216.40.44.108]) by kanga.kvack.org (Postfix) with ESMTP id 50FE88D00AA for ; Sat, 1 Aug 2020 22:37:53 -0400 (EDT) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id BDB543622 for ; Sun, 2 Aug 2020 02:37:52 +0000 (UTC) X-FDA: 77104068384.12.queen70_5d11e4326f91 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin12.hostedemail.com (Postfix) with ESMTP id 896911800A01D for ; Sun, 2 Aug 2020 02:37:52 +0000 (UTC) X-HE-Tag: queen70_5d11e4326f91 X-Filterd-Recvd-Size: 7169 Received: from mail-qk1-f195.google.com (mail-qk1-f195.google.com [209.85.222.195]) by imf05.hostedemail.com (Postfix) with ESMTP for ; Sun, 2 Aug 2020 02:37:52 +0000 (UTC) Received: by mail-qk1-f195.google.com with SMTP id 2so28298494qkf.10 for ; Sat, 01 Aug 2020 19:37:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=E0JAowe6RRiGLAAqLkisJ5hOzB42tZ2iwdO8AnpRtQs=; b=cwdgDJlgG6ALOxZek6jeL7JNtaTRAK6Hk53r5A5MS6760XTcVBF2koPSp1a1xlP4Sc sJEJ1QBzXbQBI399pgkYjikbp41/Uol9/5VfusZiJT2Mc91gcaaRy5ToLBrLA9kwUSGx TwKW8TlMerKtPeJDSDZylah1jkCbzTTRrPDhM1Z5c+OyI2CFp78Ld/kLCmNemaWXn3KQ F26LdbYlq1N1B/MWunqx04wybENNiHY7aAnkYeTggdTZgot2w48n41uW8DOCiQi/U6tS mcSlAGj1WcMaqDN2zAEHar9RvssqSJPBNk1vc8l56CMtcdiYzK5yAK2vgIAuI42+gAd6 uLbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=E0JAowe6RRiGLAAqLkisJ5hOzB42tZ2iwdO8AnpRtQs=; b=jzXHOnx87Os2lAN/eFBV3phnHRY+mpd7eqRYup/Zm8sQaCU5A+eX/jc9tyz7rNEaiE EJIG05EItkoTY64JC3LPA6ozdtzLTBvNSVF1/sg8rHSupbloERcOHIdJzvCs/Iqui9KF qTVvMsA49bc9VNYtz64G7fwn1KTLDyNC7irTiP9v8YrRmhjb7R6asBreNiiGPaHY6ak5 xrKgrDztXIRAh/jWFSSRdUQVugaJhczEuibXvN3wx/7q2dWilzKNjokkaNCcPXRJ69rz taggmwIOxp5NGkC0Fcd1gv0IS5NM4fyCvxy6B9ZxW5mKUuQjxEAxvKFmRR4e79hO09+a 3Lmg== X-Gm-Message-State: AOAM531aF0XmNxC8ku6xmDxHYeevRaD17vC38mwz43Jr44aax0hP7l++ mAOAJoqgq50BKhQS9BncoVuvMg== X-Google-Smtp-Source: ABdhPJzTlr6qpiL6LFMSR2Lm2/r8BeKDVDE/wBUHQN/zA6BdFdp1AtGWqA3PK4Vpi1+a6hBZ5lwe5Q== X-Received: by 2002:a37:8e42:: with SMTP id q63mr10681287qkd.16.1596335871060; Sat, 01 Aug 2020 19:37:51 -0700 (PDT) Received: from eggly.attlocal.net (172-10-233-147.lightspeed.sntcca.sbcglobal.net. [172.10.233.147]) by smtp.gmail.com with ESMTPSA id d198sm14284632qke.129.2020.08.01.19.37.48 (version=TLS1 cipher=ECDHE-ECDSA-AES128-SHA bits=128/128); Sat, 01 Aug 2020 19:37:49 -0700 (PDT) Date: Sat, 1 Aug 2020 19:37:36 -0700 (PDT) From: Hugh Dickins X-X-Sender: hugh@eggly.anvils To: Andrew Morton , Chris Down , Randy Dunlap cc: Al Viro , Matthew Wilcox , Amir Goldstein , Hugh Dickins , Jeff Layton , Johannes Weiner , Tejun Heo , linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@fb.com Subject: [PATCH mmotm] tmpfs: support 64-bit inums per-sb fix In-Reply-To: Message-ID: References: <8b23758d0c66b5e2263e08baf9c4b6a7565cbd8f.1594661218.git.chris@chrisdown.name> User-Agent: Alpine 2.11 (LSU 23 2013-08-11) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Rspamd-Queue-Id: 896911800A01D X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam03 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: Expanded Chris's Documentation and Kconfig help on tmpfs inode64. TMPFS_INODE64 still there, still default N, but writing down its very limited limitation does make me wonder again if we want the option. Signed-off-by: Hugh Dickins --- Andrew, please fold into tmpfs-support-64-bit-inums-per-sb.patch later. Randy, you're very active on Documentation and linux-next: may I ask you please to try applying this patch to latest, and see if tmpfs.rst comes out looking right to you? I'm an old dog still stuck in the days of tmpfs.txt, hoping to avoid new tricks for a while. Thanks! (Bonus points if you can explain what the "::" on line 122 is about. I started out reading Documentation/doc-guide/sphinx.rst, but... got diverted. Perhaps I should ask Mauro or Jon, but turning for help first to you.) Documentation/filesystems/tmpfs.rst | 13 ++++++++++--- fs/Kconfig | 16 +++++++++++----- 2 files changed, 21 insertions(+), 8 deletions(-) --- mmotm/Documentation/filesystems/tmpfs.rst 2020-07-27 18:54:51.116524795 -0700 +++ linux/Documentation/filesystems/tmpfs.rst 2020-08-01 18:37:07.719713987 -0700 @@ -153,11 +153,18 @@ parameters with chmod(1), chown(1) and c tmpfs has a mount option to select whether it will wrap at 32- or 64-bit inode numbers: +======= ======================== inode64 Use 64-bit inode numbers inode32 Use 32-bit inode numbers +======= ======================== + +On a 32-bit kernel, inode32 is implicit, and inode64 is refused at mount time. +On a 64-bit kernel, CONFIG_TMPFS_INODE64 sets the default. inode64 avoids the +possibility of multiple files with the same inode number on a single device; +but risks glibc failing with EOVERFLOW once 33-bit inode numbers are reached - +if a long-lived tmpfs is accessed by 32-bit applications so ancient that +opening a file larger than 2GiB fails with EINVAL. -On 64-bit, the default is set by CONFIG_TMPFS_INODE64. On 32-bit, inode64 is -not legal and will produce an error at mount time. So 'mount -t tmpfs -o size=10G,nr_inodes=10k,mode=700 tmpfs /mytmpfs' will give you tmpfs instance on /mytmpfs which can allocate 10GB @@ -170,5 +177,5 @@ RAM/SWAP in 10240 inodes and it is only Hugh Dickins, 4 June 2007 :Updated: KOSAKI Motohiro, 16 Mar 2010 -Updated: +:Updated: Chris Down, 13 July 2020 --- mmotm/fs/Kconfig 2020-07-27 18:54:59.384550639 -0700 +++ linux/fs/Kconfig 2020-08-01 18:11:33.749236321 -0700 @@ -223,12 +223,18 @@ config TMPFS_INODE64 default n help tmpfs has historically used only inode numbers as wide as an unsigned - int. In some cases this can cause wraparound, potentially resulting in - multiple files with the same inode number on a single device. This option - makes tmpfs use the full width of ino_t by default, similarly to the - inode64 mount option. + int. In some cases this can cause wraparound, potentially resulting + in multiple files with the same inode number on a single device. This + option makes tmpfs use the full width of ino_t by default, without + needing to specify the inode64 option when mounting. - To override this default, use the inode32 or inode64 mount options. + But if a long-lived tmpfs is to be accessed by 32-bit applications so + ancient that opening a file larger than 2GiB fails with EINVAL, then + the INODE64 config option and inode64 mount option risk operations + failing with EOVERFLOW once 33-bit inode numbers are reached. + + To override this configured default, use the inode32 or inode64 + option when mounting. If unsure, say N.