[gvfs/gnome-3-10] metatree: avoid endless looping when the entry is too large
- From: Ondrej Holy <oholy src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gvfs/gnome-3-10] metatree: avoid endless looping when the entry is too large
- Date: Mon, 10 Nov 2014 10:57:00 +0000 (UTC)
commit b7c2a99631a4c4d5953fdfa452ef2698422fdbb2
Author: Ondrej Holy <oholy redhat com>
Date: Fri Aug 29 10:46:25 2014 +0200
metatree: avoid endless looping when the entry is too large
When an application tries to save a larger key-value pair than the size
of the journal, it triggers the journal to be flushed to make space for
the entry and the operation is then retried, but it never fits, and the
loop continues forever.
This patch removes the endless retry loop and retries the operation
only once after the flush. We know that there isn't enough space for
the entry if it fails after the flush.
https://bugzilla.gnome.org/show_bug.cgi?id=637095
metadata/metatree.c | 65 +++++++++++++++++++++++++++++++++++---------------
1 files changed, 45 insertions(+), 20 deletions(-)
---
diff --git a/metadata/metatree.c b/metadata/metatree.c
index a6b3183..932182d 100644
--- a/metadata/metatree.c
+++ b/metadata/metatree.c
@@ -2340,13 +2340,18 @@ meta_tree_unset (MetaTree *tree,
entry = meta_journal_entry_new_unset (mtime, path, key);
res = TRUE;
- retry:
if (!meta_journal_add_entry (tree->journal, entry))
{
if (meta_tree_flush_locked (tree))
- goto retry;
-
- res = FALSE;
+ {
+ if (!meta_journal_add_entry (tree->journal, entry))
+ {
+ g_warning ("meta_tree_unset: entry is bigger then the size of journal\n");
+ res = FALSE;
+ }
+ }
+ else
+ res = FALSE;
}
g_string_free (entry, TRUE);
@@ -2380,13 +2385,18 @@ meta_tree_set_string (MetaTree *tree,
entry = meta_journal_entry_new_set (mtime, path, key, value);
res = TRUE;
- retry:
if (!meta_journal_add_entry (tree->journal, entry))
{
if (meta_tree_flush_locked (tree))
- goto retry;
-
- res = FALSE;
+ {
+ if (!meta_journal_add_entry (tree->journal, entry))
+ {
+ g_warning ("meta_tree_set_string: entry is bigger then the size of journal\n");
+ res = FALSE;
+ }
+ }
+ else
+ res = FALSE;
}
g_string_free (entry, TRUE);
@@ -2420,13 +2430,18 @@ meta_tree_set_stringv (MetaTree *tree,
entry = meta_journal_entry_new_setv (mtime, path, key, value);
res = TRUE;
- retry:
if (!meta_journal_add_entry (tree->journal, entry))
{
if (meta_tree_flush_locked (tree))
- goto retry;
-
- res = FALSE;
+ {
+ if (!meta_journal_add_entry (tree->journal, entry))
+ {
+ g_warning ("meta_tree_set_stringv: entry is bigger then the size of journal\n");
+ res = FALSE;
+ }
+ }
+ else
+ res = FALSE;
}
g_string_free (entry, TRUE);
@@ -2458,13 +2473,18 @@ meta_tree_remove (MetaTree *tree,
entry = meta_journal_entry_new_remove (mtime, path);
res = TRUE;
- retry:
if (!meta_journal_add_entry (tree->journal, entry))
{
if (meta_tree_flush_locked (tree))
- goto retry;
-
- res = FALSE;
+ {
+ if (!meta_journal_add_entry (tree->journal, entry))
+ {
+ g_warning ("meta_tree_remove: entry is bigger then the size of journal\n");
+ res = FALSE;
+ }
+ }
+ else
+ res = FALSE;
}
g_string_free (entry, TRUE);
@@ -2497,13 +2517,18 @@ meta_tree_copy (MetaTree *tree,
entry = meta_journal_entry_new_copy (mtime, src, dest);
res = TRUE;
- retry:
if (!meta_journal_add_entry (tree->journal, entry))
{
if (meta_tree_flush_locked (tree))
- goto retry;
-
- res = FALSE;
+ {
+ if (!meta_journal_add_entry (tree->journal, entry))
+ {
+ g_warning ("meta_tree_copy: entry is bigger then the size of journal\n");
+ res = FALSE;
+ }
+ }
+ else
+ res = FALSE;
}
g_string_free (entry, TRUE);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]