]> granicus.if.org Git - zfs/commitdiff
Fix OpenZFS 9337 mismerge
authorGeorge Wilson <george.wilson@delphix.com>
Tue, 31 Jul 2018 21:51:15 +0000 (17:51 -0400)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Thu, 2 Aug 2018 17:21:48 +0000 (10:21 -0700)
This change reintroduces logic required by OpenZFS 9577. When
OpenZFS 9337, zfs get all is slow due to uncached metadata, was
merged in it ended up removing logic required by OpenZFS 9577,
remove zfs_dbuf_evict_key, and inadvertently reintroduced the
bug that 9577 was designed to fix.

This change re-enables the "evicting" flag to dbuf_rele_and_unlock
and dnode_rele_and_unlock and updates all callers to provide the
correct parameter.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: George Wilson <george.wilson@delphix.com>
Closes #7758

include/sys/dbuf.h
include/sys/dnode.h
module/zfs/dbuf.c
module/zfs/dnode.c
module/zfs/dnode_sync.c

index 557d2af6675ae96112b939ada7fdba8e82da1ada..ab0950c83c203a80ebba5f352439371e109db994 100644 (file)
@@ -313,7 +313,7 @@ boolean_t dbuf_try_add_ref(dmu_buf_t *db, objset_t *os, uint64_t obj,
 uint64_t dbuf_refcount(dmu_buf_impl_t *db);
 
 void dbuf_rele(dmu_buf_impl_t *db, void *tag);
-void dbuf_rele_and_unlock(dmu_buf_impl_t *db, void *tag);
+void dbuf_rele_and_unlock(dmu_buf_impl_t *db, void *tag, boolean_t evicting);
 
 dmu_buf_impl_t *dbuf_find(struct objset *os, uint64_t object, uint8_t level,
     uint64_t blkid);
index 6fdde5067b0657b153bd325bd88ca9235ef14869..0774e663f1b63d3f186eee03fedc8edaa693aa12 100644 (file)
@@ -408,7 +408,7 @@ int dnode_hold_impl(struct objset *dd, uint64_t object, int flag, int dn_slots,
     void *ref, dnode_t **dnp);
 boolean_t dnode_add_ref(dnode_t *dn, void *ref);
 void dnode_rele(dnode_t *dn, void *ref);
-void dnode_rele_and_unlock(dnode_t *dn, void *tag);
+void dnode_rele_and_unlock(dnode_t *dn, void *tag, boolean_t evicting);
 void dnode_setdirty(dnode_t *dn, dmu_tx_t *tx);
 void dnode_sync(dnode_t *dn, dmu_tx_t *tx);
 void dnode_allocate(dnode_t *dn, dmu_object_type_t ot, int blocksize, int ibs,
index dad090bf9fe26d6057746a6837947d90f0f44712..2724f3aa2af0c90c7dd48d17932ab9e5de189465 100644 (file)
@@ -1212,7 +1212,7 @@ dbuf_read_done(zio_t *zio, const zbookmark_phys_t *zb, const blkptr_t *bp,
                db->db_state = DB_UNCACHED;
        }
        cv_broadcast(&db->db_changed);
-       dbuf_rele_and_unlock(db, NULL);
+       dbuf_rele_and_unlock(db, NULL, B_FALSE);
 }
 
 
@@ -2580,7 +2580,7 @@ dbuf_destroy(dmu_buf_impl_t *db)
                 * release any lock.
                 */
                mutex_enter(&dn->dn_mtx);
-               dnode_rele_and_unlock(dn, db);
+               dnode_rele_and_unlock(dn, db, B_TRUE);
                db->db_dnode_handle = NULL;
 
                dbuf_hash_remove(db);
@@ -2609,7 +2609,7 @@ dbuf_destroy(dmu_buf_impl_t *db)
         */
        if (parent && parent != dndb) {
                mutex_enter(&parent->db_mtx);
-               dbuf_rele_and_unlock(parent, db);
+               dbuf_rele_and_unlock(parent, db, B_TRUE);
        }
 }
 
