Re: overlayfs entrles lost

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jordi Pujol <jordipujolp@xxxxxxxxx> 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


commit 1a2e406466599f82d61bb4acb7a303f1608478f7
Author: Miklos Szeredi <mszeredi@xxxxxxx>
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@xxxxxxxxx>
    Signed-off-by: Miklos Szeredi <mszeredi@xxxxxxx>

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;

[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux