aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/ztest
diff options
context:
space:
mode:
authorChunwei Chen <[email protected]>2021-03-19 22:53:31 -0700
committerGitHub <[email protected]>2021-03-19 22:53:31 -0700
commit296a4a369bc1078a694f88570972330985b3b1b8 (patch)
treefb1186267e77ee3e9db4025a6f7d7317fa2a7c98 /cmd/ztest
parent66e6d3f128f22262e4be564c40ddc708725b6ed3 (diff)
Fix zfs_get_data access to files with wrong generation
If TX_WRITE is create on a file, and the file is later deleted and a new directory is created on the same object id, it is possible that when zil_commit happens, zfs_get_data will be called on the new directory. This may result in panic as it tries to do range lock. This patch fixes this issue by record the generation number during zfs_log_write, so zfs_get_data can check if the object is valid. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Chunwei Chen <[email protected]> Closes #10593 Closes #11682
Diffstat (limited to 'cmd/ztest')
-rw-r--r--cmd/ztest/ztest.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/cmd/ztest/ztest.c b/cmd/ztest/ztest.c
index 1a0302807..7193eafe3 100644
--- a/cmd/ztest/ztest.c
+++ b/cmd/ztest/ztest.c
@@ -2287,8 +2287,8 @@ ztest_get_done(zgd_t *zgd, int error)
}
static int
-ztest_get_data(void *arg, lr_write_t *lr, char *buf, struct lwb *lwb,
- zio_t *zio)
+ztest_get_data(void *arg, uint64_t arg2, lr_write_t *lr, char *buf,
+ struct lwb *lwb, zio_t *zio)
{
ztest_ds_t *zd = arg;
objset_t *os = zd->zd_os;