Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp20496617ybl; Sun, 5 Jan 2020 04:06:18 -0800 (PST) X-Google-Smtp-Source: APXvYqzPvYTvDUoQAkLI341+IHlBHGCz0Co9CgIH7TAq4MvjnTxegV2PQhayQuD71G5Xaukb9A3M X-Received: by 2002:a05:6830:1e8a:: with SMTP id n10mr98573424otr.303.1578225978807; Sun, 05 Jan 2020 04:06:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578225978; cv=none; d=google.com; s=arc-20160816; b=STK3jVMSB/1tmauv4pEK2OJzVvTLkokl6gSnYbGsvh6AEWykbtypwwBPYEAAYaLV6f qhYxL2kHqJvVC4Jq/Ir1nV80BgpKPxd8WuQ6G1+rnGL43EEko/poUcwr6Msg23BlmN7o SlYIIwh4+ZF2l71srLvScwVKPhdy1DbTVeQRVrNG7teMNo7VfoJ/rUNcIhejrt/c2+wc GMYxijHDumuV48g8nPvw0q+yvYnRosTN6YdPH0uWTY9hz9KchAsYqg9Dz+Qy7Hm/OMH6 r4fCHmWp3T3buZAFI/UmZ0CIZ5Zg4FVeZYcciRzBabIPr7qKZNXxHEN7dvIBAQcZU1hm FlqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition:mime-version :message-id:subject:cc:to:from:date:dkim-signature; bh=H1hJLNQee379aq3/tU9tTxHeBbBKoIXcCyb5gddw+z0=; b=zZLWFsmy/iJRr9KaICWTUWVO0owNmaqZJ9D+skbuAvzdERbfzWyZ3CzG4FEyCUi8re x3vwe9iqRFSx+0yXzQbnZcmB4Ti7Swal8BuroPjV8fGXvJB29wGbZHFNrIsZn8My+c2u mUESuQ/uXm0Uwb+sZLOP3x2bIonVZ6BozaP3ASa/9wmXl3d09rCKElfL3veeSke36CwZ 3e+d1fAYXHWSyzg1VbiZIlR3Qz3ZLrXnz9CElDzIfwWFSIlHgoPJonFeyHUdTfmhK43a 8PSUv+afe9g2bsu5Cc+imJ0FTfTrhhSWzpF9EPsx/6nf2/GWHi2Ebv10nF8DF/9wrwoz +PMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chrisdown.name header.s=google header.b=s9D99V0h; 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=chrisdown.name Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r1si33615816otn.150.2020.01.05.04.06.05; Sun, 05 Jan 2020 04:06:18 -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=@chrisdown.name header.s=google header.b=s9D99V0h; 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=chrisdown.name Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726212AbgAEMFZ (ORCPT + 99 others); Sun, 5 Jan 2020 07:05:25 -0500 Received: from mail-wr1-f68.google.com ([209.85.221.68]:46206 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725990AbgAEMFZ (ORCPT ); Sun, 5 Jan 2020 07:05:25 -0500 Received: by mail-wr1-f68.google.com with SMTP id z7so46525947wrl.13 for ; Sun, 05 Jan 2020 04:05:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chrisdown.name; s=google; h=date:from:to:cc:subject:message-id:mime-version:content-disposition; bh=H1hJLNQee379aq3/tU9tTxHeBbBKoIXcCyb5gddw+z0=; b=s9D99V0hhwG8BrJ6pW+LVYSffkdsoaBLwNeOukJHDMIXgSD6bHgOQzR65WF7hdzmWF 4igDoTk2Jrc30WIXJjWsJvUibhNZACpbR9WKX7169TL7ASJL/qcm1BM/8Gb+MM4kLEe/ VlFkIr8G08H9znscjvgmDqE19S23KbBnTyYrg= 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:message-id:mime-version :content-disposition; bh=H1hJLNQee379aq3/tU9tTxHeBbBKoIXcCyb5gddw+z0=; b=jiPugxOppo2M9vurPp1VzzBr9xcYsZMjeccrjlNOAoHrVFQ9aspwkK5Uq6iv5f/EjW IOpQ79YQQ9vBdkVAHB4WYHkkxKeMy3Gf1vg4AXmxTCWlX2sdc9TCN79VE5DhrXu6T7hC P93ZtTulwctzeprm5XMGi2etDWreSyg7asPWo/DiVUZSO2tWoYERF+3LOOLfr68TJ3Ib IeicG1e5URzjrBUKYvsiY19OuulqazI2RtBmwMS6LCApneiCn59QlvgBkS5qdW01xkXc PIYV3Gj7GDg1yWSigma6ZAXsZFJpqOJsN9+rPddcMJ8SYo+j4M2FTtjTMnVbFKJJlr40 DfNw== X-Gm-Message-State: APjAAAX9+GdH/9EECpxjZJ9VRA7wxC87K6GCLUx8RHEZ4lX1cRQioZ12 xN9EdFdPzS40dRd7FRH/ZcclBH6+VmI= X-Received: by 2002:a5d:5403:: with SMTP id g3mr8357673wrv.302.1578225923244; Sun, 05 Jan 2020 04:05:23 -0800 (PST) Received: from localhost ([2620:10d:c092:180::1:e1d7]) by smtp.gmail.com with ESMTPSA id p5sm69068815wrt.79.2020.01.05.04.05.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Jan 2020 04:05:22 -0800 (PST) Date: Sun, 5 Jan 2020 12:05:22 +0000 From: Chris Down To: linux-mm@kvack.org Cc: Hugh Dickins , Andrew Morton , Al Viro , Matthew Wilcox , Amir Goldstein , Jeff Layton , Johannes Weiner , Tejun Heo , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@fb.com Subject: [PATCH v5 0/2] fs: inode: shmem: Reduce risk of inum overflow Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In Facebook production we are seeing heavy i_ino wraparounds on tmpfs. On affected tiers, in excess of 10% of hosts show multiple files with different content and the same inode number, with some servers even having as many as 150 duplicated inode numbers with differing file content. This causes actual, tangible problems in production. For example, we have complaints from those working on remote caches that their application is reporting cache corruptions because it uses (device, inodenum) to establish the identity of a particular cache object, but because it's not unique any more, the application refuses to continue and reports cache corruption. Even worse, sometimes applications may not even detect the corruption but may continue anyway, causing phantom and hard to debug behaviour. In general, userspace applications expect that (device, inodenum) should be enough to be uniquely point to one inode, which seems fair enough. One might also need to check the generation, but in this case: 1. That's not currently exposed to userspace (ioctl(...FS_IOC_GETVERSION...) returns ENOTTY on tmpfs); 2. Even with generation, there shouldn't be two live inodes with the same inode number on one device. In order to mitigate this, we take a two-pronged approach: 1. Moving inum generation from being global to per-sb for tmpfs. This itself allows some reduction in i_ino churn. This works on both 64- and 32- bit machines. 2. Adding inode{64,32} for tmpfs. This fix is supported on machines with 64-bit ino_t only: we allow users to mount tmpfs with a new inode64 option that uses the full width of ino_t, or CONFIG_TMPFS_INODE64. You can see how this compares to previous related patches which didn't implement this per-superblock: - https://patchwork.kernel.org/patch/11254001/ - https://patchwork.kernel.org/patch/11023915/ Chris Down (2): tmpfs: Add per-superblock i_ino support tmpfs: Support 64-bit inums per-sb Documentation/filesystems/tmpfs.txt | 11 ++++ fs/Kconfig | 15 +++++ include/linux/shmem_fs.h | 2 + mm/shmem.c | 94 ++++++++++++++++++++++++++++- 4 files changed, 121 insertions(+), 1 deletion(-) -- 2.24.1