return 0;
}
+/* Older versions of libguestfs used to issue separate 'umount_all'
+ * and 'sync' commands just before closing the handle. Since
+ * libguestfs 1.9.7 the library issues this 'internal_autosync'
+ * internal operation instead, allowing more control in the daemon.
+ */
+int
+do_internal_autosync (void)
+{
+ int r;
+
+ r = do_umount_all ();
+
+ sync_disks ();
+
+ return r;
+}
+
/* This is a replacement for sync(2) which is called from
* this file and from other places in the daemon. It works
* on Windows too.
"set autosync mode",
"\
If C<autosync> is true, this enables autosync. Libguestfs will make a
-best effort attempt to run C<guestfs_umount_all> followed by
-C<guestfs_sync> when the handle is closed
+best effort attempt to make filesystems consistent and synchronized
+when the handle is closed
(also if the program exits without closing handles).
This is enabled by default (since libguestfs 1.5.24, previously it was
For more details see L<https://bugzilla.redhat.com/show_bug.cgi?id=599503>
Autosync [see C<guestfs_set_autosync>, this is set by default on
-handles] means that C<guestfs_umount_all> is called when the handle
+handles] can cause C<guestfs_umount_all> to be called when the handle
is closed which can also trigger these issues.");
("rmmountpoint", (RErr, [String "exemptpath"], []), 149, [],
values. These two numbers, multiplied together, give the
resulting size of the minimal filesystem in bytes.");
+ ("internal_autosync", (RErr, [], []), 282, [NotInFish; NotInDocs],
+ [],
+ "internal autosync operation",
+ "\
+This command performs the autosync operation just before the
+handle is closed. You should not call this command directly.
+Instead, use the autosync flag (C<guestfs_set_autosync>) to
+control whether or not this operation is performed when the
+handle is closed.");
+
]
let all_functions = non_daemon_functions @ daemon_functions
guestfs___free_inspect_info (g);
/* Try to sync if autosync flag is set. */
- if (g->autosync && g->state == READY) {
- guestfs_umount_all (g);
- guestfs_sync (g);
- }
+ if (g->autosync && g->state == READY)
+ guestfs_internal_autosync (g);
/* Remove any handlers that might be called back before we kill the
* subprocess.