Re: [PATCH 0/6 v7] overlay filesystem - request for inclusion

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

 



On Tue, 22 Mar 2011, Al Viro wrote:
> On Tue, Mar 22, 2011 at 09:06:38PM +0100, Miklos Szeredi wrote:
> > On Tue, 22 Mar 2011, Al Viro wrote:
> > > Proceeding with rename is not interesting; proceeding with copyup is.
> > > 
> > > Who said that by the time we get to copy_up_locked you will still have
> > > dentry (and upper) match lowerpath?  Or that ->d_parent on overlay and
> > > on upper will change in sync, for that matter - there are two d_move()
> > > calls involved...
> > 
> > If rename is involved, than rename itself already did the copy up.
> > And that's checked before proceeding with the actual copy up.  If
> > there was no rename, then that guarantees that things are in sync, at
> > least for the duration of the copy up.
> 
> What do you mean, before?  It's not atomic...  What happens if e.g.
> you get
> 
> A: decided to do copy_up_locked
>    blocked on i_mutex
> 
> B: did copy_up
>    did rename(), complete with d_move()
>    did unlink() in new place
> 
> A: got CPU back, got i_mutex

Here it can check if the file was copied up or not.  OK, I see the
code doesn't quite get that right.

Patch below would fix it, I think.

Thanks,
Miklos

diff --git a/fs/overlayfs/overlayfs.c b/fs/overlayfs/overlayfs.c
index e7fcbde..0a1137b 100644
--- a/fs/overlayfs/overlayfs.c
+++ b/fs/overlayfs/overlayfs.c
@@ -1269,8 +1269,7 @@ static int ovl_copy_up_one(struct dentry *parent, struct dentry *dentry,
 	 * racing with rename (rename means the copy up was already
 	 * successful).
 	 */
-	if (dentry->d_parent != parent) {
-		WARN_ON((ovl_path_type(dentry) == OVL_PATH_LOWER));
+	if (ovl_path_type(dentry) != OVL_PATH_LOWER) {
 		err = 0;
 	} else {
 		err = ovl_copy_up_locked(upperdir, dentry, lowerpath,


--
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