[Top] [All Lists]

Re: [git pull] dentry_unhash() breakage

To: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Subject: Re: [git pull] dentry_unhash() breakage
From: Sage Weil <sage@xxxxxxxxxxxx>
Date: Tue, 31 May 2011 09:26:52 -0700 (PDT)
Cc: Al Viro <viro@xxxxxxxxxxxxxxxxxx>, Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>, linux-fsdevel@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, xfs@xxxxxxxxxxx
Dkim-signature: v=1; a=rsa-sha1; c=relaxed; d=newdream.net; h=date:from :to:cc:subject:in-reply-to:message-id:references:mime-version: content-type; s=newdream.net; bh=hEKachd80QInEzcsE2UmpN7aFa4=; b=Fu/4JQdjP46en04cpItFMPDprWX8whmeGJ8qli52LIZbA6XXtXfb+bBRAHnf6 eKBANsiWpShiwm/eTcf86itL78/j8FgpK62TJGVR67Hixl7H5MZAihm/Lg7K+NoO 3Evq1oE03j5CZnTiTVULxGOLXGzrJZNvya9OeenJPuzFkU=
Domainkey-signature: a=rsa-sha1; c=nofws; d=newdream.net; h=date:from:to:cc :subject:in-reply-to:message-id:references:mime-version: content-type; q=dns; s=newdream.net; b=dgtm6ouHACDD94tE0pzs441Il McsC3mhfu3rpCuhGoru7yW6H5dYHv6r0Ttof2TWq2Vw7XW8qs0MrAqN/uNaQgMou N5h7RPCavmnXeYAqWWYWY4lKwEhrKrDKkTZOSwk/D/OwSHG43W+kfR5DpYxvdGYm Hr32iMHxHkqldKjbgM=
In-reply-to: <20110530085922.GA11336@xxxxxxxxxxxxx>
References: <20110530020604.GC561@dastard> <20110530034741.GD561@dastard> <Pine.LNX.4.64.1105292057570.9134@xxxxxxxxxxxxxxxxxx> <20110530055601.GK11521@xxxxxxxxxxxxxxxxxx> <20110530085922.GA11336@xxxxxxxxxxxxx>
On Mon, 30 May 2011, Christoph Hellwig wrote:
> On Mon, May 30, 2011 at 06:56:01AM +0100, Al Viro wrote:
> > A couple of dentry_unhash fallout fixes
> Shouldn't we do the shrink_dcache_parent only after a successfull
> rmdir or rename?

Yeah, that makes more sense to me...


>From 4e9be5f3fc5f9995b0b1966cda95bb5386e20444 Mon Sep 17 00:00:00 2001
From: Sage Weil <sage@xxxxxxxxxxxx>
Date: Tue, 31 May 2011 09:26:13 -0700
Subject: [PATCH] vfs: shrink_dcache_parent on rmdir, dir rename only on success

Only prune the dentries of the rmdir or dir rename succeeds.  Doing so on
failure makes no sense (though it's mostly harmless).

Signed-off-by: Sage Weil <sage@xxxxxxxxxxxx>
 fs/namei.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/fs/namei.c b/fs/namei.c
index e2e4e8d..72b0370 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -2579,11 +2579,11 @@ int vfs_rmdir(struct inode *dir, struct dentry *dentry)
        if (error)
                goto out;
-       shrink_dcache_parent(dentry);
        error = dir->i_op->rmdir(dir, dentry);
        if (error)
                goto out;
+       shrink_dcache_parent(dentry);
        dentry->d_inode->i_flags |= S_DEAD;
@@ -2994,13 +2994,12 @@ static int vfs_rename_dir(struct inode *old_dir, struct 
dentry *old_dentry,
        if (d_mountpoint(old_dentry) || d_mountpoint(new_dentry))
                goto out;
-       if (target)
-               shrink_dcache_parent(new_dentry);
        error = old_dir->i_op->rename(old_dir, old_dentry, new_dir, new_dentry);
        if (error)
                goto out;
        if (target) {
+               shrink_dcache_parent(new_dentry);
                target->i_flags |= S_DEAD;

<Prev in Thread] Current Thread [Next in Thread>