All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] overlayfs multiple mount protection
@ 2017-05-23  9:50 Amir Goldstein
  2017-05-23  9:50 ` [PATCH 1/2] vfs: introduce inode 'inuse' lock Amir Goldstein
  2017-05-23  9:50 ` [PATCH 2/2] ovl: get exclusive ownership on upper/work dirs Amir Goldstein
  0 siblings, 2 replies; 11+ messages in thread
From: Amir Goldstein @ 2017-05-23  9:50 UTC (permalink / raw)
  To: Miklos Szeredi; +Cc: Al Viro, linux-unionfs, linux-fsdevel

Miklos,

I've implemented verification that lower root dir matches the origin file
handle stored at upper root dir with the verify_lower mount option [1].

As you correctly noted, before we move on to verifying that upper dir
'belongs to' lower dir and that index dir 'belongs to' upper dir for the
case of mounting not at the same time, we first need to cover the case of
mount at the same time.

This patch set provides protection against reuse of upperdir and workdir
by two different overlay instances at the same time, e.g.:

root@kvm-xfstests:~/unionmount-testsuite# mount -t overlay
overlay on /mnt type overlay (rw,noatime,lowerdir=/lower,upperdir=/upper/0,workdir=/upper/work)
root@kvm-xfstests:~/unionmount-testsuite# mount -t overlay overlay /backup/ -o rw,noatime,lowerdir=/lower,upperdir=/upper/0,workdir=/upper/work
overlayfs: upperdir in-use by another overlay mount?
mount: overlay is already mounted or /backup busy
       overlay is already mounted on /mnt
root@kvm-xfstests:~/unionmount-testsuite# mkdir /upper/1
root@kvm-xfstests:~/unionmount-testsuite# mount -t overlay overlay /snapshot/ -o rw,noatime,lowerdir=/lower,upperdir=/upper/1,workdir=/upper/work
overlayfs: workdir in-use by another overlay mount?
mount: overlay is already mounted or /snapshot busy
       overlay is already mounted on /mnt

It also provides protection against removal of workdir just after mount,
which would have caused failures to copy up:

root@kvm-xfstests:~/unionmount-testsuite# rmdir /upper/work/work/
rmdir: failed to remove '/upper/work/work/': Device or resource busy

[1] https://github.com/amir73il/linux/commits/ovl-verify-dir

Amir Goldstein (2):
  vfs: introduce inode 'inuse' lock
  ovl: get exclusive ownership on upper/work dirs

 fs/btrfs/ioctl.c     |  3 +++
 fs/inode.c           | 40 ++++++++++++++++++++++++++++++
 fs/namei.c           |  3 +++
 fs/overlayfs/super.c | 70 +++++++++++++++++++++++++++++++++++++++++++++++++---
 include/linux/fs.h   | 16 ++++++++++++
 5 files changed, 129 insertions(+), 3 deletions(-)

-- 
2.7.4

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2017-05-31 15:16 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-23  9:50 [PATCH 0/2] overlayfs multiple mount protection Amir Goldstein
2017-05-23  9:50 ` [PATCH 1/2] vfs: introduce inode 'inuse' lock Amir Goldstein
2017-05-31 10:09   ` Miklos Szeredi
2017-05-31 13:54     ` Amir Goldstein
2017-05-31 14:30       ` Miklos Szeredi
2017-05-31 15:16         ` Amir Goldstein
2017-05-23  9:50 ` [PATCH 2/2] ovl: get exclusive ownership on upper/work dirs Amir Goldstein
2017-05-31 10:18   ` Miklos Szeredi
2017-05-31 12:47     ` Amir Goldstein
2017-05-31 13:05       ` Amir Goldstein
2017-05-31 13:24         ` Miklos Szeredi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.