[Midnightbsd-cvs] [MidnightBSD/src] da29e7: dnode_is_dirty: check dnode and its data for dirti...
Rob N
noreply at github.com
Sat Dec 9 14:03:03 EST 2023
Branch: refs/heads/master
Home: https://github.com/MidnightBSD/src
Commit: da29e72595bcc1371c1efdf6ec15524991ddf514
https://github.com/MidnightBSD/src/commit/da29e72595bcc1371c1efdf6ec15524991ddf514
Author: Rob Norris <rob.norris at klarasystems.com>
Date: 2023-12-09 (Sat, 09 Dec 2023)
Changed paths:
M sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c
Log Message:
-----------
dnode_is_dirty: check dnode and its data for dirtiness
Over its history this the dirty dnode test has been changed between
checking for a dnodes being on `os_dirty_dnodes` (`dn_dirty_link`) and
`dn_dirty_record`.
It turns out both are actually required.
In the case of appending data to a newly created file, the dnode proper
is dirtied (at least to change the blocksize) and dirty records are
added. Thus, a single logical operation is represented by separate
dirty indicators, and must not be separated.
The incorrect dirty check becomes a problem when the first block of a
file is being appended to while another process is calling lseek to skip
holes. There is a small window where the dnode part is undirtied while
there are still dirty records. In this case, `lseek(fd, 0, SEEK_DATA)`
would not know that the file is dirty, and would go to
`dnode_next_offset()`. Since the object has no data blocks yet, it
returns `ESRCH`, indicating no data found, which results in `ENXIO`
being returned to `lseek()`'s caller.
This change simply updates the dirty check to check both types of dirty.
If there's anything dirty at all, we immediately go to the "wait for
sync" stage, It doesn't really matter after that; both changes are on
disk, so the dirty fields should be correct.
Sponsored by: Klara, Inc.
Sponsored by: Wasabi Technology, Inc.
More information about the Midnightbsd-cvs
mailing list