]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs_metadump: properly handle obfuscation of all remote attribute blocks
authorEric Sandeen <sandeen@redhat.com>
Fri, 4 Aug 2017 21:33:51 +0000 (16:33 -0500)
committerEric Sandeen <sandeen@redhat.com>
Fri, 4 Aug 2017 21:33:51 +0000 (16:33 -0500)
add_remote_vals assumes that it can subtract blocksize
from each block that it processes, but with CRCs, there
is a header on each block, so the assumption that each
block consumes $BLOCKSIZE of the value length is incorrect.

This causes us to stop adding remote blocks too soon, and
the missed blocks do not get obfuscated.

Fix this by accounting for the header size as appropriate,
depending on whether or not we have a CRC filesystem.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
db/metadump.c

index 96641e05a53419932f3e46b5c39f53697e2918aa..31bb5959a89bc804309edef461a8bd51c8186120 100644 (file)
@@ -1609,7 +1609,7 @@ add_remote_vals(
                attr_data.remote_vals[attr_data.remote_val_count] = blockidx;
                attr_data.remote_val_count++;
                blockidx++;
-               length -= mp->m_sb.sb_blocksize;
+               length -= XFS_ATTR3_RMT_BUF_SPACE(mp, mp->m_sb.sb_blocksize);
        }
 
        if (attr_data.remote_val_count >= MAX_REMOTE_VALS) {