NFS/ro: mv: cannot move 'foo' to a subdirectory of itself, 'bar'
Hello,
I try to use overlay for network boot clients using an NFS read-only filesystem. This works pretty well, except renaming files with the mv command fails:
==========================
# ls -l -rw-r--r-- 1 root root 785 Mar 27 2016 foo
# mv foo bar mv: cannot move 'foo' to a subdirectory of itself, 'bar' ==========================
I mount the overlay filesystem as follows in the initrd, where /root is already mounted read-only from NFS:
==========================
mkdir /writable
mkfs.ext2 /dev/ram0 >/dev/null
mount -n /dev/ram0 /writable >/dev/null
mkdir /writable/upper
mkdir /writable/work
modprobe overlay
mount -t overlay overlay -olowerdir=/root,upperdir=/writable/upper,workdir=/writable/work,default_permissions /root
==========================
kernel version is 4.7.0-rc2, git cloned fromgit://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/vfs.git,
using the overlayfs-next branch.
is this a bug ?
can I help anything debugging fixing this ?
Regards,
André
Quoted 29 lines · André Roth
Hello,
I try to use overlay for network boot clients using an NFS read-only filesystem. This works pretty well, except renaming files with the mv command fails:
==========================
# ls -l -rw-r--r-- 1 root root 785 Mar 27 2016 foo# mv foo bar mv: cannot move 'foo' to a subdirectory of itself, 'bar' ==========================I mount the overlay filesystem as follows in the initrd, where /root is already mounted read-only from NFS:
==========================
mkdir /writable
mkfs.ext2/dev/ram0>/dev/null
mount -n/dev/ram0/writable >/dev/nullmkdir /writable/upper
mkdir /writable/workmodprobe overlay
mount -t overlay overlay -olowerdir=/root,upperdir=/writable/upper,workdir=/writable/work,default_permissions /root
==========================
Quoted 6 lines
kernel version is 4.7.0-rc2, git cloned from
git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/vfs.git,
using the overlayfs-next branch.is this a bug ?
can I help anything debugging fixing this ?
# echo 'module overlay +mp' > /sys/kernel/debug/dynamic_debug/control # strace -o /tmp/strace mv foo bar # dmesg | grep overlay > /tmp/debug
And post the /tmp/strace and /tmp/debug files.
Thanks,
Miklos
Hello,
Quoted 5 lines
# echo 'module overlay +mp' > /sys/kernel/debug/dynamic_debug/control # strace -o /tmp/strace mv foo bar # dmesg | grep overlay > /tmp/debugAnd post the
/tmp/straceand/tmp/debugfiles.
# strace -o /tmp/strace mv OVERLAYFS foo mv: cannot move ‘OVERLAYFS’ to a subdirectory of itself, ‘foo’
files attached...
Regards,
André
Quoted 7 lines · André Roth
Hello,
Quoted 4 lines
# echo 'module overlay +mp' > /sys/kernel/debug/dynamic_debug/control # strace -o /tmp/strace mv foo bar # dmesg | grep overlay > /tmp/debug
Quoted 6 lines
Quoted 1 line
And post the
/tmp/straceand/tmp/debugfiles.# strace -o /tmp/strace mv OVERLAYFS foo mv: cannot move ‘OVERLAYFS’ to a subdirectory of itself, ‘foo’files attached...
Overlayfs cannot create a whiteout on the upper fs.
Do you have
CONFIG_EXT4_USE_FOR_EXT2=y
in your kernel's .config? If not, then you should.
You'll also need
a4859d75944a ("ovl: fix dentry leak for default_permissions")
from the overlayfs-linus branch of
git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/vfs.git
otherwise "default_permissions" will misbehave.
Thanks,
Miklos
Quoted 6 lines
Do you have
CONFIG_EXT4_USE_FOR_EXT2=yin your kernel's .config? If not, then you should.
nope
Quoted 7 lines
You'll also need
a4859d75944a("ovl: fix dentry leak fordefault_permissions")from the overlayfs-linus branch of
git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/vfs.git
works like a charm now :)
Quoted 1 line
otherwise "
default_permissions" will misbehave.
thanks for the information !
regards,
andré