[PATCH 6/8] xfsprogs: xfs_db: unmount fs before exiting

Alex Elder
2011-11-10T20:35:44Z

From: Kevan Rehm <kfr@sgi.com>

The main routine calls libxfs_mount() via init(), but never calls
libxfs_umount() at the end of the program so there could be
filesystem changes queued which never get flushed to disk. This
adds the missing libxfs_umount() call.

Signed-off-by: Alex Elder <aelder@sgi.com>
---
db/init.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/db/init.c b/db/init.c
index 2a5ef2b..5effaf9 100644
--- a/db/init.c
+++ b/db/init.c
@@ -170,7 +170,7 @@ main(
}
if (cmdline) {
xfree(cmdline);
- return exitcode;
+ goto end;
}

while (!done) {
@@ -181,5 +181,9 @@ main(
done = command(c, v);
doneline(input, v);
}
+
+end:
+ libxfs_umount(mp);
+
return exitcode;
}
--
1.7.6.4