]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Fix zfs_get_data access to files with wrong generation
authorChunwei Chen <tuxoko@gmail.com>
Sat, 20 Mar 2021 05:53:31 +0000 (22:53 -0700)
committerGitHub <noreply@github.com>
Sat, 20 Mar 2021 05:53:31 +0000 (22:53 -0700)
commit296a4a369bc1078a694f88570972330985b3b1b8
treefb1186267e77ee3e9db4025a6f7d7317fa2a7c98
parent66e6d3f128f22262e4be564c40ddc708725b6ed3
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 <behlendorf1@llnl.gov>
Signed-off-by: Chunwei Chen <david.chen@nutanix.com>
Closes #10593
Closes #11682
cmd/ztest/ztest.c
include/sys/zil.h
include/sys/zvol_impl.h
module/zfs/zfs_log.c
module/zfs/zfs_vnops.c
module/zfs/zil.c
module/zfs/zvol.c