sysroot: Drop an unnecessary fsync

While looking at a slow update issue (which I'm guessing is
unpredictable I/O latency in an OpenStack instance), I noticed
in one of the traces we were inside a fsync here.

Dropping the fsync here is just another of a long series of unwinding
them - we `syncfs()` the sysroot fd and `/boot` and we have a big
`sync()` anyways.

Closes: #508
Approved by: jlebon
This commit is contained in:
Colin Walters authored and Atomic Bot committed 2016-09-14 19:14:46 +00:00
1 parent 4f736ac33e
commit f2b6afd2df
3 files changed
+5 -76

No files matched your search

-67
View File
@@ -314,73 +314,6 @@ ot_gfile_ensure_unlinked (GFile *path,
return TRUE;
}
/**
* ot_util_ensure_directory_and_fsync:
* @dir: Path to a directory
* @cancellable: Cancellable
* @error: Error
*
* Create @dir (and all intermediate parent directories), ensuring
* that all entries are on disk.
*/
gboolean
ot_util_ensure_directory_and_fsync (GFile *dir,
GCancellable *cancellable,
GError **error)
{
gboolean ret = FALSE;
glnx_fd_close int parentfd = -1;
const char *basename = glnx_basename (gs_file_get_path_cached (dir));
g_autoptr(GFile) parent = g_file_get_parent (dir);
again:
parentfd = open (gs_file_get_path_cached (parent),
O_RDONLY | O_NONBLOCK | O_DIRECTORY | O_CLOEXEC);
if (parentfd == -1)
{
if (errno == ENOENT)
{
if (!ot_util_ensure_directory_and_fsync (parent, cancellable, error))
goto out;
goto again;
}
else
{
int errsv = errno;
g_set_error (error, G_IO_ERROR, g_io_error_from_errno (errsv),
"opendir: %s", g_strerror (errsv));
goto out;
}
}
if (mkdirat (parentfd, basename, 0777) == -1)
{
if (errno == EEXIST)
{
;
}
else
{
int errsv = errno;
g_set_error (error, G_IO_ERROR, g_io_error_from_errno (errsv),
"mkdirat: %s", g_strerror (errsv));
goto out;
}
}
if (fsync (parentfd) == -1)
{
int errsv = errno;
g_set_error (error, G_IO_ERROR, g_io_error_from_errno (errsv),
"fsync: %s", g_strerror (errsv));
goto out;
}
ret = TRUE;
out:
return ret;
}
#if !GLIB_CHECK_VERSION(2, 44, 0)
gboolean
-4
View File
@@ -85,10 +85,6 @@ gboolean ot_gfile_ensure_unlinked (GFile *path,
GCancellable *cancellable,
GError **error);
gboolean ot_util_ensure_directory_and_fsync (GFile *dir,
GCancellable *cancellable,
GError **error);
#if !GLIB_CHECK_VERSION(2, 44, 0)
gboolean
ot_file_enumerator_iterate (GFileEnumerator *direnum,