HomeFreeBSD

Fix zfs_get_data access to files with wrong generation

Description

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

Details

Provenance
Chunwei Chen <tuxoko@gmail.com>Authored on Mar 20 2021, 5:53 AM
GitHub <noreply@github.com>Committed on Mar 20 2021, 5:53 AM
Parents
rG66e6d3f128f2: Fix regression in POSIX mode behavior
Branches
Unknown
Tags
Unknown

Event Timeline

GitHub <noreply@github.com> committed rG296a4a369bc1: Fix zfs_get_data access to files with wrong generation (authored by Chunwei Chen <tuxoko@gmail.com>).Mar 20 2021, 5:53 AM