linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* overlayfs entrles lost
@ 2011-05-31  9:31 Jordi Pujol
       [not found] ` <201105311140.55866.jordipujolp@gmail.com>
  0 siblings, 1 reply; 4+ messages in thread
From: Jordi Pujol @ 2011-05-31  9:31 UTC (permalink / raw)
  To: Miklos Szeredi, linux-fsdevel

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

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

* Re: overlayfs entrles lost
       [not found] ` <201105311140.55866.jordipujolp@gmail.com>
@ 2011-05-31  9:51   ` Jordi Pujol
  2011-05-31 12:54     ` Miklos Szeredi
  0 siblings, 1 reply; 4+ messages in thread
From: Jordi Pujol @ 2011-05-31  9:51 UTC (permalink / raw)
  To: Miklos Szeredi; +Cc: linux-fsdevel

A Dimarts, 31 de maig de 2011 11:40:55, Jordi Pujol va escriure:
> > # 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

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

* Re: overlayfs entrles lost
  2011-05-31  9:51   ` Jordi Pujol
@ 2011-05-31 12:54     ` Miklos Szeredi
  2011-05-31 15:14       ` Jordi Pujol
  0 siblings, 1 reply; 4+ messages in thread
From: Miklos Szeredi @ 2011-05-31 12:54 UTC (permalink / raw)
  To: Jordi Pujol; +Cc: linux-fsdevel

[-- Attachment #1: Type: text/plain, Size: 900 bytes --]

Jordi Pujol <jordipujolp@gmail.com> writes:

> A Dimarts, 31 de maig de 2011 11:40:55, Jordi Pujol va escriure:
>> > # 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

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



[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: ovl-fix-off-by-one-error-in-readdir.patch --]
[-- Type: text/x-patch, Size: 1091 bytes --]

commit 1a2e406466599f82d61bb4acb7a303f1608478f7
Author: Miklos Szeredi <mszeredi@suse.cz>
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.
    
    Reported-by: Jordi Pujol <jordipujolp@gmail.com>
    Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>

diff --git a/fs/overlayfs/readdir.c b/fs/overlayfs/readdir.c
index 9b8004cf..4f0a51c 100644
--- a/fs/overlayfs/readdir.c
+++ b/fs/overlayfs/readdir.c
@@ -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;

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

* Re: overlayfs entrles lost
  2011-05-31 12:54     ` Miklos Szeredi
@ 2011-05-31 15:14       ` Jordi Pujol
  0 siblings, 0 replies; 4+ messages in thread
From: Jordi Pujol @ 2011-05-31 15:14 UTC (permalink / raw)
  To: Miklos Szeredi; +Cc: linux-fsdevel

A Dimarts, 31 de maig de 2011 14:54:06, Miklos Szeredi va escriure:
> Thanks again for your test results.

you are welcome,

> 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

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

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

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-31  9:31 overlayfs entrles lost Jordi Pujol
     [not found] ` <201105311140.55866.jordipujolp@gmail.com>
2011-05-31  9:51   ` Jordi Pujol
2011-05-31 12:54     ` Miklos Szeredi
2011-05-31 15:14       ` Jordi Pujol

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).