@@ -3351,7 +3351,7 @@ void
 dbuf_rele(dmu_buf_impl_t *db, void *tag)
 {
        mutex_enter(&db->db_mtx);
-       dbuf_rele_and_unlock(db, tag);
+       dbuf_rele_and_unlock(db, tag, B_FALSE);
 }
 
 void
@@ -3374,7 +3374,7 @@ dmu_buf_rele(dmu_buf_t *db, void *tag)
  *
  */
 void
-dbuf_rele_and_unlock(dmu_buf_impl_t *db, void *tag)
+dbuf_rele_and_unlock(dmu_buf_impl_t *db, void *tag, boolean_t evicting)
 {
        int64_t holds;
 
@@ -3495,7 +3495,8 @@ dbuf_rele_and_unlock(dmu_buf_impl_t *db, void *tag)
                                }
                                mutex_exit(&db->db_mtx);
 
-                               if (db->db_caching_status == DB_DBUF_CACHE) {
+                               if (db->db_caching_status == DB_DBUF_CACHE &&
+                                   !evicting) {
                                        dbuf_evict_notify();
                                }
                        }
@@ -3848,7 +3849,7 @@ dbuf_sync_leaf(dbuf_dirty_record_t *dr, dmu_tx_t *tx)
                kmem_free(dr, sizeof (dbuf_dirty_record_t));
                ASSERT(db->db_dirtycnt > 0);
                db->db_dirtycnt -= 1;
-               dbuf_rele_and_unlock(db, (void *)(uintptr_t)txg);
+               dbuf_rele_and_unlock(db, (void *)(uintptr_t)txg, B_FALSE);
                return;
        }
 
@@ -4223,7 +4224,7 @@ dbuf_write_done(zio_t *zio, arc_buf_t *buf, void *vdb)
        ASSERT(db->db_dirtycnt > 0);
        db->db_dirtycnt -= 1;
        db->db_data_pending = NULL;
-       dbuf_rele_and_unlock(db, (void *)(uintptr_t)tx->tx_txg);
+       dbuf_rele_and_unlock(db, (void *)(uintptr_t)tx->tx_txg, B_FALSE);
 }
 
 static void
index 26471fda0b2a63245edf70b5edf5fa04f4bee146..4e2a733830b1ff5dc0530670850bef38931ff1d8 100644 (file)
@@ -1576,11 +1576,11 @@ void
 dnode_rele(dnode_t *dn, void *tag)
 {
        mutex_enter(&dn->dn_mtx);
-       dnode_rele_and_unlock(dn, tag);
+       dnode_rele_and_unlock(dn, tag, B_FALSE);
 }
 
 void
-dnode_rele_and_unlock(dnode_t *dn, void *tag)
+dnode_rele_and_unlock(dnode_t *dn, void *tag, boolean_t evicting)
 {
        uint64_t refs;
        /* Get while the hold prevents the dnode from moving. */
@@ -1612,7 +1612,7 @@ dnode_rele_and_unlock(dnode_t *dn, void *tag)
                 * asserted anyway when the handle gets destroyed.
                 */
                mutex_enter(&db->db_mtx);
-               dbuf_rele_and_unlock(db, dnh);
+               dbuf_rele_and_unlock(db, dnh, evicting);
        }
 }
 
index b1f734a8210e289fc7272c528da291d9d774d29d..f0459e47d8c371bd013bab3af21e0a03db94fcb0 100644 (file)
@@ -457,7 +457,7 @@ dnode_evict_dbufs(dnode_t *dn)
                         * flow would look like:
                         *
                         * dbuf_destroy():
-                        *   dnode_rele_and_unlock(parent_dbuf):
+                        *   dnode_rele_and_unlock(parent_dbuf, evicting=TRUE):
                         *      if (!cacheable || pending_evict)
                         *        dbuf_destroy()
                         */
@@ -521,7 +521,7 @@ dnode_undirty_dbufs(list_t *list)
                        list_destroy(&dr->dt.di.dr_children);
                }
                kmem_free(dr, sizeof (dbuf_dirty_record_t));
-               dbuf_rele_and_unlock(db, (void *)(uintptr_t)txg);
+               dbuf_rele_and_unlock(db, (void *)(uintptr_t)txg, B_FALSE);
        }
 }