]> git.proxmox.com Git - mirror_zfs.git/commitdiff
Fix zfs_rmnode() unlink / rollback issue
authorBrian Behlendorf <behlendorf1@llnl.gov>
Wed, 18 Mar 2020 18:47:07 +0000 (11:47 -0700)
committerGitHub <noreply@github.com>
Wed, 18 Mar 2020 18:47:07 +0000 (11:47 -0700)
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 <behlendorf1@llnl.gov>
Closes #6812
Closes #9739

module/os/linux/zfs/zfs_dir.c

index 5150209c36f3a60c9c78f7dea88a244bc507904b..7ebf38ddb620846139892cf509b2ffe1e6192b7c 100644 (file)
@@ -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);