On Tue, Oct 23, 2018 at 5:49 PM Darrick J. Wong <darrick.wong@xxxxxxxxxx> wrote: > > On Thu, Oct 11, 2018 at 09:44:24PM +0200, Stefan Ring wrote: > > I have empirically found and tried to fix some places where stale data was not > > properly zeroed out. > > > > In the order of the code changes: > > > > - The "freeindex" blocks in inode directories, from last entry to end of block. > > - XFS_DIR{2,3}_LEAFN_MAGIC, from last entry to end of block. > > - In btree format inodes before as well as after the btree pointers. > > - In dev inodes, everything after the header. > > --- > > db/metadump.c | 106 +++++++++++++++++++++++++++++++++++++++++++++++++++++----- > > 1 file changed, 98 insertions(+), 8 deletions(-) > > > > diff --git a/db/metadump.c b/db/metadump.c > > index ff96860d..c8213d41 100644 > > --- a/db/metadump.c > > +++ b/db/metadump.c > > @@ -2118,6 +2173,21 @@ process_btinode( > > } > > > > pp = XFS_BMDR_PTR_ADDR(dib, 1, maxrecs); > > + > > + if (zero_stale_data) { > > + char *top; > > + int used; > > + > > + /* Space before btree pointers */ > > + top = (char*)XFS_BMDR_PTR_ADDR(dib, 1, nrecs); > > + memset(top, 0, (char*)pp - top); > > + > > + /* Space after btree pointers */ > > + top = (char*)&pp[nrecs]; > > + used = top - (char*)dip; > > + memset(top, 0, mp->m_sb.sb_inodesize - used); > > Er... this zaps everything past the end of the bmbt pointers, which > means that this can zero the attr fork root. True, this is broken. I'll play around a little more with this one.