diff options
author | Eric Sandeen <sandeen@sandeen.net> | 2017-05-02 11:12:50 -0500 |
---|---|---|
committer | Eric Sandeen <sandeen@redhat.com> | 2017-05-02 11:12:50 -0500 |
commit | aa13f87a2cb6c0a4799fae78f0cff8d386bb6f9c (patch) | |
tree | f04397f23e2d99fa6fbb3ec2ec346cd691ef80f9 | |
parent | 6f7f89286ecd24fcc3b0e83dd71d24dbba756dd0 (diff) | |
download | xfsprogs-dev-aa13f87a2cb6c0a4799fae78f0cff8d386bb6f9c.tar.gz |
xfs_db: allow write -d to dqblks
Allow write -d to write bad data and recalculate CRC
for dqblks.
Inspired-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
-rw-r--r-- | db/io.c | 11 | ||||
-rw-r--r-- | db/io.h | 1 | ||||
-rw-r--r-- | db/write.c | 6 |
3 files changed, 17 insertions, 1 deletions
@@ -476,6 +476,17 @@ xfs_verify_recalc_inode_crc( } void +xfs_verify_recalc_dquot_crc( + struct xfs_buf *bp) +{ + ASSERT((iocur_top->dquot_buf)); + ASSERT(iocur_top->bp == bp); + + xfs_update_cksum(iocur_top->data, sizeof(struct xfs_dqblk), + XFS_DQUOT_CRC_OFF); +} + +void xfs_verify_recalc_crc( struct xfs_buf *bp) { @@ -65,6 +65,7 @@ extern void ring_add(void); extern void set_iocur_type(const struct typ *t); extern void xfs_dummy_verify(struct xfs_buf *bp); extern void xfs_verify_recalc_inode_crc(struct xfs_buf *bp); +extern void xfs_verify_recalc_dquot_crc(struct xfs_buf *bp); extern void xfs_verify_recalc_crc(struct xfs_buf *bp); /* diff --git a/db/write.c b/db/write.c index 70c9865613..d24ea05943 100644 --- a/db/write.c +++ b/db/write.c @@ -139,7 +139,8 @@ write_f( if (invalid_data && iocur_top->typ->crc_off == TYP_F_NO_CRC_OFF && - !iocur_top->ino_buf) { + !iocur_top->ino_buf && + !iocur_top->dquot_buf) { dbprintf(_("Cannot recalculate CRCs on this type of object\n")); return 0; } @@ -169,6 +170,9 @@ write_f( } else if (iocur_top->ino_buf) { local_ops.verify_write = xfs_verify_recalc_inode_crc; dbprintf(_("Allowing write of corrupted inode with good CRC\n")); + } else if (iocur_top->dquot_buf) { + local_ops.verify_write = xfs_verify_recalc_dquot_crc; + dbprintf(_("Allowing write of corrupted dquot with good CRC\n")); } else { /* invalid data */ local_ops.verify_write = xfs_verify_recalc_crc; dbprintf(_("Allowing write of corrupted data with good CRC\n")); |