From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from aserp1040.oracle.com ([141.146.126.69]:24952 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751470AbdKICsU (ORCPT ); Wed, 8 Nov 2017 21:48:20 -0500 Date: Wed, 8 Nov 2017 18:48:16 -0800 From: "Darrick J. Wong" Subject: Re: [PATCH 1/5] xfs: check the uniqueness of the AGFL entries Message-ID: <20171109024816.GI26910@magnolia> References: <151001660179.26786.15701876786383794673.stgit@magnolia> <151001660786.26786.14027251894350460924.stgit@magnolia> <20171109020829.GK4094@dastard> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171109020829.GK4094@dastard> Sender: linux-xfs-owner@vger.kernel.org List-ID: List-Id: xfs To: Dave Chinner Cc: linux-xfs@vger.kernel.org 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 > > > > Make sure we don't list a block twice in the agfl. > > > > Signed-off-by: Darrick J. Wong > ..... > > /* 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) > > + 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@fromorbit.com > -- > To unsubscribe from this list: send the line "unsubscribe linux-xfs" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html