From 802b1a7b3b413486d4ff249f84c5e6cfd005ed55 Mon Sep 17 00:00:00 2001 From: Matthew Ahrens Date: Fri, 23 Jun 2017 12:32:16 -0700 Subject: [PATCH] OpenZFS 9338 - moved dnode has incorrect dn_next_type Authored by: Matthew Ahrens Reviewed by: Prashanth Sreenivasa Reviewed by: Serapheim Dimitropoulos Reviewed by: Dan Kimmel Reviewed by: Giuseppe Di Natale Reviewed by: George Melikov Approved by: Robert Mustacchi Ported-by: Brian Behlendorf While investigating a different problem, I noticed that moved dnodes (those processed by dnode_move_impl() via kmem_move()) have an incorrect dn_next_type. This could cause the on-disk dn_type to be changed to an invalid value. The fix to copy the dn_next_type in dnode_move_impl(). Porting notes: * For the moment this potential issue cannot occur on Linux since the SPL does not provide the kmem_move() functionality. OpenZFS-issue: https://illumos.org/issues/9338 OpenZFS-commit: https://github.com/openzfs/openzfs/commit/0717e6f13 Closes #7715 --- module/zfs/dnode.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/module/zfs/dnode.c b/module/zfs/dnode.c index 7672a62fa..7939a7ba6 100644 --- a/module/zfs/dnode.c +++ b/module/zfs/dnode.c @@ -770,6 +770,8 @@ dnode_move_impl(dnode_t *odn, dnode_t *ndn) ndn->dn_datablksz = odn->dn_datablksz; ndn->dn_maxblkid = odn->dn_maxblkid; ndn->dn_num_slots = odn->dn_num_slots; + bcopy(&odn->dn_next_type[0], &ndn->dn_next_type[0], + sizeof (odn->dn_next_type)); bcopy(&odn->dn_next_nblkptr[0], &ndn->dn_next_nblkptr[0], sizeof (odn->dn_next_nblkptr)); bcopy(&odn->dn_next_nlevels[0], &ndn->dn_next_nlevels[0], -- 2.40.0