[ostree] repo: Avoid race condition in threaded checkout with symbolic links
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ostree] repo: Avoid race condition in threaded checkout with symbolic links
- Date: Fri, 12 Oct 2012 15:25:43 +0000 (UTC)
commit e9dd22dc8635b6b05afa66e50dd2ecf422f0042e
Author: Colin Walters <walters verbum org>
Date: Fri Oct 12 11:24:06 2012 -0400
repo: Avoid race condition in threaded checkout with symbolic links
We were inconsistently putting symbolic links into the uncompressed
object cache, which could cause the threaded checkout to get confused.
src/libostree/ostree-repo.c | 16 +++++++++-------
1 files changed, 9 insertions(+), 7 deletions(-)
---
diff --git a/src/libostree/ostree-repo.c b/src/libostree/ostree-repo.c
index 548955b..8fe9934 100644
--- a/src/libostree/ostree-repo.c
+++ b/src/libostree/ostree-repo.c
@@ -3346,6 +3346,7 @@ checkout_file_thread (GSimpleAsyncResult *result,
{
const char *checksum;
OstreeRepo *repo;
+ gboolean is_symlink;
gboolean hardlink_supported;
GError *local_error = NULL;
GError **error = &local_error;
@@ -3362,15 +3363,15 @@ checkout_file_thread (GSimpleAsyncResult *result,
&& g_file_info_get_file_type (checkout_data->source_info) == G_FILE_TYPE_SPECIAL)
goto out;
+ is_symlink = g_file_info_get_file_type (checkout_data->source_info) == G_FILE_TYPE_SYMBOLIC_LINK;
+
checksum = ostree_repo_file_get_checksum ((OstreeRepoFile*)checkout_data->source);
/* We can only do hardlinks in these scenarios */
- if ((checkout_data->repo->mode == OSTREE_REPO_MODE_BARE
- && checkout_data->mode == OSTREE_REPO_CHECKOUT_MODE_NONE)
- || (checkout_data->repo->mode == OSTREE_REPO_MODE_ARCHIVE
- && checkout_data->mode == OSTREE_REPO_CHECKOUT_MODE_USER)
- || (checkout_data->repo->mode == OSTREE_REPO_MODE_ARCHIVE_Z
- && checkout_data->mode == OSTREE_REPO_CHECKOUT_MODE_USER))
+ if (!is_symlink &&
+ ((checkout_data->repo->mode == OSTREE_REPO_MODE_BARE && checkout_data->mode == OSTREE_REPO_CHECKOUT_MODE_NONE)
+ || (checkout_data->repo->mode == OSTREE_REPO_MODE_ARCHIVE && checkout_data->mode == OSTREE_REPO_CHECKOUT_MODE_USER)
+ || (checkout_data->repo->mode == OSTREE_REPO_MODE_ARCHIVE_Z && checkout_data->mode == OSTREE_REPO_CHECKOUT_MODE_USER)))
{
if (!find_loose_for_checkout (checkout_data->repo, checksum, &loose_path,
cancellable, error))
@@ -3379,7 +3380,8 @@ checkout_file_thread (GSimpleAsyncResult *result,
/* Also, if we're archive-z and we didn't find an object, uncompress it now,
* stick it in the cache, and then hardlink to that.
*/
- if (loose_path == NULL
+ if (!is_symlink
+ && loose_path == NULL
&& repo->mode == OSTREE_REPO_MODE_ARCHIVE_Z
&& checkout_data->mode == OSTREE_REPO_CHECKOUT_MODE_USER
&& repo->enable_uncompressed_cache)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]