Commit 7e79eedb3b22200cc8b774baea3a7bf28d766101

Authored by Tetsuo Handa
Committed by Al Viro
1 parent 2f1936b877

[patch 4/5] vfs: reuse local variable in vfs_link()

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>

Showing 1 changed file with 4 additions and 4 deletions Side-by-side Diff

... ... @@ -2524,19 +2524,19 @@
2524 2524 return -EPERM;
2525 2525 if (!dir->i_op || !dir->i_op->link)
2526 2526 return -EPERM;
2527   - if (S_ISDIR(old_dentry->d_inode->i_mode))
  2527 + if (S_ISDIR(inode->i_mode))
2528 2528 return -EPERM;
2529 2529  
2530 2530 error = security_inode_link(old_dentry, dir, new_dentry);
2531 2531 if (error)
2532 2532 return error;
2533 2533  
2534   - mutex_lock(&old_dentry->d_inode->i_mutex);
  2534 + mutex_lock(&inode->i_mutex);
2535 2535 DQUOT_INIT(dir);
2536 2536 error = dir->i_op->link(old_dentry, dir, new_dentry);
2537   - mutex_unlock(&old_dentry->d_inode->i_mutex);
  2537 + mutex_unlock(&inode->i_mutex);
2538 2538 if (!error)
2539   - fsnotify_link(dir, old_dentry->d_inode, new_dentry);
  2539 + fsnotify_link(dir, inode, new_dentry);
2540 2540 return error;
2541 2541 }
2542 2542