Re: [PATCH 05/19] buffer: discard BH_Write_EIO along with the rest of the buffer state

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 <pusqbam7lfjtfj7hmo7k5v2jclb3gk7wfi6miqrz2rzpesahsg@4ov6foxet3ez>
On Sat 01-08-26 18:00:49, Chao Shi wrote:
> discard_buffer() strips the state that describes where a buffer lives and
> what has happened to it, because after an invalidate none of it applies any
> more.  BH_Write_EIO belongs in that set for the same reason: it describes a
> write of the data that is being thrown away.
> 
> Leaving it set means a buffer_head reused for a different block starts life
> carrying somebody else's write error.  Like the bforget() change, this is
> mostly theoretical today and becomes load bearing once the rest of the
> series makes BH_Write_EIO the report of a failed metadata write.
> 
> Suggested-by: Jan Kara <[email protected]>
> Signed-off-by: Chao Shi <[email protected]>

Looks good. Feel free to add:

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

								Honza

> ---
>  fs/buffer.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/buffer.c b/fs/buffer.c
> index 7889c30d8715..50a63d964815 100644
> --- a/fs/buffer.c
> +++ b/fs/buffer.c
> @@ -1518,7 +1518,7 @@ EXPORT_SYMBOL(folio_set_bh);
>  /* Bits that are cleared during an invalidate */
>  #define BUFFER_FLAGS_DISCARD \
>  	(1 << BH_Mapped | 1 << BH_New | 1 << BH_Req | \
> -	 1 << BH_Delay | 1 << BH_Unwritten)
> +	 1 << BH_Delay | 1 << BH_Unwritten | 1 << BH_Write_EIO)
>  
>  static void discard_buffer(struct buffer_head * bh)
>  {
> -- 
> 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.