Received: by 10.192.165.148 with SMTP id m20csp2823734imm; Mon, 7 May 2018 01:39:50 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqkMU9G2jQ47/ixN1EZAmFLl6bTCHbWLhXVsXxVKXKQa/TJztzXxkhSY+Q5g631tcpwGiLT X-Received: by 2002:a17:902:144:: with SMTP id 62-v6mr37341719plb.202.1525682390890; Mon, 07 May 2018 01:39:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525682390; cv=none; d=google.com; s=arc-20160816; b=hk/hyQSm4tSgYTg1rXQOs3JJaBvkrkjEhrQ1L02mzaAKJmjST1mxzwCQvD1jKNy66s 1qmDsCWB16TxsyoKlggWTbOAmJlQbV40+QFscLvwwFeGhOA0t/3cJZjhrqZE3eQCNk07 Z4LjxToCaSGDeudjeE9T4lnjDTiVlXAX3sbFHa2nzqru2CVQSY1y7+UdY4rG4TUalkbd 38EOkDU833WLOdxsrxZOO3VUvoqy0uO0xuR+GvKKNOFMwkp6Zc6qr+x0UyO16PdZOw3R uxOQ1QL01gJ+hQgsaq2xHFkbGXZwH26ntHVUuSY0W+rnLyF11emYxUEfuGip2PdQwiqh 9Lfw== 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 :arc-authentication-results; bh=SxyZrACj+hd8TV1c8TxSAfuenu9KOm9wmUI0QczyAao=; b=CgC1yJ+XXyVwCKMKpM5HzOSS7+F2UbPiWZ7M/udJmDTskOAXojqQeeQm4dQ8rt+ZGp Y+QcfaWufCVjhukbqXvXKVfYJ/lC3gHdZ+70XEhDVK8paGYt2xpGzW4h35/kiGkLXQ7v 5FuY/LNVEm73UT/HaXALI3utK85+QZR9dgVb74zkJp4Uh0oOvNU7adkM6fR/RDjkGwkG jTUHLcpFUCfP6HDJjzOAgcauiK/AtHvPMTZA62ZEC1cG/2FdhsrPxG39QBGoC/UizbEs EkQRCxt1NMjmahWFMLvH4y/T0yY005xB1EAnisYaJxU4QRh8KNJSryzrHqPc43QzbN7r Zy2A== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (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 z11si5062003pfm.330.2018.05.07.01.39.37; Mon, 07 May 2018 01:39:50 -0700 (PDT) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752063AbeEGIiR (ORCPT + 99 others); Mon, 7 May 2018 04:38:17 -0400 Received: from mail-wr0-f180.google.com ([209.85.128.180]:33729 "EHLO mail-wr0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751977AbeEGIiN (ORCPT ); Mon, 7 May 2018 04:38:13 -0400 Received: by mail-wr0-f180.google.com with SMTP id o4-v6so27840714wrm.0 for ; Mon, 07 May 2018 01:38:13 -0700 (PDT) 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; bh=SxyZrACj+hd8TV1c8TxSAfuenu9KOm9wmUI0QczyAao=; b=anaW48xkckpWFwAOXfvVg1+Mr7M6gZWOLvQaEE1KfJO/QeUMiZwdCnJXgdCegBdxsJ Mao/J6M58r85Bd+8hernP3q7k0G1DBBDRiTbtNxya5xJrz+UdWk8qWqyxoKU5difk57L tjs90USuYPMhZ2eogdyyiCsEdrmKRiE5VDenNwWObPIS4a9Zd8Zk9memoHPXaOnlh/Xr SPk5MY5PPsIV9dui6XCSvJV28+3v0fU6JAQkJ3+eTZWCWEtKulldOdA+Ms7YwBg3NxFw neQZv+Vly4KSM8hF4odq1rihjr4FZwYx4+pm/LUicV2kQQNAzQtf7o9YYQapnqkijuDp BbQg== X-Gm-Message-State: ALQs6tDTuilt/FZkuTjWL6zz5Qs/p8YO+IchrG6a0kvoutZy74xKUgF9 DGjzaOG3uoxO2oO7sk/Zcy+89tRWXPE= X-Received: by 2002:adf:adf0:: with SMTP id w103-v6mr30792226wrc.101.1525682292342; Mon, 07 May 2018 01:38:12 -0700 (PDT) Received: from veci.piliscsaba.redhat.com (C2B0E321.catv.pool.telekom.hu. [194.176.227.33]) by smtp.gmail.com with ESMTPSA id h8-v6sm5908050wmc.16.2018.05.07.01.38.11 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 07 May 2018 01:38:11 -0700 (PDT) From: Miklos Szeredi To: linux-unionfs@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Al Viro Subject: [PATCH v2 00/35] overlayfs: stack file operations Date: Mon, 7 May 2018 10:37:32 +0200 Message-Id: <20180507083807.28792-1-mszeredi@redhat.com> X-Mailer: git-send-email 2.14.3 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [Al, can you please review the vfs affecting patches? ] Up till now overlayfs didn't stack regular file operations. Instead, when a file was opened on an overlay, the file from one of the underlying layers would be opened and any file operations performed would directly go to the underlying file on a real filesystem. This works well mostly, but various hacks were added to the VFS to work around issues with this: - d_path() and friends - relatime handling - file locking - fsnotify - writecount handling There are also issues that are unresolved before this patchset: - ioctl's that need write access but can be performed on a O_RDONLY fd - ro/rw inconsistency: file on lower layer opened for read-only will return stale data on read after copy-up and modification - ro/rw inconsistency for mmap: file on lower layer mapped shared will contain stale data after copy-up and modification This patch series reverts the VFS hacks (with the exception of d_path) and fixes the unresoved issues. We need to keep d_path related hacks, because memory maps are still not stacked, yet d_path() should keep working on vma->vm_file->f_path. No regressions were observed after running various test suites (xfstests, ltp, unionmount-testsuite, pjd-fstest). Performance impact of stacking was found to be minimal. Memory use for open overlay files increases by about 256bytes or 12% of total (files + pinned dentries + pinned inodes). Git tree is here: git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/vfs.git overlayfs-rorw Thanks, Miklos Changes from v1: - split out dedupe API cleanup - update documentation and comments - clean up directory modification helpers inside overlayfs - make functions static - added compat ioctl - check for upper files in dedupe - bring back d_real_inode() as a new user just cropped up in 4.17 --- Miklos Szeredi (35): vfs: add path_open() vfs: optionally don't account file in nr_files vfs: add f_op->pre_mmap() vfs: export vfs_ioctl() to modules vfs: export vfs_dedupe_file_range_one() to modules ovl: copy up times ovl: copy up inode flags Revert "Revert "ovl: get_write_access() in truncate"" ovl: copy up file size as well ovl: deal with overlay files in ovl_d_real() ovl: stack file ops ovl: add helper to return real file ovl: add ovl_read_iter() ovl: add ovl_write_iter() ovl: add ovl_fsync() ovl: add ovl_mmap() ovl: add ovl_fallocate() ovl: add lsattr/chattr support ovl: add ovl_fiemap() ovl: add O_DIRECT support ovl: add reflink/copyfile/dedup support vfs: don't open real ovl: copy-up on MAP_SHARED vfs: simplify dentry_open() Revert "ovl: fix may_write_real() for overlayfs directories" Revert "ovl: don't allow writing ioctl on lower layer" vfs: fix freeze protection in mnt_want_write_file() for overlayfs Revert "ovl: fix relatime for directories" Revert "vfs: update ovl inode before relatime check" Revert "vfs: add flags to d_real()" Revert "vfs: do get_write_access() on upper layer of overlayfs" Partially revert "locks: fix file locking on overlayfs" Revert "fsnotify: support overlayfs" vfs: remove open_flags from d_real() ovl: fix documentation of non-standard behavior Documentation/filesystems/Locking | 4 +- Documentation/filesystems/overlayfs.txt | 60 ++-- Documentation/filesystems/vfs.txt | 19 +- fs/file_table.c | 13 +- fs/inode.c | 46 +-- fs/internal.h | 17 +- fs/ioctl.c | 1 + fs/locks.c | 20 +- fs/namei.c | 2 +- fs/namespace.c | 69 +---- fs/open.c | 74 ++--- fs/overlayfs/Kconfig | 21 ++ fs/overlayfs/Makefile | 4 +- fs/overlayfs/dir.c | 33 ++- fs/overlayfs/file.c | 506 ++++++++++++++++++++++++++++++++ fs/overlayfs/inode.c | 63 +++- fs/overlayfs/overlayfs.h | 21 +- fs/overlayfs/ovl_entry.h | 1 + fs/overlayfs/super.c | 65 ++-- fs/overlayfs/util.c | 11 +- fs/read_write.c | 6 +- fs/xattr.c | 9 +- include/linux/dcache.h | 15 +- include/linux/fs.h | 28 +- include/linux/fsnotify.h | 14 +- include/uapi/linux/fs.h | 1 - mm/util.c | 5 + 27 files changed, 824 insertions(+), 304 deletions(-) create mode 100644 fs/overlayfs/file.c -- 2.14.3