MFV r316928: 7256 low probability race in zfs_get_data
authoravg <avg@FreeBSD.org>
Fri, 26 May 2017 10:31:05 +0000 (10:31 +0000)
committeravg <avg@FreeBSD.org>
Fri, 26 May 2017 10:31:05 +0000 (10:31 +0000)
commit05e274dd2bd0e6788a0245a610346b48b2805038
tree369cf80a5a1d7207985277b5a5841ddbd7ed056c
parent15f488114257ef750c2ed6921de74db4e21a88f7
MFV r316928: 7256 low probability race in zfs_get_data

illumos/illumos-gate@0c94e1af6784c69a1dea25e0e35dd13b2b91e2e5
https://github.com/illumos/illumos-gate/commit/0c94e1af6784c69a1dea25e0e35dd13b2b91e2e5

https://www.illumos.org/issues/7256
                         error = dmu_sync(zio, lr->lr_common.lrc_txg,
                              zfs_get_done, zgd);
                         ASSERT(error || lr->lr_length <= zp->z_blksz);
  It's possible, although extremely rare, that the zfs_get_done() callback is
  executed before dmu_sync() returns.
  In that case the znode's range lock is dropped and the znode is unreferenced.
  Thus, the assertion can access some invalid or wrong data via the zp pointer.
  size variable caches the correct value of z_blksz and can be safely used here.

Reviewed by: Matt Ahrens <mahrens@delphix.com>
Reviewed by: Pavel Zakharov <pavel.zakharov@delphix.com>
Approved by: Dan McDonald <danmcd@omniti.com>
Author: Andriy Gapon <andriy.gapon@clusterhq.com>

MFC after: 1 week
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c