From 77ecb31bae3492e93a0f77269bc3671bcb01e280 Mon Sep 17 00:00:00 2001 From: Jinshan Xiong Date: Mon, 24 Oct 2016 20:07:48 +0800 Subject: [PATCH] Do not upgrade userobj accounting for snapshot dataset 'zfs recv' could disown a living objset without calling dmu_objset_disown(). This will cause the problem that the objset would be released while upgrading thread is still running. This patch avoids the problem by checking if a dataset is snapshot before calling dmu_objset_userobjspace_upgrade(). ZoL-bug-id: https://github.com/zfsonlinux/zfs/issues/5295 Signed-off-by: Jinshan Xiong --- include/sys/dmu_objset.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/sys/dmu_objset.h b/include/sys/dmu_objset.h index 68fb5cffb932..2ec1ec87d87f 100644 --- a/include/sys/dmu_objset.h +++ b/include/sys/dmu_objset.h @@ -190,6 +190,7 @@ boolean_t dmu_objset_userobjspace_present(objset_t *os); static inline boolean_t dmu_objset_userobjspace_upgradable(objset_t *os) { return (dmu_objset_type(os) == DMU_OST_ZFS && + !dmu_objset_is_snapshot(os) && dmu_objset_userobjused_enabled(os) && !dmu_objset_userobjspace_present(os)); }