]> granicus.if.org Git - zfs/commitdiff
Fix infinite loop when zdb -R with d flag
authorChunwei Chen <david.chen@osnexus.com>
Wed, 10 Aug 2016 23:28:58 +0000 (16:28 -0700)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Thu, 11 Aug 2016 22:21:32 +0000 (15:21 -0700)
Also print decompress progress to stderr so it wouldn't pollute raw output
with r flag.

Signed-off-by: Chunwei Chen <david.chen@osnexus.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #4956

cmd/zdb/zdb.c

index b6ce9deb0c36fd5d2c2db24ffd1c611a6587d046..5a196c4522ccb9c111ea23bd5b916cbf52595f9a 100644 (file)
@@ -3500,7 +3500,8 @@ zdb_read_block(char *thing, spa_t *spa)
                for (lsize = psize + SPA_MINBLOCKSIZE;
                    lsize <= SPA_MAXBLOCKSIZE; lsize += SPA_MINBLOCKSIZE) {
                        for (c = 0; c < ZIO_COMPRESS_FUNCTIONS; c++) {
-                               (void) printf("Trying %05llx -> %05llx (%s)\n",
+                               (void) fprintf(stderr,
+                                   "Trying %05llx -> %05llx (%s)\n",
                                    (u_longlong_t)psize, (u_longlong_t)lsize,
                                    zio_compress_table[c].ci_name);
                                if (zio_decompress_data(c, pbuf, lbuf,
@@ -3512,7 +3513,6 @@ zdb_read_block(char *thing, spa_t *spa)
                        }
                        if (c != ZIO_COMPRESS_FUNCTIONS)
                                break;
-                       lsize -= SPA_MINBLOCKSIZE;
                }
 
                umem_free(pbuf2, SPA_MAXBLOCKSIZE);