Re: [PATCH 05/12] xfs: make xfs_buf_read_map return an error code

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

 



On Thu, Jan 23, 2020 at 04:23:21PM -0800, Darrick J. Wong wrote:
> On Thu, Jan 23, 2020 at 02:24:41PM -0800, Christoph Hellwig wrote:
> > On Wed, Jan 22, 2020 at 11:42:22PM -0800, Darrick J. Wong wrote:
> > > index fc93fd88ec89..df25024275a1 100644
> > > --- a/fs/xfs/libxfs/xfs_alloc.c
> > > +++ b/fs/xfs/libxfs/xfs_alloc.c
> > > @@ -2956,14 +2956,13 @@ xfs_read_agf(
> > >  	trace_xfs_read_agf(mp, agno);
> > >  
> > >  	ASSERT(agno != NULLAGNUMBER);
> > > -	error = xfs_trans_read_buf(
> > > -			mp, tp, mp->m_ddev_targp,
> > > +	error = xfs_trans_read_buf(mp, tp, mp->m_ddev_targp,
> > >  			XFS_AG_DADDR(mp, agno, XFS_AGF_DADDR(mp)),
> > >  			XFS_FSS_TO_BB(mp, 1), flags, bpp, &xfs_agf_buf_ops);
> > > +	if (error == -EAGAIN)
> > > +		return 0;
> > >  	if (error)
> > >  		return error;
> > > -	if (!*bpp)
> > > -		return 0;
> > 
> > Shouldn't the change in calling conventions for xfs_trans_read_buf be
> > in another patch dealing just with xfs_trans_read_buf?
> 
> Actually ... it really needs to be in the next patch because it's the
> xfs_buf_get_map transition that makes it so that xfs_trans_read_buf can
> return EAGAIN.

Now that I've reshuffled the whole patchset I realize that it more or
less has to be this way because this particular change insulates the
callers of xfs_read_agf() from needing to learn about EAGAIN right now.

I /could/ change all of those callers in this patch instead of handling
it separately in "xfs: make xfs_*read_agf return EAGAIN to
ALLOC_FLAG_TRYLOCK callers", but now the patch would be changing the
behavior of three separate API calls, and I'm trying to avoid
monsters like that.

(Anyway, onward to v5...)

> > > +		/* bad CRC means corrupted metadata */
> > > +		if (error == -EFSBADCRC)
> > > +			error = -EFSCORRUPTED;
> > > +		return error;
> > 
> > Note that this coukd and should now also go away in the xfs_buf_read()
> > callers, not just the direct xfs_buf_read_map ones.
> 
> Huh?  This patch /does/ remove the EFSBADCRC->EFSCORRUPTED code in the
> xfs_buf_read callers... <confused>

The reshuffle makes adding this bit unnecessary since I converted
xfs_buf_read_map earlier in the sequence.

> > > +	error = xfs_buf_read_map(target, map, nmaps, flags, &bp, ops);
> > > +	switch (error) {
> > > +	case 0:
> > > +		break;
> > > +	case -EFSCORRUPTED:
> > > +	case -EIO:
> > >  		if (tp && (tp->t_flags & XFS_TRANS_DIRTY))
> > > +			xfs_force_shutdown(tp->t_mountp,
> > > +					SHUTDOWN_META_IO_ERROR);
> > > +		/* fall through */
> > > +	default:
> > 
> > Isn't it really EAGAIN the only special case here?  I.e. something
> > more like:
> > 
> > 	if (error && error != -EAGAIN) {
> >   		if (tp && (tp->t_flags & XFS_TRANS_DIRTY))
> > 			xfs_force_shutdown(tp->t_mountp,
> > 					SHUTDOWN_META_IO_ERROR);
> > 	}
> > 
> > 	return error;
> 
> Yes, I think so.
> 
> --D



[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