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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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;
 
 	pushfile(stdin);
 	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(
 
 close_devices:
 	/*
-	 * 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();
 	libxfs_umount(mp);
 	if (x.ddev)
 		libxfs_device_close(x.ddev);
-- 
1.8.4.rc3

_______________________________________________
xfs mailing list
xfs@xxxxxxxxxxx
http://oss.sgi.com/mailman/listinfo/xfs




[Index of Archives]     [Linux XFS Devel]     [Linux Filesystem Development]     [Filesystem Testing]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux