Skip to content

Commit

Permalink
Do not upgrade userobj accounting for snapshot dataset
Browse files Browse the repository at this point in the history
'zfs recv' could disown a living objset without calling
dmu_objset_disown(). This will cause the problem that the objset
would be released while the upgrading thread is still running.

This patch avoids the problem by checking if a dataset is a snapshot
before calling dmu_objset_userobjspace_upgrade().  Snapshots
are immutable and therefore it doesn't make sense to update them.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Jinshan Xiong <jinshan.xiong@intel.com>
Closes #5295 
Closes #5328
  • Loading branch information
jxiong authored and behlendorf committed Oct 25, 2016
1 parent 6568379 commit 16fa68f
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions include/sys/dmu_objset.h
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand Down

0 comments on commit 16fa68f

Please sign in to comment.