From: Glen Overby Date: Wed, 24 Sep 2003 23:43:37 +0000 (+0000) Subject: xfs_repair doesn't handle unwritten real-time extents properly. When X-Git-Tag: v2.6.0~11 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c12813040e67dcf6e1852626715644be86f717c0;p=thirdparty%2Fxfsprogs-dev.git xfs_repair doesn't handle unwritten real-time extents properly. When the real-time subvolume extent size is larger than a filesystem block, it is possible to have a real-time extent that is part written and part unwritten. Internally, xfs_repair tracks real-time extent use on a per-extent basis. Thus, a file that has a written and unwritten extent falling on the same extent. This fix addresses this problem specificly by noting when the file extent is unwritten and covers a partial real-time extent. Then, instead of checking that it is unused, it checks that it is used. --- diff --git a/repair/dinode.c b/repair/dinode.c index a2740c227..79ccbee45 100644 --- a/repair/dinode.c +++ b/repair/dinode.c @@ -525,6 +525,7 @@ process_bmbt_reclist_int( int i; int state; int flag; /* extent flag */ + int pwe; /* partially-written extent */ if (whichfork == XFS_DATA_FORK) forkname = _("data"); @@ -633,9 +634,16 @@ process_bmbt_reclist_int( */ for (b = s; b < s + c; b += mp->m_sb.sb_rextsize) { ext = (xfs_drtbno_t) b / mp->m_sb.sb_rextsize; + if (XFS_SB_VERSION_HASEXTFLGBIT(&mp->m_sb) && + flag && (b % mp->m_sb.sb_rextsize != 0)) { + pwe = 1; + } else { + pwe = 0; + } if (check_dups == 1) { - if (search_rt_dup_extent(mp, ext)) { + if (search_rt_dup_extent(mp, ext) && + !pwe) { do_warn( _("data fork in rt ino %llu claims dup rt extent, off - %llu, " "start - %llu, count %llu\n"), @@ -671,6 +679,8 @@ process_bmbt_reclist_int( _("%s fork in rt inode %llu found metadata block %llu in %s bmap\n"), forkname, ino, ext, ftype); case XR_E_INUSE: + if (pwe) + break; case XR_E_MULT: set_rtbno_state(mp, ext, XR_E_MULT); do_warn(