Avoid abort() in vn_rdwr(): libzpool/kernel.c
[zfs.git] / cmd / zdb / zdb.c
index 42c51e2..a2b6bfe 100644 (file)
@@ -996,7 +996,7 @@ visit_indirect(spa_t *spa, const dnode_phys_t *dnp,
                arc_buf_t *buf;
                uint64_t fill = 0;
 
-               err = arc_read_nolock(NULL, spa, bp, arc_getbuf_func, &buf,
+               err = arc_read(NULL, spa, bp, arc_getbuf_func, &buf,
                    ZIO_PRIORITY_ASYNC_READ, ZIO_FLAG_CANFAIL, &flags, zb);
                if (err)
                        return (err);
@@ -2048,9 +2048,8 @@ zdb_blkptr_done(zio_t *zio)
        mutex_exit(&spa->spa_scrub_lock);
 }
 
-/* ARGSUSED */
 static int
-zdb_blkptr_cb(spa_t *spa, zilog_t *zilog, const blkptr_t *bp, arc_buf_t *pbuf,
+zdb_blkptr_cb(spa_t *spa, zilog_t *zilog, const blkptr_t *bp,
     const zbookmark_t *zb, const dnode_phys_t *dnp, void *arg)
 {
        zdb_cb_t *zcb = arg;
@@ -2457,7 +2456,7 @@ typedef struct zdb_ddt_entry {
 /* ARGSUSED */
 static int
 zdb_ddt_add_cb(spa_t *spa, zilog_t *zilog, const blkptr_t *bp,
-    arc_buf_t *pbuf, const zbookmark_t *zb, const dnode_phys_t *dnp, void *arg)
+    const zbookmark_t *zb, const dnode_phys_t *dnp, void *arg)
 {
        avl_tree_t *t = arg;
        avl_index_t where;
@@ -2845,7 +2844,7 @@ zdb_read_block(char *thing, spa_t *spa)
        psize = size;
        lsize = size;
 
-       pbuf = umem_alloc(SPA_MAXBLOCKSIZE, UMEM_NOFAIL);
+       pbuf = umem_alloc_aligned(SPA_MAXBLOCKSIZE, 512, UMEM_NOFAIL);
        lbuf = umem_alloc(SPA_MAXBLOCKSIZE, UMEM_NOFAIL);
 
        BP_ZERO(bp);
@@ -3059,12 +3058,22 @@ main(int argc, char **argv)
        nvlist_t *policy = NULL;
        uint64_t max_txg = UINT64_MAX;
        int rewind = ZPOOL_NEVER_REWIND;
+       char *spa_config_path_env;
 
        (void) setrlimit(RLIMIT_NOFILE, &rl);
        (void) enable_extended_FILE_stdio(-1, -1);
 
        dprintf_setup(&argc, argv);
 
+       /*
+        * If there is an environment variable SPA_CONFIG_PATH it overrides
+        * default spa_config_path setting. If -U flag is specified it will
+        * override this environment variable settings once again.
+        */
+       spa_config_path_env = getenv("SPA_CONFIG_PATH");
+       if (spa_config_path_env != NULL)
+               spa_config_path = spa_config_path_env;
+
        while ((c = getopt(argc, argv, "bcdhilmM:suCDRSAFLXevp:t:U:P")) != -1) {
                switch (c) {
                case 'b':