* NFS/ro: mv: cannot move 'foo' to a subdirectory of itself, 'bar'
@ 2016-06-13 11:07 André Roth
2016-06-16 12:30 ` Miklos Szeredi
0 siblings, 1 reply; 5+ messages in thread
From: André Roth @ 2016-06-13 11:07 UTC (permalink / raw)
To: linux-unionfs
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 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 ?
Regards,
André
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: NFS/ro: mv: cannot move 'foo' to a subdirectory of itself, 'bar'
2016-06-13 11:07 NFS/ro: mv: cannot move 'foo' to a subdirectory of itself, 'bar' André Roth
@ 2016-06-16 12:30 ` Miklos Szeredi
2016-06-18 11:32 ` André Roth
0 siblings, 1 reply; 5+ messages in thread
From: Miklos Szeredi @ 2016-06-16 12:30 UTC (permalink / raw)
To: André Roth; +Cc: linux-unionfs
On Mon, Jun 13, 2016 at 1:07 PM, André Roth <neolynx@gmail.com> wrote:
>
> 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 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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: NFS/ro: mv: cannot move 'foo' to a subdirectory of itself, 'bar'
2016-06-16 12:30 ` Miklos Szeredi
@ 2016-06-18 11:32 ` André Roth
2016-06-29 14:21 ` Miklos Szeredi
0 siblings, 1 reply; 5+ messages in thread
From: André Roth @ 2016-06-18 11:32 UTC (permalink / raw)
To: linux-unionfs
[-- Attachment #1: Type: text/plain, Size: 379 bytes --]
Hello,
> # 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.
# strace -o /tmp/strace mv OVERLAYFS foo
mv: cannot move ‘OVERLAYFS’ to a subdirectory of itself, ‘foo’
files attached...
Regards,
André
[-- Attachment #2: debug --]
[-- Type: application/octet-stream, Size: 280 bytes --]
[ 141.989522] overlay: create(work/#ffff880000c1d000, 0100000) = 0
[ 141.989918] overlay: rename2(work/#ffff880000c1d000, root/OVERLAYFS, 0x0)
[ 141.989927] overlay: rename2(root/OVERLAYFS, root/foo, 0x4)
[ 141.989929] overlay: ...rename2(root/OVERLAYFS, root/foo, ...) = -22
[-- Attachment #3: strace --]
[-- Type: application/octet-stream, Size: 9275 bytes --]
execve("/bin/mv", ["mv", "OVERLAYFS", "foo"], [/* 27 vars */]) = 0
brk(0) = 0x2336000
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fd4263d7000
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=19191, ...}) = 0
mmap(NULL, 19191, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fd4263d2000
close(3) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/libselinux.so.1", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\20c\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0644, st_size=142728, ...}) = 0
mmap(NULL, 2246896, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fd425f94000
mprotect(0x7fd425fb5000, 2097152, PROT_NONE) = 0
mmap(0x7fd4261b5000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x21000) = 0x7fd4261b5000
mmap(0x7fd4261b7000, 6384, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fd4261b7000
close(3) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/libacl.so.1", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\200\37\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0644, st_size=35288, ...}) = 0
mmap(NULL, 2130592, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fd425d8b000
mprotect(0x7fd425d93000, 2093056, PROT_NONE) = 0
mmap(0x7fd425f92000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x7000) = 0x7fd425f92000
close(3) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/libattr.so.1", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\320\23\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0644, st_size=18640, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fd4263d1000
mmap(NULL, 2113912, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fd425b86000
mprotect(0x7fd425b8a000, 2093056, PROT_NONE) = 0
mmap(0x7fd425d89000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x3000) = 0x7fd425d89000
close(3) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0P\34\2\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=1729984, ...}) = 0
mmap(NULL, 3836448, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fd4257dd000
mprotect(0x7fd42597c000, 2097152, PROT_NONE) = 0
mmap(0x7fd425b7c000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x19f000) = 0x7fd425b7c000
mmap(0x7fd425b82000, 14880, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fd425b82000
close(3) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/libpcre.so.3", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\20\27\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0644, st_size=448440, ...}) = 0
mmap(NULL, 2543976, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fd42556f000
mprotect(0x7fd4255db000, 2097152, PROT_NONE) = 0
mmap(0x7fd4257db000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x6c000) = 0x7fd4257db000
close(3) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/libdl.so.2", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\320\16\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0644, st_size=14664, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fd4263d0000
mmap(NULL, 2109712, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fd42536b000
mprotect(0x7fd42536e000, 2093056, PROT_NONE) = 0
mmap(0x7fd42556d000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2000) = 0x7fd42556d000
close(3) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/libpthread.so.0", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\20o\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=137440, ...}) = 0
mmap(NULL, 2213008, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fd42514e000
mprotect(0x7fd425166000, 2093056, PROT_NONE) = 0
mmap(0x7fd425365000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x17000) = 0x7fd425365000
mmap(0x7fd425367000, 13456, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fd425367000
close(3) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fd4263cf000
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fd4263cd000
arch_prctl(ARCH_SET_FS, 0x7fd4263cd800) = 0
mprotect(0x7fd425b7c000, 16384, PROT_READ) = 0
mprotect(0x7fd425365000, 4096, PROT_READ) = 0
mprotect(0x7fd42556d000, 4096, PROT_READ) = 0
mprotect(0x7fd4257db000, 4096, PROT_READ) = 0
mprotect(0x7fd425d89000, 4096, PROT_READ) = 0
mprotect(0x7fd425f92000, 4096, PROT_READ) = 0
mprotect(0x7fd4261b5000, 4096, PROT_READ) = 0
mprotect(0x61e000, 4096, PROT_READ) = 0
mprotect(0x7fd4263d9000, 4096, PROT_READ) = 0
munmap(0x7fd4263d2000, 19191) = 0
set_tid_address(0x7fd4263cdad0) = 793
set_robust_list(0x7fd4263cdae0, 24) = 0
rt_sigaction(SIGRTMIN, {0x7fd4251549f0, [], SA_RESTORER|SA_SIGINFO, 0x7fd42515d8d0}, NULL, 8) = 0
rt_sigaction(SIGRT_1, {0x7fd425154a80, [], SA_RESTORER|SA_RESTART|SA_SIGINFO, 0x7fd42515d8d0}, NULL, 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [RTMIN RT_1], NULL, 8) = 0
getrlimit(RLIMIT_STACK, {rlim_cur=8192*1024, rlim_max=RLIM64_INFINITY}) = 0
statfs("/sys/fs/selinux", 0x7fff169f5bf0) = -1 ENOENT (No such file or directory)
statfs("/selinux", 0x7fff169f5bf0) = -1 ENOENT (No such file or directory)
brk(0) = 0x2336000
brk(0x2357000) = 0x2357000
open("/proc/filesystems", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fd4263d6000
read(3, "nodev\tsysfs\nnodev\trootfs\nnodev\tt"..., 1024) = 299
read(3, "", 1024) = 0
close(3) = 0
munmap(0x7fd4263d6000, 4096) = 0
open("/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=1867856, ...}) = 0
mmap(NULL, 1867856, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fd426204000
close(3) = 0
geteuid() = 0
ioctl(0, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, {B38400 opost isig icanon echo ...}) = 0
stat("foo", 0x7fff169f5bc0) = -1 ENOENT (No such file or directory)
lstat("OVERLAYFS", {st_mode=S_IFREG|0644, st_size=785, ...}) = 0
lstat("foo", 0x7fff169f5890) = -1 ENOENT (No such file or directory)
rename("OVERLAYFS", "foo") = -1 EINVAL (Invalid argument)
open("/usr/share/locale/locale.alias", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=2492, ...}) = 0
mmap(NULL, 1048576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fd42504e000
read(3, "# Locale name alias data base.\n#"..., 1048576) = 2492
read(3, "", 1048576) = 0
close(3) = 0
munmap(0x7fd42504e000, 1048576) = 0
open("/usr/share/locale/en_US.UTF-8/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en_US.utf8/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en_US/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en.UTF-8/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en.utf8/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/lib/charset.alias", O_RDONLY|O_NOFOLLOW) = -1 ENOENT (No such file or directory)
write(2, "mv: ", 4) = 4
write(2, "cannot move \342\200\230OVERLAYFS\342\200\231 to a"..., 66) = 66
write(2, "\n", 1) = 1
lseek(0, 0, SEEK_CUR) = -1 ESPIPE (Illegal seek)
close(0) = 0
close(1) = 0
close(2) = 0
exit_group(1) = ?
+++ exited with 1 +++
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: NFS/ro: mv: cannot move 'foo' to a subdirectory of itself, 'bar'
2016-06-18 11:32 ` André Roth
@ 2016-06-29 14:21 ` Miklos Szeredi
2016-06-29 21:20 ` André Roth
0 siblings, 1 reply; 5+ messages in thread
From: Miklos Szeredi @ 2016-06-29 14:21 UTC (permalink / raw)
To: André Roth; +Cc: linux-unionfs
On Sat, Jun 18, 2016 at 1:32 PM, André Roth <neolynx@gmail.com> wrote:
>
> Hello,
>
>> # 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.
>
> # 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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: NFS/ro: mv: cannot move 'foo' to a subdirectory of itself, 'bar'
2016-06-29 14:21 ` Miklos Szeredi
@ 2016-06-29 21:20 ` André Roth
0 siblings, 0 replies; 5+ messages in thread
From: André Roth @ 2016-06-29 21:20 UTC (permalink / raw)
To: linux-unionfs
> Do you have
>
> CONFIG_EXT4_USE_FOR_EXT2=y
>
> in your kernel's .config? If not, then you should.
nope
> 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
works like a charm now :)
> otherwise "default_permissions" will misbehave.
thanks for the information !
regards,
andré
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-06-29 21:20 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-13 11:07 NFS/ro: mv: cannot move 'foo' to a subdirectory of itself, 'bar' André Roth
2016-06-16 12:30 ` Miklos Szeredi
2016-06-18 11:32 ` André Roth
2016-06-29 14:21 ` Miklos Szeredi
2016-06-29 21:20 ` André Roth
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.