overlayfs entrles lost
Subsystems (2)
Hello,
a very interesting thing that happens with overlayfs,
the find command does not list a file,
but the ls command does it,
in the parent directory data we observe that he have added new files to it and the count of files for this directory is not updated,
the find command uses the functions opendir and readdir and they not work correctly in overlayfs,
# find /tmp/live-net-remaster-probDm/chroot/usr/bin/ -name slxdecode -ls (nothing listed)
# ls -l /tmp/live-net-remaster-probDm/chroot/usr/bin/slxdecode -rwxr-xr-x 1 root root 58856 2011-03-30 23:24 /tmp/live-net-remaster- probDm/chroot/usr/bin/slxdecode
Thanks,
Jordi Pujol
Live never ending Tale
GNU/Linux Live forever!
http://livenet.selfip.com
A Dimarts, 31 de maig de 2011 11:40:55, Jordi Pujol va escriure:
Quoted 4 lines
Quoted 3 lines
# ls -l /tmp/live-net-remaster-probDm/chroot/usr/bin/slxdecode -rwxr-xr-x 1 root root 58856 2011-03-30 23:24 /tmp/live-net-remaster- probDm/chroot/usr/bin/slxdecode
adding more info,
the inode number of that file:
# ls -dils /tmp/live-net-remaster-probDm/chroot/usr/bin/slxdecode 73833 58 -rwxr-xr-x 1 root root 58856 2011-03-30 23:24 /tmp/live-net-remaster- probDm/chroot/usr/bin/slxdecode
Thanks,
Jordi Pujol
Live never ending Tale
GNU/Linux Live forever!
http://livenet.selfip.com
Miklos Szeredi
maintainerQuoted 6 lines · Jordi Pujol
A Dimarts, 31 de maig de 2011 11:40:55, Jordi Pujol va escriure:
Quoted 4 lines
Quoted 3 lines
# ls -l /tmp/live-net-remaster-probDm/chroot/usr/bin/slxdecode -rwxr-xr-x 1 root root 58856 2011-03-30 23:24 /tmp/live-net-remaster- probDm/chroot/usr/bin/slxdecode
Quoted 6 lines
adding more info,
the inode number of that file:# ls -dils /tmp/live-net-remaster-probDm/chroot/usr/bin/slxdecode 73833 58 -rwxr-xr-x 1 root root 58856 2011-03-30 23:24 /tmp/live-net-remaster- probDm/chroot/usr/bin/slxdecode
Jordi,
Thanks again for your test results.
I was able to reproduce the problem here. It turns out to be an off-by-one error in file offset calculation, leading to missing a dentry at the start of the second (third, ...) getdents() call.
The following patch should fix it. Also pushed to the overlayfs.v9 branch, it will mirror out shortly.
Thanks,
Miklos
commit 1a2e406466599f82d61bb4acb7a303f1608478f7
Author: Miklos Szeredi <[email protected]> Date: Tue May 31 14:32:33 2011 +0200
ovl: fix off-by-one error in readdir
Jordi Pujol reported missing entries with find. This was caused by advancing the file position even when filler() returns with an error.
fs/overlayfs/readdir.c +5 -7
@@ -334,15 +334,13 @@ static int ovl_readdir(struct file *file, void *buf, filldir_t filler) p = list_entry(od->cursor.next, struct ovl_cache_entry, l_node); off = file->f_pos; +if (!p->is_whiteout) { + over =filler (buf, p->name, p->len, off, p->ino, p->type); +if (over) +break ; + } file->f_pos++;list_move (&od->cursor, &p->l_node); - -if (p->is_whiteout) -continue ; - - over =filler (buf, p->name, p->len, off, p->ino, p->type); -if (over) -break ; }return 0 ;
A Dimarts, 31 de maig de 2011 14:54:06, Miklos Szeredi va escriure:
Quoted 1 line
Thanks again for your test results.
you are welcome,
Quoted 2 lines
The following patch should fix it. Also pushed to the overlayfs.v9 branch, it will mirror out shortly.
I tested it starting a new remaster, it works !
Thanks,
Jordi Pujol
Live never ending Tale
GNU/Linux Live forever!
http://livenet.selfip.com