Skip to content

Commit

Permalink
mzap_upgrade() must use kmem_alloc()
Browse files Browse the repository at this point in the history
These allocations in mzap_update() used to be kmem_alloc() but
were changed to vmem_alloc() due to the size of the allocation.
However, since it turns out this function may be called in the
context of the txg_sync thread they must be changed back to use
a kmem_alloc() to ensure the KM_PUSHPAGE flag is honored.

Signed-off-by: Brian Behlendorf <[email protected]>
  • Loading branch information
behlendorf committed Aug 27, 2012
1 parent 8630650 commit 991fc1d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions module/zfs/zap_micro.c
Original file line number Diff line number Diff line change
Expand Up @@ -533,15 +533,15 @@ mzap_upgrade(zap_t **zapp, dmu_tx_t *tx, zap_flags_t flags)
ASSERT(RW_WRITE_HELD(&zap->zap_rwlock));

sz = zap->zap_dbuf->db_size;
mzp = vmem_alloc(sz, KM_SLEEP);
mzp = kmem_alloc(sz, KM_PUSHPAGE | KM_NODEBUG);
bcopy(zap->zap_dbuf->db_data, mzp, sz);
nchunks = zap->zap_m.zap_num_chunks;

if (!flags) {
err = dmu_object_set_blocksize(zap->zap_objset, zap->zap_object,
1ULL << fzap_default_block_shift, 0, tx);
if (err) {
vmem_free(mzp, sz);
kmem_free(mzp, sz);
return (err);
}
}
Expand All @@ -567,7 +567,7 @@ mzap_upgrade(zap_t **zapp, dmu_tx_t *tx, zap_flags_t flags)
if (err)
break;
}
vmem_free(mzp, sz);
kmem_free(mzp, sz);
*zapp = zap;
return (err);
}
Expand Down

0 comments on commit 991fc1d

Please sign in to comment.