From 8898c916b1064dca9ddf1b5f9147d0139487aced Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Tue, 17 Dec 2019 11:17:16 -0800 Subject: [PATCH] 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 --- module/os/linux/zfs/zfs_dir.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/module/os/linux/zfs/zfs_dir.c b/module/os/linux/zfs/zfs_dir.c index 5150209c36f3..7ebf38ddb620 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);