NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

PR/58111 CVS commit: src/external/cddl/osnet/dist/uts/common/fs/zfs



The following reply was made to PR kern/58111; it has been noted by GNATS.

From: "Simon Burge" <simonb%netbsd.org@localhost>
To: gnats-bugs%gnats.NetBSD.org@localhost
Cc: 
Subject: PR/58111 CVS commit: src/external/cddl/osnet/dist/uts/common/fs/zfs
Date: Fri, 5 Apr 2024 11:20:34 +0000

 Module Name:	src
 Committed By:	simonb
 Date:		Fri Apr  5 11:20:34 UTC 2024
 
 Modified Files:
 	src/external/cddl/osnet/dist/uts/common/fs/zfs: dmu.c
 
 Log Message:
 Apply FreeBSD svn r373278 fix for ZFS corruption.  Fix for NetBSD
 PR kern/58111 .
 
 It would be extremely unlikely to trip this bug on NetBSD, as we don't
 expose SEEK_DATA and SEEK_HOLE and you need to call ioctl(2) with
 FIOSEEKDATA and FIOSEEKHOLE directly which no currently known code does,
 and even then be unlucky enough to trip a race condition.
 
 With a reproducer based on that in https://www.illumos.org/issues/16087,
 I saw 11 groups of failures over 8 hours.  With this patch, no
 failures in 10 hours.  The repro for NetBSD will be attached to
 https://gnats.netbsd.org/58111 .
 
 Original FreeBSD commit 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.
 
 
 To generate a diff of this commit:
 cvs rdiff -u -r1.6 -r1.7 src/external/cddl/osnet/dist/uts/common/fs/zfs/dmu.c
 
 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.
 


Home | Main Index | Thread Index | Old Index