Skip to content

Commit

Permalink
Stop upgrade thread at the end of 'zfs recv'
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 upgrading thread is still running.

This patch calls dmu_objset_upgrade_stop() in dmu_recv_end().

ZoL-bug-id: #5295

Signed-off-by: Jinshan Xiong <[email protected]>
  • Loading branch information
Jinshan Xiong committed Oct 24, 2016
1 parent 24cdeaf commit 7c186d7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions include/sys/dmu_objset.h
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ void dmu_objset_evict(objset_t *os);
void dmu_objset_do_userquota_updates(objset_t *os, dmu_tx_t *tx);
void dmu_objset_userquota_get_ids(dnode_t *dn, boolean_t before, dmu_tx_t *tx);
boolean_t dmu_objset_userused_enabled(objset_t *os);
void dmu_objset_upgrade_stop(objset_t *os);
int dmu_objset_userspace_upgrade(objset_t *os);
boolean_t dmu_objset_userspace_present(objset_t *os);
boolean_t dmu_objset_userobjused_enabled(objset_t *os);
Expand Down
3 changes: 1 addition & 2 deletions module/zfs/dmu_objset.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ int dmu_rescan_dnode_threshold = 1 << DN_MAX_INDBLKSHIFT;
static void dmu_objset_find_dp_cb(void *arg);

static void dmu_objset_upgrade(objset_t *os, dmu_objset_upgrade_cb_t cb);
static void dmu_objset_upgrade_stop(objset_t *os);

void
dmu_objset_init(void)
Expand Down Expand Up @@ -1124,7 +1123,7 @@ dmu_objset_upgrade(objset_t *os, dmu_objset_upgrade_cb_t cb)
mutex_exit(&os->os_upgrade_lock);
}

static void
void
dmu_objset_upgrade_stop(objset_t *os)
{
mutex_enter(&os->os_upgrade_lock);
Expand Down
5 changes: 5 additions & 0 deletions module/zfs/dmu_send.c
Original file line number Diff line number Diff line change
Expand Up @@ -3347,6 +3347,11 @@ dmu_recv_new_end(dmu_recv_cookie_t *drc)
int
dmu_recv_end(dmu_recv_cookie_t *drc, void *owner)
{
objset_t *os;

VERIFY0(dmu_objset_from_ds(drc->drc_ds, &os));
dmu_objset_upgrade_stop(os);

drc->drc_owner = owner;

if (drc->drc_newfs)
Expand Down

0 comments on commit 7c186d7

Please sign in to comment.