Re: [PATCH v2] vfs: Don't exchange "short" filenames unconditionally.

From: Linus Torvalds
Date: Wed Sep 24 2014 - 15:27:47 EST


On Wed, Sep 24, 2014 at 12:20 PM, Linus Torvalds
<torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:
>
> There's no way that patch is correct.

Something like the appended might be a good idea regardless. And might
have made people notice that the len and the hash go together with the
name.

Linus

----

diff --git a/fs/dcache.c b/fs/dcache.c
index 7a5b51440afa..aa1b045b997c 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -2412,7 +2412,7 @@ static void switch_names(struct dentry
*dentry, struct dentry *target)
}
}
}
- swap(dentry->d_name.len, target->d_name.len);
+ swap(dentry->d_name.hash_len, target->d_name.hash_len);
}

static void dentry_lock_for_move(struct dentry *dentry, struct
dentry *target)
@@ -2511,7 +2511,6 @@ static void __d_move(struct dentry *dentry,
struct dentry *target,

/* Switch the names.. */
switch_names(dentry, target);
- swap(dentry->d_name.hash, target->d_name.hash);

/* ... and switch the parents */
if (IS_ROOT(dentry)) {
@@ -2650,7 +2649,6 @@ static void __d_materialise_dentry(struct
dentry *dentry, struct dentry *anon)
dparent = dentry->d_parent;

switch_names(dentry, anon);
- swap(dentry->d_name.hash, anon->d_name.hash);

dentry->d_parent = dentry;
list_del_init(&dentry->d_u.d_child);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/