Re: [PATCH 1/5] xfs: check the uniqueness of the AGFL entries

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

 



On Thu, Nov 09, 2017 at 01:08:29PM +1100, Dave Chinner wrote:
> On Mon, Nov 06, 2017 at 05:03:27PM -0800, Darrick J. Wong wrote:
> > From: Darrick J. Wong <darrick.wong@xxxxxxxxxx>
> > 
> > Make sure we don't list a block twice in the agfl.
> > 
> > Signed-off-by: Darrick J. Wong <darrick.wong@xxxxxxxxxx>
> .....
> >  /* Scrub the AGFL. */
> >  int
> >  xfs_scrub_agfl(
> >  	struct xfs_scrub_context	*sc)
> >  {
> > +	struct xfs_scrub_agfl_info	sai = { 0 };
> > +	struct xfs_agf			*agf;
> > +	size_t				sz;
> >  	xfs_agnumber_t			agno;
> > +	unsigned int			agflcount;
> > +	unsigned int			i;
> >  	int				error;
> >  
> >  	agno = sc->sa.agno = sc->sm->sm_agno;
> > @@ -508,8 +532,33 @@ xfs_scrub_agfl(
> >  	if (!sc->sa.agf_bp)
> >  		return -EFSCORRUPTED;
> >  
> > +	/* Allocate buffer to ensure uniqueness of AGFL entries. */
> > +	agf = XFS_BUF_TO_AGF(sc->sa.agf_bp);
> > +	agflcount = be32_to_cpu(agf->agf_flcount);
> > +	sz = sizeof(xfs_agblock_t) * agflcount;
> > +	if (sz > sc->mp->m_sb.sb_sectsize) {
> 
> No need for sz?
> 
> 	if (agflcount > XFS_AGFL_SIZE(mp)

<nod>

> > +		xfs_scrub_block_set_corrupt(sc, sc->sa.agf_bp);
> > +		goto out;
> > +	}
> > +	sai.entries = kmem_zalloc(sz, KM_NOFS);
> 
> KM_NOSLEEP, check for failure?

Ok.

--D

> Otherwise looks ok.
> 
> -Dave.
> -- 
> Dave Chinner
> david@xxxxxxxxxxxxx
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[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