hammer - Partial MFC critical pfs/snapshot fix
authorMatthew Dillon <dillon@apollo.backplane.com>
Sat, 17 Mar 2018 15:44:16 +0000 (08:44 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Sat, 17 Mar 2018 15:44:16 +0000 (08:44 -0700)
* Do not clear HAMMER2_BREF_FLAG_PFSROOT in the chain when the caller
  fails to specify HAMMER2_INSERT_PFSROOT to hammer2_chain_create().

  Ensures that the flag remains set when e.g. PFS root inodes get
  moved around due to indirect blocks.

sys/vfs/hammer2/hammer2_chain.c

index b7cccbd..95da365 100644 (file)
@@ -3156,10 +3156,17 @@ hammer2_chain_create(hammer2_chain_t **parentp, hammer2_chain_t **chainp,
                        atomic_clear_int(&chain->flags, HAMMER2_CHAIN_DELETED);
                KKASSERT(chain->parent == NULL);
        }
+
+
+       /*
+        * Set the appropriate bref flag if requested.
+        *
+        * NOTE! Callers can call this function to move chains without
+        *       knowing about special flags, so don't clear bref flags
+        *       here!
+        */
        if (flags & HAMMER2_INSERT_PFSROOT)
                chain->bref.flags |= HAMMER2_BREF_FLAG_PFSROOT;
-       else
-               chain->bref.flags &= ~HAMMER2_BREF_FLAG_PFSROOT;
 
        /*
         * Calculate how many entries we have in the blockref array and