Hi,
Trying to understand the zfs code, I was playing with libzpool - like
ztest does.
What I am trying to do is create an object in a zfs filesystem. But I am
seeing failures when I try to sync changes.
bash-3.00# ./udmu test Object 4 error: ZFS: I/O failure (write on
<unknown> off 0: zio 81f5d00 [L0 unallocated] 200L/200P DVA[0]=<0:0:200>
fletcher2 uncompressed LE contiguous birth=7 fill=0
cksum=4141414141414141:4141:2828282828282820:82820): error 28
Abort (core dumped)
I can see that space does not get allocated and sync results in ENOSPC.
There is plenty of space in the pool. So, that is not the issue. I guess
I am missing the step of allocating space. Could someone help me figure
out what it is?
I have tried to follow what ztest does. This is what I do:
<code snippet>
kernel_init(FREAD | FWRITE);
buf = malloc(BUF_SIZE);
memset(buf, 'A', BUF_SIZE);
error = dmu_objset_open(osname, DMU_OST_ZFS, DS_MODE_PRIMARY, &os);
if (error) {
fprintf(stderr, "dmu_objset_open() = %d", error);
return (error);
}
tx = dmu_tx_create(os);
dmu_tx_hold_write(tx, DMU_NEW_OBJECT, 0, BUF_SIZE);
// dmu_tx_hold_bonus(tx, DMU_NEW_OBJECT);
error = dmu_tx_assign(tx, TXG_WAIT);
if (error) {
dmu_tx_abort(tx);
return (error);
}
object = dmu_object_alloc(os, DMU_OT_UINT64_OTHER, 0,
DMU_OT_NONE, 0, tx);
printf("Object %lld\n", object);
dmu_write(os, object, 0, BUF_SIZE, buf, tx);
dmu_tx_commit(tx);
txg_wait_synced(dmu_objset_pool(os), 0);
</code snippet>
It is interesting that the checksum that is reported is the pattern that
I try to write.
This is the panic stack:
d11d8e65 _lwp_kill (98, 6) + 15
d1192102 raise (6) + 22
d1170dad abort (81f5d00, d1354000, ce3fdcc8, ce3fdcbc, d13c0568,
ce3fdcbc) + cd
d131ed79 vpanic (d1341dbc, ce3fdcc8) + 51
d131ed9f panic (d1341dbc, d135a384, d135a724, d133a630, 0, 0) + 1f
d131921d zio_done (81f5d00) + 455
d131c15d zio_next_stage (81f5d00) + 161
d1318b92 zio_wait_for_children (81f5d00, 11, 81f5ef0) + 6a
d1318c88 zio_wait_children_done (81f5d00) + 18
d131c15d zio_next_stage (81f5d00) + 161
d131ba83 zio_vdev_io_assess (81f5d00) + 183
d131c15d zio_next_stage (81f5d00) + 161
d1307011 vdev_mirror_io_done (81f5d00) + 421
d131b8a2 zio_vdev_io_done (81f5d00, 0, d0e0ac00, d1210000, d11ba2df,
3) + 36
d131f585 taskq_thread (81809c0) + 89
d11d7604 _thr_setup (d0e0ac00) + 52
d11d7860 _lwp_start (d0e0ac00, 0, 0, 0, 0, 0)
Thanks in advance!
Regards,
Manoj