Skip to content

Commit

Permalink
[patch 4/5] vfs: reuse local variable in vfs_link()
Browse files Browse the repository at this point in the history
Why not reuse "inode" which is assigned as

  struct inode *inode = old_dentry->d_inode;

in the beginning of vfs_link() ?

Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
  • Loading branch information
Tetsuo Handa authored and Al Viro committed Jul 27, 2008
1 parent 2f1936b commit 7e79eed
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions fs/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -2524,19 +2524,19 @@ int vfs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *new_de
return -EPERM;
if (!dir->i_op || !dir->i_op->link)
return -EPERM;
if (S_ISDIR(old_dentry->d_inode->i_mode))
if (S_ISDIR(inode->i_mode))
return -EPERM;

error = security_inode_link(old_dentry, dir, new_dentry);
if (error)
return error;

mutex_lock(&old_dentry->d_inode->i_mutex);
mutex_lock(&inode->i_mutex);
DQUOT_INIT(dir);
error = dir->i_op->link(old_dentry, dir, new_dentry);
mutex_unlock(&old_dentry->d_inode->i_mutex);
mutex_unlock(&inode->i_mutex);
if (!error)
fsnotify_link(dir, old_dentry->d_inode, new_dentry);
fsnotify_link(dir, inode, new_dentry);
return error;
}

Expand Down

0 comments on commit 7e79eed

Please sign in to comment.