Source-Changes archive

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

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



Module Name:    src
Committed By:   yamt
Date:           Sun Mar  1 13:53:45 UTC 2026

Modified Files:
        src/external/cddl/osnet/dist/uts/common/fs/zfs: zfs_vnops.c

Log Message:
zfs: fix a deadlock in read()

while zfs on netbsd is a non-UBC filesystem, we have a logic to try
mimicking UBC-like consistency between mmap and read/write, which
some "broken" applications might rely on. however, the logic is not
safe as indicated by the XXXNETBSD comment. it isn't safe because
touching user pages can involve page faults, which may need to block
on other (or even same) pages with an undefined locking order.

this commit fixes it by using an intermediate buffer to avoid touching
user pages while keeping a file page busy.

although this probably can be optimized by checking VV_MAPPED, i'm not
in a mood to complicate this already-complicated code further. because
zfs doesn't use UBC, if a file has uvm pages, it almost certainly has
VV_MAPPED anyway.

tested with https://github.com/yamt/garbage/blob/master/c/ubc/ubctest.c

an alternative fix would be to drop these UBC-compat logic altogether.
while it surely simplifies the code, it might break some applications
which don't use msync properly. i suspect such applications are not
so rare, because UBC is ubiquitous among modern operating systems
these days.


To generate a diff of this commit:
cvs rdiff -u -r1.82 -r1.83 \
    src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.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