diff options
author | Brian Behlendorf <[email protected]> | 2020-03-18 11:47:07 -0700 |
---|---|---|
committer | GitHub <[email protected]> | 2020-03-18 11:47:07 -0700 |
commit | 535195127409ca9d0526c120a5c4c24670ce79f1 (patch) | |
tree | 0c5899ff86a169b9079191f6fce66f887011578a /module | |
parent | 6b7028ec5189386e73b978fa68ce2a0d22ec0343 (diff) |
Fix zfs_rmnode() unlink / rollback issue
If a has rollback has occurred while a file is open and unlinked.
Then when the file is closed post rollback it will not exist in the
rolled back version of the unlinked object. Therefore, the call to
zap_remove_int() may correctly return ENOENT and should be allowed.
Signed-off-by: Brian Behlendorf <[email protected]>
Closes #6812
Closes #9739
Diffstat (limited to 'module')
-rw-r--r-- | module/os/linux/zfs/zfs_dir.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/module/os/linux/zfs/zfs_dir.c b/module/os/linux/zfs/zfs_dir.c index 5150209c3..7ebf38ddb 100644 --- a/module/os/linux/zfs/zfs_dir.c +++ b/module/os/linux/zfs/zfs_dir.c @@ -739,9 +739,15 @@ zfs_rmnode(znode_t *zp) zfs_unlinked_add(xzp, tx); } - /* Remove this znode from the unlinked set */ - VERIFY3U(0, ==, - zap_remove_int(zfsvfs->z_os, zfsvfs->z_unlinkedobj, zp->z_id, tx)); + /* + * Remove this znode from the unlinked set. If a has rollback has + * occurred while a file is open and unlinked. Then when the file + * is closed post rollback it will not exist in the rolled back + * version of the unlinked object. + */ + error = zap_remove_int(zfsvfs->z_os, zfsvfs->z_unlinkedobj, + zp->z_id, tx); + VERIFY(error == 0 || error == ENOENT); dataset_kstats_update_nunlinked_kstat(&zfsvfs->z_kstat, 1); |