From mboxrd@z Thu Jan 1 00:00:00 1970 From: Miklos Szeredi Subject: Re: overlayfs patches for ovl_copy_up & ovl_rename Date: Tue, 17 May 2011 10:43:39 +0200 Message-ID: <874o4temys.fsf@tucsk.pomaz.szeredi.hu> References: <201105041659.38427.jordipujolp@gmail.com> <871v0da54v.fsf@tucsk.pomaz.szeredi.hu> <201105090838.04534.jordipujolp@gmail.com> <87zkmujzni.fsf@tucsk.pomaz.szeredi.hu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: linux-fsdevel@vger.kernel.org To: Jordi Pujol Return-path: Received: from mail-bw0-f46.google.com ([209.85.214.46]:45253 "EHLO mail-bw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752084Ab1EQInc (ORCPT ); Tue, 17 May 2011 04:43:32 -0400 Received: by bwz15 with SMTP id 15so306257bwz.19 for ; Tue, 17 May 2011 01:43:30 -0700 (PDT) In-Reply-To: <87zkmujzni.fsf@tucsk.pomaz.szeredi.hu> (Miklos Szeredi's message of "Tue, 10 May 2011 18:20:17 +0200") Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Miklos Szeredi writes: > Jordi Pujol writes: >> >> In my tests, locking the parent directories makes the right thing, >> but maybe there are other cases that should be considered... > > Can you please try the following patch then? Does any of the WARN_ONs > trigger when you observe the bad behavior? Jordi, what's up with this? Could you please test the .v8 codebase with this single patch applied? Thanks, Miklos > --- > fs/overlayfs/dir.c | 10 ++++++++++ > 1 file changed, 10 insertions(+) > > Index: linux-2.6/fs/overlayfs/dir.c > =================================================================== > --- linux-2.6.orig/fs/overlayfs/dir.c 2011-05-10 18:13:03.000000000 +0200 > +++ linux-2.6/fs/overlayfs/dir.c 2011-05-10 18:16:13.000000000 +0200 > @@ -512,6 +512,9 @@ static int ovl_rename(struct inode *oldd > old_upperdir = ovl_dentry_upper(old->d_parent); > new_upperdir = ovl_dentry_upper(new->d_parent); > > + (void) dget(old_upperdir); > + (void) dget(new_upperdir); > + > trap = lock_rename(new_upperdir, old_upperdir); > > olddentry = ovl_dentry_upper(old); > @@ -571,6 +574,13 @@ static int ovl_rename(struct inode *oldd > dput(newdentry); > out_unlock: > unlock_rename(new_upperdir, old_upperdir); > + > + WARN_ON(old_upperdir->d_count == 1); > + WARN_ON(new_upperdir->d_count == 1); > + > + dput(old_upperdir); > + dput(new_upperdir); > + > return err; > } >