Skip to content

Commit

Permalink
6843 Make xattr dir truncate and remove in one tx
Browse files Browse the repository at this point in the history
Reviewed by: Brian Behlendorf <[email protected]>
Reviewed by: Dan McDonald <[email protected]>
Reviewed by: Matthew Ahrens <[email protected]>
Approved by: Robert Mustacchi <[email protected]>
  • Loading branch information
tuxoko authored and Dan McDonald committed Apr 5, 2016
1 parent 445e678 commit 399cc7d
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions usr/src/uts/common/fs/zfs/zfs_dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -606,19 +606,25 @@ zfs_rmnode(znode_t *zp)
zfs_znode_free(zp);
return;
}
}

/*
* Free up all the data in the file.
*/
error = dmu_free_long_range(os, zp->z_id, 0, DMU_OBJECT_END);
if (error) {
} else {
/*
* Not enough space. Leave the file in the unlinked set.
* Free up all the data in the file. We don't do this for
* XATTR directories because we need truncate and remove to be
* in the same tx, like in zfs_znode_delete(). Otherwise, if
* we crash here we'll end up with an inconsistent truncated
* zap object in the delete queue. Note a truncated file is
* harmless since it only contains user data.
*/
zfs_znode_dmu_fini(zp);
zfs_znode_free(zp);
return;
error = dmu_free_long_range(os, zp->z_id, 0, DMU_OBJECT_END);
if (error) {
/*
* Not enough space. Leave the file in the unlinked
* set.
*/
zfs_znode_dmu_fini(zp);
zfs_znode_free(zp);
return;
}
}

/*
Expand Down

0 comments on commit 399cc7d

Please sign in to comment.