public inbox for linux-unionfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Vivek Goyal <vgoyal@redhat.com>
To: Amir Goldstein <amir73il@gmail.com>, Miklos Szeredi <miklos@szeredi.hu>
Cc: linux-unionfs@vger.kernel.org
Subject: [PATCH] overlayfs, doc: Do not allow lower layer recreation with redirect_dir enabled
Date: Thu, 9 Jul 2020 10:02:20 -0400	[thread overview]
Message-ID: <20200709140220.GC150543@redhat.com> (raw)

Currently we seem to support lower layer recreation and re-use with existing
upper until and unless "index" or "metadata only copy up" feature is
enabled.

If redirect_dir feature is enabled then re-creating/modifying lower layers
will break things. For example.

- mkdir lower lower/foo upper work merged
- touch lower/foo/foo-child
- mount -t overlay -o lowerdir=lower,upperdir=upper,workdir=work,redirect_dir=on none merged
- mv merged/foo merged/bar
- ls merged/bar/ (this should list foo-child)

- umount merged
- mv lower/foo lower/baz
- mount -t overlay -o lowerdir=lower,upperdir=upper,workdir=work,redirect_dir=on none merged
- ls merged/bar/  (Now foo-child has disappeared)

IOW, modifying lower layers did not crash overlay but it resulted in
directory contents being lost and that can be unexpected. So don't
support lower layer recreation/modification when redirect_dir is enabled
at any point of time.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
---
 Documentation/filesystems/overlayfs.rst | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/Documentation/filesystems/overlayfs.rst b/Documentation/filesystems/overlayfs.rst
index 660dbaf0b9b8..1d1a8da7fdbc 100644
--- a/Documentation/filesystems/overlayfs.rst
+++ b/Documentation/filesystems/overlayfs.rst
@@ -371,8 +371,8 @@ conflict with metacopy=on, and will result in an error.
 [*] redirect_dir=follow only conflicts with metacopy=on if upperdir=... is
 given.
 
-Sharing and copying layers
---------------------------
+Sharing, copying and recreating lower layers
+--------------------------------------------
 
 Lower layers may be shared among several overlay mounts and that is indeed
 a very common practice.  An overlay mount may use the same lower layer
@@ -388,8 +388,12 @@ though it will not result in a crash or deadlock.
 
 Mounting an overlay using an upper layer path, where the upper layer path
 was previously used by another mounted overlay in combination with a
-different lower layer path, is allowed, unless the "inodes index" feature
-or "metadata only copy up" feature is enabled.
+different lower layer path, is allowed, unless any of the following features
+is enabled at any point of time.
+
+- inode index
+- metadata only copy up
+- redirect_dir
 
 With the "inodes index" feature, on the first time mount, an NFS file
 handle of the lower layer root directory, along with the UUID of the lower
-- 
2.25.4


             reply	other threads:[~2020-07-09 14:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-09 14:02 Vivek Goyal [this message]
2020-07-09 14:14 ` [PATCH] overlayfs, doc: Do not allow lower layer recreation with redirect_dir enabled Vivek Goyal
2020-07-09 14:49   ` Amir Goldstein
2020-07-09 15:36     ` Vivek Goyal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200709140220.GC150543@redhat.com \
    --to=vgoyal@redhat.com \
    --cc=amir73il@gmail.com \
    --cc=linux-unionfs@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox