Skip to content

Commit

Permalink
6937998 txg_wait_synced() is called when unmounting zfs snapshots
Browse files Browse the repository at this point in the history
  • Loading branch information
Sanjeev Bagewadi authored and Sanjeev Bagewadi committed Jun 29, 2010
1 parent 3e1dae9 commit 5aaeed5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
9 changes: 9 additions & 0 deletions usr/src/uts/common/fs/zfs/dmu_objset.c
Original file line number Diff line number Diff line change
Expand Up @@ -1116,6 +1116,15 @@ dmu_objset_is_dirty(objset_t *os, uint64_t txg)
!list_is_empty(&os->os_free_dnodes[txg & TXG_MASK]));
}

boolean_t
dmu_objset_is_dirty_anywhere(objset_t *os)
{
for (int t = 0; t < TXG_SIZE; t++)
if (dmu_objset_is_dirty(os, t))
return (B_TRUE);
return (B_FALSE);
}

static objset_used_cb_t *used_cbs[DMU_OST_NUMTYPES];

void
Expand Down
1 change: 1 addition & 0 deletions usr/src/uts/common/fs/zfs/sys/dmu_objset.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ timestruc_t dmu_objset_snap_cmtime(objset_t *os);
/* called from dsl */
void dmu_objset_sync(objset_t *os, zio_t *zio, dmu_tx_t *tx);
boolean_t dmu_objset_is_dirty(objset_t *os, uint64_t txg);
boolean_t dmu_objset_is_dirty_anywhere(objset_t *os);
objset_t *dmu_objset_create_impl(spa_t *spa, struct dsl_dataset *ds,
blkptr_t *bp, dmu_objset_type_t type, dmu_tx_t *tx);
int dmu_objset_open_impl(spa_t *spa, struct dsl_dataset *ds, blkptr_t *bp,
Expand Down
5 changes: 2 additions & 3 deletions usr/src/uts/common/fs/zfs/zfs_vfsops.c
Original file line number Diff line number Diff line change
Expand Up @@ -1812,10 +1812,9 @@ zfsvfs_teardown(zfsvfs_t *zfsvfs, boolean_t unmounting)
/*
* Evict cached data
*/
if (dmu_objset_evict_dbufs(zfsvfs->z_os)) {
if (dmu_objset_is_dirty_anywhere(zfsvfs->z_os))
txg_wait_synced(dmu_objset_pool(zfsvfs->z_os), 0);
(void) dmu_objset_evict_dbufs(zfsvfs->z_os);
}
(void) dmu_objset_evict_dbufs(zfsvfs->z_os);

return (0);
}
Expand Down

0 comments on commit 5aaeed5

Please sign in to comment.