Reviewed by: Prakash Surya <[email protected]>
Reviewed by: George Wilson <[email protected]>

The problem is that zfs_get_data() supplies a stale zgd_bp to
dmu_sync(), which we then nopwrite against.

zfs_get_data() doesn't hold any DMU-related locks, so after it
copies db_blkptr to zgd_bp, dbuf_write_ready() could change
db_blkptr, and dbuf_write_done() could remove the dirty record.
dmu_sync() then sees the stale BP and that the dbuf it not dirty,
so it is eligible for nop-writing.

The fix is for dmu_sync() to copy db_blkptr to zgd_bp after
acquiring the db_mtx. We could still see a stale db_blkptr,
but if it is stale then the dirty record will still exist and
thus we won't attempt to nopwrite.
You can view, comment on, or merge this pull request online at:

  https://github.com/openzfs/openzfs/pull/400

-- Commit Summary --

  * 8378 crash due to bp in-memory modification of nopwrite block

-- File Changes --

    M usr/src/cmd/ztest/ztest.c (7)
    M usr/src/uts/common/fs/zfs/dmu.c (60)
    M usr/src/uts/common/fs/zfs/zfs_vnops.c (7)
    M usr/src/uts/common/fs/zfs/zvol.c (9)

-- Patch Links --

https://github.com/openzfs/openzfs/pull/400.patch
https://github.com/openzfs/openzfs/pull/400.diff

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/openzfs/openzfs/pull/400

------------------------------------------
openzfs-developer
Archives: 
https://openzfs.topicbox.com/groups/developer/discussions/Tdfaa847ec6045f5b-M4e595d9fcd6d5449ba122fb6
Powered by Topicbox: https://topicbox.com

Reply via email to