From b320dd91a9262633200c9570442659989a677f0c Mon Sep 17 00:00:00 2001 From: Chunwei Chen <david.chen@osnexus.com> Date: Wed, 10 Aug 2016 16:28:58 -0700 Subject: [PATCH] Fix infinite loop when zdb -R with d flag 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 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/zdb/zdb.c b/cmd/zdb/zdb.c index b6ce9deb0c..5a196c4522 100644 --- a/cmd/zdb/zdb.c +++ b/cmd/zdb/zdb.c @@ -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);