Re: Overlayfs rename bug

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

 



On Tue, Jun 24, 2014 at 05:46:14PM +0100, David Howells wrote:

> strace shows:
> 
> 	rename("/mnt/a/foo104", "/mnt/a/foo105") = 0
> 	lstat("/mnt/a/foo104", {st_mode=S_IFREG|0644, st_size=12, ...}) = 0
> 
> which shouldn't happen.

Sorry for the delay.  Following patch fixes it and tests now run fine.

Problem was that copy-up didn't set opaque flag on non-dir.  The reason this has
gone unnoticed is that the dentry on overlayfs was unhashed (to get rid of the
unneeded lower dentry reference) so after a new lookup the opaque flag would be
set correctly.  Rename, however, rehashed the copied up dentry and so old_opaque
and the opaque flag on old would become out-of-sync.

As a followup patch we could also unhash the copied dentry after the rename, but
that's just an optimization.

Thanks for the report and the great test suite!

Miklos


diff --git a/fs/overlayfs/copy_up.c b/fs/overlayfs/copy_up.c
index 1670dbe..274c857 100644
--- a/fs/overlayfs/copy_up.c
+++ b/fs/overlayfs/copy_up.c
@@ -255,9 +255,13 @@ static int ovl_copy_up_locked(struct dentry *workdir, struct dentry *upperdir,
 	 * Easiest way to get rid of the lower dentry reference is to
 	 * drop this dentry.  This is neither needed nor possible for
 	 * directories.
+	 *
+	 * Non-directores become opaque when copied up.
 	 */
-	if (!S_ISDIR(stat->mode))
+	if (!S_ISDIR(stat->mode)) {
+		ovl_dentry_set_opaque(dentry, true);
 		d_drop(dentry);
+	}
 out:
 	dput(upper);
 	dput(newdentry);
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[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