]> granicus.if.org Git - zfs/commitdiff
OpenZFS 9338 - moved dnode has incorrect dn_next_type
authorMatthew Ahrens <mahrens@delphix.com>
Fri, 23 Jun 2017 19:32:16 +0000 (12:32 -0700)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Wed, 25 Jul 2018 00:10:42 +0000 (17:10 -0700)
Authored by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Prashanth Sreenivasa <pks@delphix.com>
Reviewed by: Serapheim Dimitropoulos <serapheim.dimitro@delphix.com>
Reviewed by: Dan Kimmel <dan.kimmel@delphix.com>
Reviewed by: Giuseppe Di Natale <guss80@gmail.com>
Reviewed by: George Melikov <mail@gmelikov.ru>
Approved by: Robert Mustacchi <rm@joyent.com>
Ported-by: Brian Behlendorf <behlendorf1@llnl.gov>
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

index 7672a62fa49c41dadf0c08bc25f750b92341ab8d..7939a7ba6962e4883a000afff1bb44310b2f554c 100644 (file)
@@ -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],