summaryrefslogtreecommitdiff
path: root/metadata
Commit message (Collapse)AuthorAgeFilesLines
* metatree: Don't g_warning if the running gvfs daemon is olderAlexander Larsson2015-06-081-1/+2
| | | | This was breaking the build for me due to warnings-as-errors
* metadata: Get tree from udev via dbusOndrej Holy2015-06-016-56/+116
| | | | | | | | | | | | We don't want to have dependency on udev in client part of gvfs due to app sandboxing. Thus move the code into the metadata daemon and get tree name via dbus. Common code to get metadata proxy has to be moved in metatree code. Mentioned changes caused that unistd.h is also included in meta-get-tree.c and cause symbol redeclaration error. Variable "pause" has to be renamed to avoid this conflict.
* metadata: remove unused dbus unset apiOndrej Holy2015-04-103-48/+16
| | | | | | | Metadata are unset from client side using dbus set api, therefore dbus unset api and corresponding code isn't necessary. There is only one usage of unset api in private meta-set utility, which is replaced by this patch.
* metadata: remove unused dbus get apiOndrej Holy2015-04-102-99/+0
| | | | | Metadata are read from client side directly using meta_tree_enumerate_keys, therefore dbus api and corresponding code isn't necessary.
* metadata: don't crash if tree write out failedOndrej Holy2015-03-111-3/+43
| | | | | | | | meta_tree_init can fail after we failed to write out an updated tree. Backup corrupted file and start with empty tree to avoid consequent crashes. https://bugzilla.gnome.org/show_bug.cgi?id=598561
* metatree: always clear fd to -1Ondrej Holy2015-03-091-1/+1
| | | | | | | meta_tree_clear clears fd to 0 currently, however it should be set to -1 to avoid risk that fd 0 is closed, when meta_tree_clear is called twice. https://bugzilla.gnome.org/show_bug.cgi?id=598561
* metadata: return if meta_tree_refresh failedOndrej Holy2015-03-041-1/+1
| | | | | | | | | G_UNLOCK is called twice if meta_tree_refresh fails and also concurrent access is possible on cached_trees. However this isn't problem currently, because meta_tree_lookup_by_name is always called with for_write=FALSE (except for meta-set testing utility), so this if statement is never issued. https://bugzilla.gnome.org/show_bug.cgi?id=598561
* daemon: Move random string generation into shared libRoss Lagerwall2015-02-092-29/+6
| | | | | | | Random string generation is used in a few different places, so share the implementation. https://bugzilla.gnome.org/show_bug.cgi?id=738967
* metadata: Free objects on errorRoss Lagerwall2015-01-311-2/+3
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=743653
* metadata: Export skeleton before name is acquiredRoss Lagerwall2015-01-311-26/+19
| | | | | | | Exporting the skeleton after acquiring the name is racy, as documented in the GIO docs for g_bus_own_name. https://bugzilla.gnome.org/show_bug.cgi?id=743653
* metadata: don't crash if meta_tree_init failsOndrej Holy2015-01-063-21/+76
| | | | | | | | | | It can fail when e.g. database file is corrupted or doesn't have correct permissions. This patch also adds warnings to be possible determine reason why initialization failed. It is based on patches from Matthew W. S. Bell and Ross Lagerwall. https://bugzilla.gnome.org/show_bug.cgi?id=598561
* metatree: avoid endless looping when the entry is too largeOndrej Holy2014-09-051-20/+45
| | | | | | | | | | | | | 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: fix misaligned accesses to 64bit dataMichael Cree2014-05-291-2/+23
| | | | | | | | | | | | Unfortunately the journal entries are only aligned to 32 bit boundaries but on some 64-bit RISC architectures (e.g. Alpha) this is insufficient to guarantee correct alignment of 64-bit accesses. This is not a show stopper but does cause inefficient traps to the kernel and pollution of kernel logs. Rather than fix the alignment we provide a helper function, dependent on features specific to gcc, to correctly access a 64-bit datum that may be misaligned. https://bugzilla.gnome.org/show_bug.cgi?id=726456
* Report gvfs version when --version is usedRoss Lagerwall2014-04-111-0/+9
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=727132
* build: replace obsolete INCLUDES by CPPFLAGSOndrej Holy2014-01-171-1/+1
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=722354
* metadata: Fix short journal checkAlexander Larsson2013-06-141-6/+11
| | | | | | | This was reading the size in the wrong place *sizep, not *(sizep-1), plus the out of bounds checks were wrong. https://bugzilla.gnome.org/show_bug.cgi?id=637095
* metadata: Downgrade journal short-read to debugColin Walters2013-05-221-1/+1
| | | | | | | | | | | Because multiple clients can be concurrently writing to the journal, it's possible to see partially written journal entries. Emitting g_warning() here breaks test cases. The real fix would be safe concurrent access to the journal, but that's harder. https://bugzilla.gnome.org/700785
* metadata: Flush all scheduled writeouts on daemon exitTomas Bzatek2013-05-131-6/+40
| | | | | | | | This patch ensures that we safely write all data from journals to metatrees on exit. E.g. if anything happens to session bus or we get replaced by some other instance. https://bugzilla.gnome.org/show_bug.cgi?id=637095
* metadata: Use shorter writeout timeout on NFSTomas Bzatek2013-05-133-3/+16
| | | | | | | Since we've moved journal to a non-volatile storage, let's flush more often to minimize a chance of data loss. https://bugzilla.gnome.org/show_bug.cgi?id=637095
* metadata: Put journal in $XDG_RUNTIME_DIR for shared NFS homedir caseTomas Bzatek2013-05-133-105/+136
| | | | | | | | | | | | | | | | | | | This essentially moves is_on_nfs() from metatree.c in metabuilder.c as the more appropriate place for shared functions. It's used in meta_builder_get_journal_filename() to determine whether to use original metadata directory or temporary $XDG_RUNTIME_DIR location to work around certain NFS issues. The idea behind this change is to have separate journals for every client that is accessing shared homedir. Then the only possible point of conflict is on rotation which is backed up by atomic file rename. Without this, there were multiple metadata daemons writing to the same journal file, overwriting changes to each other and being racy in flush and rotation. There will always be a conflict between clients, overwriting tree file data by flushing their journals. https://bugzilla.gnome.org/show_bug.cgi?id=637095
* metadata: Create new journal if it doesn't existTomas Bzatek2013-05-133-6/+18
| | | | | | | | | | | | | | | With concurrent access of multiple daemons there may be a moment when tree file exists but not the journal file. The daemon can't write anything without journal and is doomed until next rotation. Missing journal file can also happen on system crash etc. This patch tries to create new journal file only when it doesn't exist, other errors still lead to inability to store anything. This will also allow us to have journal file somewhere else, e.g. on a non-persistent storage. https://bugzilla.gnome.org/show_bug.cgi?id=637095
* metadata: Be more resistive to broken journal filesTomas Bzatek2013-05-131-0/+12
| | | | | | | | | | | | | | | | | | | In shared NFS homedir case with multiple clients writing to the same mmaped journal file data can get easily corrupted. The daemon iterates over a journal file on flush taking in account variable entry size and advances according to the data read. However in certain case invalid data are read making us to jump out of bounds. In case of zero entry size we would stand at the same place leading to infinite loop. This patch checks if the indicated entry size is at least the size of the structure we're getting the size from (it's a first element) and breaks the iteration cycle if it's not. This may lead to partial data loss on flush as we don't process the rest of the journal file. Old data from existing tree file will be preserved of course, only few recent changes would get lost. https://bugzilla.gnome.org/show_bug.cgi?id=637095
* metadata: Force tree re-read after successful flushTomas Bzatek2013-05-131-6/+8
| | | | | | | | | | | | | | | | | | | | | | | | | Once we flush the journal and write new tree file we need to re-read it to refresh internal data structures (and mmap data from the right file). We originally left this work on meta_tree_refresh_locked() and meta_tree_needs_rereading() respectively where we checked the rotated bit. In detail, metabuilder wrote a new temp tree file, then explicitly opened the current (old) one, wrote the rotated bit and atomically replaced the temp file. Then the metadata daemon having mmapped the old file detected the rotated bit and scheduled journal and tree file reopen+reread. However in concurrent environment like NFS homedir where multiple metadata daemons are handling the same database we may run in a race and not getting the rotated bit detected properly. This led to an infinite loop between meta_journal_add_entry() - meta_tree_flush_locked() - meta_tree_refresh_locked() - meta_journal_add_entry() since we had full journal, didn't detect the rotation and since the files were already unlinked, there was no force to break that loop. This patch forces tree file re-read after successful flush to prevent this issue. https://bugzilla.gnome.org/show_bug.cgi?id=637095
* Fix compiler warningsBastien Nocera2013-04-021-1/+1
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=695834
* Use g_list_free_full() where applicableTomas Bzatek2013-01-171-14/+6
|
* Remove calls to g_type_init(), bump GLib required versionColin Walters2012-10-302-4/+0
| | | | | | See http://git.gnome.org/browse/glib/commit/?id=2002479c02fa6e468fc3f67ddc663657a52ebde8 https://bugzilla.gnome.org/show_bug.cgi?id=687236
* portability: fix is_on_nfs on OpenBSDAntoine Jacoutot2012-10-011-0/+4
| | | | | | | Under OpenBSD, the statfs structure does not support "f_type". So, use "f_fstypename" to check for NFS. https://bugzilla.gnome.org/show_bug.cgi?id=685126
* gdbus: Fix srcdir != builddir and make the build more quietTomas Bzatek2012-07-311-2/+2
|
* gdbus: Remove last traces of libdbus in metadata sourcesTomas Bzatek2012-07-313-5/+1
|
* Update the Address of the FSFFelix Möller2012-07-304-8/+8
| | | | | | | | | | | | | | | Updating the address of the FSF. This has been done by: while read file; do sed -i 's:59 Temple Place:51 Franklin Street:' $file sed -i 's:Suite 330:Fifth Floor:' $file sed -i 's:02111-1307:02110-1301:' $file done https://bugzilla.gnome.org/show_bug.cgi?id=656598 Signed-off-by: Tomas Bzatek <tbzatek@redhat.com>
* gdbus: Construct proxies without connecting signals and propertiesTomas Bzatek2012-07-201-1/+1
| | | | | Use G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS and G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES flags where applicable.
* build: Fix srcdir != builddirColin Walters2012-06-061-1/+1
|
* Port volume monitoring and metadata to GDBusTomas Bzatek2012-06-044-539/+365
| | | | | | | | This is a complete port of volume monitors and metadata to GDBus. The (private) d-bus API has been mostly preserved except of MountOp methods. No difference in functionality should be observed.
* Adapt to GLib 2.31 deprecations and thread API changesMatthias Clasen2011-10-211-30/+30
| | | | | | | GStaticMutex and GStaticRWLock have been replaced by GMutex and GRWLock, and g_thread_init() is no longer needed. https://bugzilla.gnome.org/show_bug.cgi?id=661148
* Use g_atomic_int_add instead of deprecated g_atomic_int_exchange_and_add.Kjartan Maraas2011-10-211-1/+1
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=659815
* Purge hardcoded -DG_DISABLE_DEPRECATEDColin Walters2011-10-121-1/+1
| | | | | Especially now that deprecations are proper gcc warnings, no need to hardcode this.
* metadata: Avoid passing NULL to strchr()Tomas Bzatek2011-08-151-1/+2
| | | | Found by Coverity Scan analysis
* Cleanups and fixes for compiler warningsKjartan Maraas2011-03-171-10/+6
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=641856
* Rename gdbusutils.h to avoid conflict with GIO1.6.2Matthias Clasen2010-05-272-2/+2
| | | | This makes gvfs build with recent glib again, see bug #619537
* Use g_poll instead of poll in metatree.cChristian Kellner2010-02-141-4/+3
| | | | Patch by "paul <ephraim_owns@hotmail.com>" Fixes bug #60468.
* Correctly dup strings in meta_tree_lookup_stringvAlexander Larsson2009-12-011-1/+1
| | | | Also, make sure to free that in all callers.
* Fix warningAlexander Larsson2009-12-011-1/+1
|
* If there are no mtimes in the file, use 0 as mtime baseAlexander Larsson2009-11-191-1/+2
| | | | | | Before we used to store -1 (0xffffffff) as the mtime base in this case. This value is not used if there are no mtimes though, so this is more like a cosmetic change.
* Don't store write() return val in unsigned variableAlexander Larsson2009-11-191-1/+1
| | | | | | The conversion to unsigned means we failed to recognize errors, since if (ret < 0) was never hit. This is the suspected cause for data loss in bug 598561.
* Fsync the directory when rotating the metadataChristian Kellner2009-11-181-2/+13
| | | | | This is needed so we never end up having a stable file with the rotated bit set. Should fix bug #600057.
* Reread metadata only when the inodes are differentChristian Kellner2009-11-181-0/+14
| | | | This will protect against bugs where the stable file has the rotated bug set (which should never happen but see bug #600057)
* Use $(AM_V_GEN) for more silent buildChristian Persch2009-10-091-1/+1
| | | | Closes bug #597104
* Fix leak in metadata codeAlexander Larsson2009-09-081-0/+1
|
* Fix leakAlexander Larsson2009-09-081-1/+4
| | | | Need to free /proc/fd/mountinfo contents after reading it.
* Fix memory leaksAlexander Larsson2009-09-071-0/+3
| | | | Found these with valgrind