From patchwork Sun Aug 2 02:37:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hugh Dickins X-Patchwork-Id: 11696253 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 D1119138C 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 8E5652076B 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 8E5652076B 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) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 7D3288D00AA; Sat, 1 Aug 2020 22:37:53 -0400 (EDT) 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 69B5A8D00AB; Sat, 1 Aug 2020 22:37:53 -0400 (EDT) X-Original-To: linux-mm@kvack.org 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-Spam-Summary: 1,0,0,4a8566d869fcccd6,d41d8cd98f00b204,hughd@google.com,,RULES_HIT:41:355:379:800:960:973:988:989:1260:1277:1313:1314:1345:1359:1437:1516:1518:1535:1543:1593:1594:1605:1711:1730:1747:1777:1792:1801:2393:2553:2559:2562:2693:2895:2918:3138:3139:3140:3141:3142:3152:3865:3866:3867:3868:3870:3871:3872:3873:3874:4118:4250:4321:4605:5007:6119:6261:6630:6653:6742:7556:7875:7903:8603:9040:9164:10004:10400:10450:10455:11026:11232:11473:11658:11914:12043:12050:12291:12297:12438:12517:12519:12555:12663:12700:12737:12740:12895:12986:13439:14096:14097:14181:14394:14659:14721:19904:19999:21080:21324:21444:21450:21451:21627:30034:30054:30062:30090,0,RBL:209.85.222.195:@google.com:.lbl8.mailshell.net-66.100.201.100 62.18.0.100;04yfpkk3w83u57ar4is4atk9rwyi9ycmwbmetex87ma9zgrue8hcotisd3634ak.umqt499o997jc5snnz8run7ma366xu4z4auqxhg4thmrhyyaz7qzc5so5u41fns.4-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0 ,DNSBL:n 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 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.