[Top] [All Lists]

[PATCH 31/37] db: Unwind the IO stack on exit

To: xfs@xxxxxxxxxxx
Subject: [PATCH 31/37] db: Unwind the IO stack on exit
From: Dave Chinner <david@xxxxxxxxxxxxx>
Date: Wed, 6 Nov 2013 12:07:17 +1100
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <1383700043-32305-1-git-send-email-david@xxxxxxxxxxxxx>
References: <1383700043-32305-1-git-send-email-david@xxxxxxxxxxxxx>
From: Dave Chinner <dchinner@xxxxxxxxxx>

xfs_db can build up a large IO stack by the time it has run to
completion. If we don't unwind this IO stack before we shut down the
libxfs caches, metadump and other db programs will exit with
unreleased buffers and emit warnings like:

cache_purge: shake on cache 0x69e4f0 left 7 nodes!?

Hence we need to unwind the iostack as we shut down.

Signed-off-by: Dave Chinner <dchinner@xxxxxxxxxx>
 db/init.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/db/init.c b/db/init.c
index 4bc048a..8ad21da 100644
--- a/db/init.c
+++ b/db/init.c
@@ -183,9 +183,11 @@ main(
        int     c, i, done = 0;
        char    *input;
        char    **v;
+       int     start_iocur_sp;
        init(argc, argv);
+       start_iocur_sp = iocur_sp;
        for (i = 0; !done && i < ncmdline; i++) {
                v = breakline(cmdline[i], &c);
@@ -209,10 +211,11 @@ main(
-        * make sure that we pop the last buffer context we held so that the
-        * buffer is released before purge the caches during unmount.
+        * Make sure that we pop the all the buffer contexts we hold so that
+        * they are released before we purge the caches during unmount.
-       pop_cur();
+       while (iocur_sp > start_iocur_sp)
+               pop_cur();
        if (x.ddev)

<Prev in Thread] Current Thread [Next in Thread>