Re: [PATCH] xfs: shutdown on failure to add page to log bio

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Mar 24, 2020 at 12:57:00PM -0400, Brian Foster wrote:
> Rather than warn about writing out a corrupted log buffer, shutdown
> the fs as is done for any log I/O related error. This preserves the
> consistency of the physical log such that log recovery succeeds on a
> subsequent mount. Note that this was observed on a 64k page debug
> kernel without upstream commit 59bb47985c1d ("mm, sl[aou]b:
> guarantee natural alignment for kmalloc(power-of-two)"), which
> demonstrated frequent iclog bio overflows due to unaligned (slab
> allocated) iclog data buffers.

Weird..

>  static void
>  xlog_map_iclog_data(
> -	struct bio		*bio,
> -	void			*data,
> +	struct xlog_in_core	*iclog,
>  	size_t			count)
>  {
> +	struct xfs_mount	*mp = iclog->ic_log->l_mp;
> +	struct bio		*bio = &iclog->ic_bio;
> +	void			*data = iclog->ic_data;
> +
>  	do {
>  		struct page	*page = kmem_to_page(data);
>  		unsigned int	off = offset_in_page(data);
>  		size_t		len = min_t(size_t, count, PAGE_SIZE - off);
>  
> -		WARN_ON_ONCE(bio_add_page(bio, page, len, off) != len);
> +		if (bio_add_page(bio, page, len, off) != len) {
> +			xfs_force_shutdown(mp, SHUTDOWN_LOG_IO_ERROR);
> +			break;
> +		}
>  
>  		data += len;
>  		count -= len;
> @@ -1762,7 +1768,7 @@ xlog_write_iclog(
>  	if (need_flush)
>  		iclog->ic_bio.bi_opf |= REQ_PREFLUSH;
>  
> -	xlog_map_iclog_data(&iclog->ic_bio, iclog->ic_data, count);
> +	xlog_map_iclog_data(iclog, count);

Can you just return an error from xlog_map_iclog_data and shut down
in the caller?  Besides keeping the abstraction levels similar I had
also hoped to lift xlog_map_iclog_data into the block layer eventually.



[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux