diff --git a/SOURCES/gvfs-1.21.92-metatree-avoid-endless-looping-when-the-entry-is-too.patch b/SOURCES/gvfs-1.21.92-metatree-avoid-endless-looping-when-the-entry-is-too.patch new file mode 100644 index 0000000..c8d9f4e --- /dev/null +++ b/SOURCES/gvfs-1.21.92-metatree-avoid-endless-looping-when-the-entry-is-too.patch @@ -0,0 +1,141 @@ +From 46474abab3ff89a34cbe7fd7eb1ceba50d83d331 Mon Sep 17 00:00:00 2001 +From: Ondrej Holy +Date: Fri, 29 Aug 2014 10:46:25 +0200 +Subject: [PATCH] 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 file changed, 45 insertions(+), 20 deletions(-) + +diff --git a/metadata/metatree.c b/metadata/metatree.c +index 43766c8..7b59c4a 100644 +--- a/metadata/metatree.c ++++ b/metadata/metatree.c +@@ -2361,13 +2361,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); +@@ -2401,13 +2406,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); +@@ -2441,13 +2451,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); +@@ -2479,13 +2494,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); +@@ -2518,13 +2538,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); +-- +1.9.3 + diff --git a/SPECS/gvfs.spec b/SPECS/gvfs.spec index 054e730..05826fc 100644 --- a/SPECS/gvfs.spec +++ b/SPECS/gvfs.spec @@ -1,7 +1,7 @@ Summary: Backends for the gio framework in GLib Name: gvfs Version: 1.16.4 -Release: 7%{?dist} +Release: 8%{?dist} License: GPLv3 and LGPLv2+ Group: System Environment/Libraries URL: http://www.gtk.org @@ -51,6 +51,10 @@ Patch5: gvfs-1.16.5-MTP-Fix-compilation-warning.patch Patch4: gvfs-1.16.4_translation_updates.patch +# Bug 1163743 - gvfsd-metadata causes high cpu and disk usage +# https://bugzilla.redhat.com/show_bug.cgi?id=1163743 +Patch6: gvfs-1.21.92-metatree-avoid-endless-looping-when-the-entry-is-too.patch + Obsoletes: gnome-mount <= 0.8 Obsoletes: gnome-mount-nautilus-properties <= 0.8 Obsoletes: gvfs-obexftp < 1.16.3-3 @@ -177,6 +181,7 @@ file services. %patch3 -p1 -b .fix-mtp-crashes %patch4 -p2 -b .translation-updates %patch5 -p1 -b .fix-mtp-warning +%patch6 -p1 -b .avoid-metadata-looping %build # Needed for gvfs-0.2.1-archive-integration.patch @@ -373,6 +378,10 @@ update-desktop-database >&/dev/null || : %{_datadir}/gvfs/remote-volume-monitors/goa.monitor %changelog + +* Tue Jan 6 2015 Ondrej Holy - 1.16.4-8 +- Avoid endless looping when the metatree entry is too large (#1163743) + * Mon Feb 24 2014 Matthias Clasen - 1.16.4-7 - Rebuild against newer libcdio Resolves: #1069206