summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/generator.ml8
-rw-r--r--src/guestfs.c4
2 files changed, 9 insertions, 3 deletions
diff --git a/src/generator.ml b/src/generator.ml
index ae640e2c..9a9c168e 100755
--- a/src/generator.ml
+++ b/src/generator.ml
@@ -339,8 +339,12 @@ return the default path.");
"set autosync mode",
"\
If C<autosync> is true, this enables autosync. Libguestfs will make a
-best effort attempt to run C<guestfs_sync> when the handle is closed
-(also if the program exits without closing handles).");
+best effort attempt to run C<guestfs_umount_all> followed by
+C<guestfs_sync> when the handle is closed
+(also if the program exits without closing handles).
+
+This is disabled by default (except in guestfish where it is
+enabled by default).");
("get_autosync", (RBool "autosync", []), -1, [],
[],
diff --git a/src/guestfs.c b/src/guestfs.c
index 05c02f3f..c2d58e82 100644
--- a/src/guestfs.c
+++ b/src/guestfs.c
@@ -267,8 +267,10 @@ guestfs_close (guestfs_h *g)
fprintf (stderr, "closing guestfs handle %p (state %d)\n", g, g->state);
/* Try to sync if autosync flag is set. */
- if (g->autosync && g->state == READY)
+ if (g->autosync && g->state == READY) {
+ guestfs_umount_all (g);
guestfs_sync (g);
+ }
/* Remove any handlers that might be called back before we kill the
* subprocess.