lkml.org 
[lkml]   [2013]   [Oct]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 5/7] ext4: rename: move EMLINK check up
On Tue 01-10-13 18:00:37, Miklos Szeredi wrote:
> From: Miklos Szeredi <mszeredi@suse.cz>
>
> Move checking i_nlink from after ext4_get_first_dir_block() to before. The
> check doesn't rely on the result of that function and the function only
> fails on fs corruption, so the order shouldn't matter.
>
> Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
This looks good. You can add:
Reviewed-by: Jan Kara <jack@suse.cz>

Honza

> ---
> fs/ext4/namei.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
> index 01bd80e..1348251 100644
> --- a/fs/ext4/namei.c
> +++ b/fs/ext4/namei.c
> @@ -3082,6 +3082,10 @@ static int ext4_rename(struct inode *old_dir, struct dentry *old_dentry,
> retval = -ENOTEMPTY;
> if (!empty_dir(new.inode))
> goto end_rename;
> + } else {
> + retval = -EMLINK;
> + if (new.dir != old.dir && EXT4_DIR_LINK_MAX(new.dir))
> + goto end_rename;
> }
> retval = -EIO;
> old.dir_bh = ext4_get_first_dir_block(handle, old.inode,
> @@ -3091,10 +3095,6 @@ static int ext4_rename(struct inode *old_dir, struct dentry *old_dentry,
> goto end_rename;
> if (le32_to_cpu(old.parent_de->inode) != old.dir->i_ino)
> goto end_rename;
> - retval = -EMLINK;
> - if (!new.inode && new.dir != old.dir &&
> - EXT4_DIR_LINK_MAX(new.dir))
> - goto end_rename;
> BUFFER_TRACE(old.dir_bh, "get_write_access");
> retval = ext4_journal_get_write_access(handle, old.dir_bh);
> if (retval)
> --
> 1.8.1.4
>
--
Jan Kara <jack@suse.cz>
SUSE Labs, CR


\
 
 \ /
  Last update: 2013-10-02 14:41    [W:0.181 / U:0.968 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site