Skip to content

Commit

Permalink
fix switch_names() breakage in short-to-short case
Browse files Browse the repository at this point in the history
We want ->name.len to match the resulting name on *both*
source and target

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
  • Loading branch information
Al Viro committed Dec 31, 2008
1 parent 7df5fa0 commit dc711ca
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions fs/dcache.c
Original file line number Diff line number Diff line change
Expand Up @@ -1616,8 +1616,11 @@ static void switch_names(struct dentry *dentry, struct dentry *target)
*/
memcpy(dentry->d_iname, target->d_name.name,
target->d_name.len + 1);
dentry->d_name.len = target->d_name.len;
return;
}
}
do_switch(dentry->d_name.len, target->d_name.len);
}

/*
Expand Down Expand Up @@ -1677,7 +1680,6 @@ static void d_move_locked(struct dentry * dentry, struct dentry * target)

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

/* ... and switch the parents */
Expand Down Expand Up @@ -1787,7 +1789,6 @@ static void __d_materialise_dentry(struct dentry *dentry, struct dentry *anon)
struct dentry *dparent, *aparent;

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

dparent = dentry->d_parent;
Expand Down

0 comments on commit dc711ca

Please sign in to comment.