Re: [PATCH] ext2: propagate errors from ext2_prepare_chunk

Jan Kara
2023-01-16T11:16:29Z

On Mon 16-01-23 09:52:05, Christoph Hellwig wrote:
> Propagate errors from ext2_prepare_chunk to the callers and handle them
> there. While touching the prototype also turn update_times into a bool
> from the current int used as bool.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>

> diff --git a/fs/ext2/namei.c b/fs/ext2/namei.c
> index c056957221a225..18b3d5af77240b 100644
> --- a/fs/ext2/namei.c
> +++ b/fs/ext2/namei.c
> @@ -370,7 +370,10 @@ static int ext2_rename (struct user_namespace * mnt_userns,
> err = PTR_ERR(new_de);
> goto out_dir;
> }
> - ext2_set_link(new_dir, new_de, new_page, page_addr, old_inode, 1);
> + err = ext2_set_link(new_dir, new_de, new_page, page_addr,
> + old_inode, true);
> + if (err)
> + goto out_dir;
> ext2_put_page(new_page, page_addr);

AFAICT we need to call ext2_put_page(new_page, page_addr) also in case of
error here. I'll fix it up on commit. Thanks for the patch.

Honza
--
Jan Kara <jack@suse.com>
SUSE Labs, CR