ovl: fix regression caused by exclusive upper/work dir protection
authorAmir Goldstein <[email protected]>
Fri, 29 Sep 2017 07:21:21 +0000 (10:21 +0300)
committerMiklos Szeredi <[email protected]>
Thu, 5 Oct 2017 13:53:18 +0000 (15:53 +0200)
commit85fdee1eef1a9e48ad5716916677e0c5fbc781e3
tree9f2096f14047af5ce55aacfc9a7b90a7f7405f09
parent5820dc0888d302ac05f8b91ffdf7e4e53b4fbf53
ovl: fix regression caused by exclusive upper/work dir protection

Enforcing exclusive ownership on upper/work dirs caused a docker
regression: https://github.com/moby/moby/issues/34672.

Euan spotted the regression and pointed to the offending commit.
Vivek has brought the regression to my attention and provided this
reproducer:

Terminal 1:

  mount -t overlay -o workdir=work,lowerdir=lower,upperdir=upper none
        merged/

Terminal 2:

  unshare -m

Terminal 1:

  umount merged
  mount -t overlay -o workdir=work,lowerdir=lower,upperdir=upper none
        merged/
  mount: /root/overlay-testing/merged: none already mounted or mount point
         busy

To fix the regression, I replaced the error with an alarming warning.
With index feature enabled, mount does fail, but logs a suggestion to
override exclusive dir protection by disabling index.
Note that index=off mount does take the inuse locks, so a concurrent
index=off will issue the warning and a concurrent index=on mount will fail.

Documentation was updated to reflect this change.

Fixes: 2cac0c00a6cd ("ovl: get exclusive ownership on upper/work dirs")
Cc: <[email protected]> # v4.13
Reported-by: Euan Kemp <[email protected]>
Reported-by: Vivek Goyal <[email protected]>
Signed-off-by: Amir Goldstein <[email protected]>
Signed-off-by: Miklos Szeredi <[email protected]>
Documentation/filesystems/overlayfs.txt
fs/overlayfs/ovl_entry.h
fs/overlayfs/super.c