diff options
author | LOLi <[email protected]> | 2017-08-21 17:59:48 +0200 |
---|---|---|
committer | Tony Hutter <[email protected]> | 2017-08-21 16:46:54 -0700 |
commit | ae5b4a05fff84cfb4facab1037bdb725f1b30bc6 (patch) | |
tree | bc2e30d73b44de8d7d729e0767a0833177b6b244 /cmd/ztest/ztest.c | |
parent | 3468fdbd347c39db5c3c73a6bcaea69871a66fe9 (diff) |
Fix range locking in ZIL commit codepath
Since OpenZFS 7578 (1b7c1e5) if we have a ZVOL with logbias=throughput
we will force WR_INDIRECT itxs in zvol_log_write() setting itx->itx_lr
offset and length to the offset and length of the BIO from
zvol_write()->zvol_log_write(): these offset and length are later used
to take a range lock in zillog->zl_get_data function: zvol_get_data().
Now suppose we have a ZVOL with blocksize=8K and push 4K writes to
offset 0: we will only be range-locking 0-4096. This means the
ASSERTion we make in dbuf_unoverride() is no longer valid because now
dmu_sync() is called from zilog's get_data functions holding a partial
lock on the dbuf.
Fix this by taking a range lock on the whole block in zvol_get_data().
Reviewed-by: Chunwei Chen <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: loli10K <[email protected]>
Closes #6238
Closes #6315
Closes #6356
Closes #6477
Diffstat (limited to 'cmd/ztest/ztest.c')
-rw-r--r-- | cmd/ztest/ztest.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/cmd/ztest/ztest.c b/cmd/ztest/ztest.c index 788e6aa6a..8613d3d63 100644 --- a/cmd/ztest/ztest.c +++ b/cmd/ztest/ztest.c @@ -2145,6 +2145,7 @@ ztest_get_data(void *arg, lr_write_t *lr, char *buf, zio_t *zio) if (buf != NULL) { /* immediate write */ zgd_private->z_rl = ztest_range_lock(zd, object, offset, size, RL_READER); + zgd->zgd_rl = zgd_private->z_rl->z_rl; error = dmu_read(os, object, offset, size, buf, DMU_READ_NO_PREFETCH); @@ -2160,6 +2161,7 @@ ztest_get_data(void *arg, lr_write_t *lr, char *buf, zio_t *zio) zgd_private->z_rl = ztest_range_lock(zd, object, offset, size, RL_READER); + zgd->zgd_rl = zgd_private->z_rl->z_rl; error = dmu_buf_hold(os, object, offset, zgd, &db, DMU_READ_NO_PREFETCH); |