From 96762fe314481c1bead4e0f36be0d72d4e13d16e Mon Sep 17 00:00:00 2001 From: Andriy Gapon Date: Tue, 9 Aug 2016 06:11:24 +0000 Subject: [PATCH] fix a zfs cross-device rename crash introduced in r303763 The problem was that 'zfsvfs' variable was not initialized if the error was detected, but in the exit path the variable was dereferenced before the error code was checked. Reported by: np MFC after: 3 days X-MFC with: r303763 --- sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c index 95257f970e7..46935429ae1 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c @@ -3956,7 +3956,7 @@ unlockout: /* all 4 vnodes are locked, ZFS_ENTER called */ VOP_UNLOCK(sdvp, 0); out: /* original two vnodes are locked */ - if (zfsvfs->z_os->os_sync == ZFS_SYNC_ALWAYS && error == 0) + if (error == 0 && zfsvfs->z_os->os_sync == ZFS_SYNC_ALWAYS) zil_commit(zilog, 0); if (*tvpp != NULL)