Re: [PATCH 08/19] ext2: check for an xattr block write error with buffer_write_io_error()

Jan Kara <[email protected]>
Newsgroups dev.linux.lists.ocfs2-devel,dev.linux.lists.gfs2,org.kernel.vger.linux-ext4,org.kernel.vger.linux-fsdevel,org.kernel.vger.linux-kernel
Message-ID <6ftoth3c5myyf4ig2g6p6ypqom5jo77fkkbfcsmaeptlvh7nsd@6wzx5qqtjuhr>
On Sat 01-08-26 18:00:52, Chao Shi wrote:
> ext2_xattr_set2() spots a failed synchronous write by testing BH_Req
> together with !BH_Uptodate.  That relies on the write completion handler
> clearing BH_Uptodate on error, which this series removes: a buffer whose
> write failed still holds the data the filesystem asked to be written, so
> declaring it not up to date is wrong and makes callers re-read it.
> 
> BH_Write_EIO says exactly what this code wants to know, and it implies
> BH_Req, so the pair collapses into one test.
> 
> No behaviour change today - a failed write sets BH_Write_EIO and clears
> BH_Uptodate together.  It stops being a no-op at the end of the series,
> where the new test is the one that still works.
> 
> Signed-off-by: Chao Shi <[email protected]>

Looks good. Feel free to add:

Reviewed-by: Jan Kara <[email protected]>

								Honza

> ---
>  fs/ext2/xattr.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/ext2/xattr.c b/fs/ext2/xattr.c
> index be63f89402a3..39005ec23fe5 100644
> --- a/fs/ext2/xattr.c
> +++ b/fs/ext2/xattr.c
> @@ -769,7 +769,7 @@ ext2_xattr_set2(struct inode *inode, struct buffer_head *old_bh,
>  		if (IS_SYNC(inode)) {
>  			sync_dirty_buffer(new_bh);
>  			error = -EIO;
> -			if (buffer_req(new_bh) && !buffer_uptodate(new_bh))
> +			if (buffer_write_io_error(new_bh))
>  				goto cleanup;
>  		}
>  	}
> -- 
> 2.43.0
> 
-- 
Jan Kara <[email protected]>
SUSE Labs, CR
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.