freebsd-dev/cddl
Andriy Gapon b4e4140d13 MFV r322223: 8378 crash due to bp in-memory modification of nopwrite block
illumos/illumos-gate@b7edcb9408
b7edcb9408

https://www.illumos.org/issues/8378
  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.

Reviewed by: Prakash Surya <prakash.surya@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Approved by: Robert Mustacchi <rm@joyent.com>
Author: Matthew Ahrens <mahrens@delphix.com>

MFC after:	2 weeks
2017-08-08 10:46:51 +00:00
..
compat/opensolaris libproc: Add support for some proc_attach() flags. 2016-12-06 04:22:38 +00:00
contrib/opensolaris MFV r322223: 8378 crash due to bp in-memory modification of nopwrite block 2017-08-08 10:46:51 +00:00
lib Convert traditional ${MK_TESTS} conditional idiom for including test 2017-08-02 08:35:51 +00:00
sbin Convert traditional ${MK_TESTS} conditional idiom for including test 2017-08-02 08:35:51 +00:00
tests Merge ^/user/ngie/release-pkg-fix-tests to unbreak how test files are installed 2016-05-04 23:20:53 +00:00
usr.bin Convert traditional ${MK_TESTS} conditional idiom for including test 2017-08-02 08:35:51 +00:00
usr.sbin Convert traditional ${MK_TESTS} conditional idiom for including test 2017-08-02 08:35:51 +00:00
Makefile Convert traditional ${MK_TESTS} conditional idiom for including test 2017-08-02 08:35:51 +00:00
Makefile.inc Make DTrace stuff compile with C99 standard. 2014-08-22 20:04:51 +00:00