search for: gl_lock_lock

Displaying 20 results from an estimated 45 matches for "gl_lock_lock".

Did you mean: gl_lock_unlock
2018 May 02
0
[PATCH v2] fuse: mount_local: Fix crash when called from Java binding.
...files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/fuse.c b/lib/fuse.c index 9731db962..82bddec00 100644 --- a/lib/fuse.c +++ b/lib/fuse.c @@ -1047,7 +1047,7 @@ guestfs_impl_mount_local (guestfs_h *g, const char *localmountpoint, /* Set g->localmountpoint in the handle. */ gl_lock_lock (mount_local_lock); - g->localmountpoint = localmountpoint; + g->localmountpoint = safe_strdup (g, localmountpoint); gl_lock_unlock (mount_local_lock); return 0; @@ -1090,6 +1090,7 @@ guestfs_impl_mount_local_run (guestfs_h *g) guestfs_int_free_fuse (g); gl_lock_lock (mount_...
2018 May 02
1
[RFC] fuse: mount_local: Fix crash when called from Java binding
...1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/fuse.c b/lib/fuse.c index 9731db962..7df765b81 100644 --- a/lib/fuse.c +++ b/lib/fuse.c @@ -1047,7 +1047,7 @@ guestfs_impl_mount_local (guestfs_h *g, const char *localmountpoint, /* Set g->localmountpoint in the handle. */ gl_lock_lock (mount_local_lock); - g->localmountpoint = localmountpoint; + g->localmountpoint = safe_strdup(g, localmountpoint); gl_lock_unlock (mount_local_lock); return 0; -- 2.17.0
2014 May 29
2
[PATCH] library: per-handle locking support
...eturn NULL; + guestfs___per_handle_lock_add (g); + g->state = CONFIG; g->conn = NULL; @@ -305,6 +307,8 @@ guestfs_close (guestfs_h *g) return; } + guestfs___per_handle_lock_remove (g); + /* Remove the handle from the handles list. */ if (g->close_on_exit) { gl_lock_lock (handles_lock); diff --git a/src/locking.c b/src/locking.c new file mode 100644 index 0000000..2a35fce --- /dev/null +++ b/src/locking.c @@ -0,0 +1,162 @@ +/* libguestfs + * Copyright (C) 2009-2014 Red Hat Inc. + * + * This library is free software; you can redistribute it and/or + * modify it unde...
2017 Mar 08
1
Re: [PATCH v4 1/9] lib/osinfo.c: Extract xml processing into a callback
...const struct guestfs_isoinfo *isoinfo, > - const struct osinfo **osinfo_ret) > + const struct osinfo **osinfo_ret) Extra indentation change. > { > size_t i; > > /* We only need to lock the database when reading it for the first time. */ > gl_lock_lock (osinfo_db_lock); > if (osinfo_db_size == 0) { > - if (read_osinfo_db (g) == -1) { > + if (read_osinfo_db (g, read_osinfo_db_xml, NULL) == -1) { > + /* Fatal error: free any database entries which have been read, and > + * mark the database as having a permanent e...
2017 Jun 27
0
[PATCH v3 3/5] threads: Use thread-local storage for errors.
...= error_data->error_cb_stack; p != NULL; p = next_p) { + next_p = p->next; + free (p); + } + free (error_data); +} + +/* Free all the error_data structs created for a particular handle. */ +void +guestfs_int_free_error_data_list (guestfs_h *g) +{ + struct error_data *p, *next_p; + + gl_lock_lock (g->error_data_list_lock); + + for (p = g->error_data_list; p != NULL; p = next_p) { + next_p = p->next; + free_error_data (p); + } + + g->error_data_list = NULL; + + gl_lock_unlock (g->error_data_list_lock); +} + +/* Get thread-specific error_data struct. Create it if nec...
2015 Jun 06
0
[PATCH 3/5] threads: Use thread-local storage for errors.
...= error_data->error_cb_stack; p != NULL; p = next_p) { + next_p = p->next; + free (p); + } + free (error_data); +} + +/* Free all the error_data structs created for a particular handle. */ +void +guestfs_int_free_error_data_list (guestfs_h *g) +{ + struct error_data *p, *next_p; + + gl_lock_lock (g->error_data_list_lock); + + for (p = g->error_data_list; p != NULL; p = next_p) { + next_p = p->next; + free_error_data (p); + } + + g->error_data_list = NULL; + + gl_lock_unlock (g->error_data_list_lock); +} + +/* Get thread-specific error_data struct. Create it if nec...
2018 Feb 28
0
[PATCH] lib: Don't abort if a signal handler calls exit(2) during a guestfs_* function.
...h as if the program exits during a - * libguestfs operation. - */ - abort (); - } free (g); } @@ -492,7 +509,17 @@ shutdown_backend (guestfs_h *g, int check_for_errors) static void close_handles (void) { - while (handles) guestfs_close (handles); + guestfs_h *g, *g_next; + + gl_lock_lock (handles_lock); + g = handles; + handles = NULL; + while (g) { + g_next = g->next; + do_close (g, 1); + g = g_next; + } + gl_lock_unlock (handles_lock); } int -- 2.13.2
2017 Mar 07
0
[PATCH v4 1/9] lib/osinfo.c: Extract xml processing into a callback
...uct osinfo *); */ int guestfs_int_osinfo_map (guestfs_h *g, const struct guestfs_isoinfo *isoinfo, - const struct osinfo **osinfo_ret) + const struct osinfo **osinfo_ret) { size_t i; /* We only need to lock the database when reading it for the first time. */ gl_lock_lock (osinfo_db_lock); if (osinfo_db_size == 0) { - if (read_osinfo_db (g) == -1) { + if (read_osinfo_db (g, read_osinfo_db_xml, NULL) == -1) { + /* Fatal error: free any database entries which have been read, and + * mark the database as having a permanent error. + */ + i...
2017 Mar 23
0
[PATCH v5 01/10] lib/osinfo.c: Extract xml processing into a callback
...uct osinfo *); */ int guestfs_int_osinfo_map (guestfs_h *g, const struct guestfs_isoinfo *isoinfo, - const struct osinfo **osinfo_ret) + const struct osinfo **osinfo_ret) { size_t i; /* We only need to lock the database when reading it for the first time. */ gl_lock_lock (osinfo_db_lock); if (osinfo_db_size == 0) { - if (read_osinfo_db (g) == -1) { + if (read_osinfo_db (g, read_osinfo_db_xml, NULL) == -1) { + /* Fatal error: free any database entries which have been read, and + * mark the database as having a permanent error. + */ + i...
2017 Apr 12
0
[PATCH v6 01/10] lib/osinfo.c: Extract xml processing into a callback
...uct osinfo *); */ int guestfs_int_osinfo_map (guestfs_h *g, const struct guestfs_isoinfo *isoinfo, - const struct osinfo **osinfo_ret) + const struct osinfo **osinfo_ret) { size_t i; /* We only need to lock the database when reading it for the first time. */ gl_lock_lock (osinfo_db_lock); if (osinfo_db_size == 0) { - if (read_osinfo_db (g) == -1) { + if (read_osinfo_db (g, read_osinfo_db_xml, NULL) == -1) { + /* Fatal error: free any database entries which have been read, and + * mark the database as having a permanent error. + */ + i...
2017 Feb 10
0
[PATCH v3 04/10] lib/osinfo.c: Extract xml processing into a callback
...uct osinfo *); */ int guestfs_int_osinfo_map (guestfs_h *g, const struct guestfs_isoinfo *isoinfo, - const struct osinfo **osinfo_ret) + const struct osinfo **osinfo_ret) { size_t i; /* We only need to lock the database when reading it for the first time. */ gl_lock_lock (osinfo_db_lock); if (osinfo_db_size == 0) { - if (read_osinfo_db (g) == -1) { + if (read_osinfo_db (g, read_osinfo_db_xml, NULL) == -1) { + /* Fatal error: free any database entries which have been read, and + * mark the database as having a permanent error. + */ + i...
2012 Feb 15
2
[PATCH 0/2] Make appliance building thread-safe (RHBZ#790721).
These two patches make appliance building thread-safe. The first adds a test which easily demonstrates the problem. The second fixes the issue. For more information see Ian McLeod's analysis of the bug here: https://bugzilla.redhat.com/show_bug.cgi?id=790528#c5 Rich.
2017 Mar 07
0
[PATCH v4 2/9] lib: extract osinfo DB traversing API
...OS found, the osinfo_ret pointer has been filled in + */ +int +guestfs_int_osinfo_map (guestfs_h *g, const struct guestfs_isoinfo *isoinfo, + const struct osinfo **osinfo_ret) +{ + size_t i; + + /* We only need to lock the database when reading it for the first time. */ + gl_lock_lock (osinfo_db_lock); + if (osinfo_db_size == 0) { + if (read_osinfo_db (g, read_osinfo_db_xml, NULL) == -1) { + /* Fatal error: free any database entries which have been read, and + * mark the database as having a permanent error. + */ + if (osinfo_db_size > 0) { +...
2017 Feb 10
0
[PATCH v3 05/10] lib: extract osinfo DB traversing API
...OS found, the osinfo_ret pointer has been filled in + */ +int +guestfs_int_osinfo_map (guestfs_h *g, const struct guestfs_isoinfo *isoinfo, + const struct osinfo **osinfo_ret) +{ + size_t i; + + /* We only need to lock the database when reading it for the first time. */ + gl_lock_lock (osinfo_db_lock); + if (osinfo_db_size == 0) { + if (read_osinfo_db (g, read_osinfo_db_xml, NULL) == -1) { + /* Fatal error: free any database entries which have been read, and + * mark the database as having a permanent error. + */ + if (osinfo_db_size > 0) { +...
2017 Jun 19
0
[PATCH v7 2/9] lib: extract osinfo DB traversing API
...OS found, the osinfo_ret pointer has been filled in + */ +int +guestfs_int_osinfo_map (guestfs_h *g, const struct guestfs_isoinfo *isoinfo, + const struct osinfo **osinfo_ret) +{ + size_t i; + + /* We only need to lock the database when reading it for the first time. */ + gl_lock_lock (osinfo_db_lock); + if (osinfo_db_size == 0) { + if (read_osinfo_db (g, read_osinfo_db_xml, NULL) == -1) { + /* Fatal error: free any database entries which have been read, and + * mark the database as having a permanent error. + */ + if (osinfo_db_size > 0) { +...
2017 Apr 12
0
[PATCH v6 02/10] lib: extract osinfo DB traversing API
...OS found, the osinfo_ret pointer has been filled in + */ +int +guestfs_int_osinfo_map (guestfs_h *g, const struct guestfs_isoinfo *isoinfo, + const struct osinfo **osinfo_ret) +{ + size_t i; + + /* We only need to lock the database when reading it for the first time. */ + gl_lock_lock (osinfo_db_lock); + if (osinfo_db_size == 0) { + if (read_osinfo_db (g, read_osinfo_db_xml, NULL) == -1) { + /* Fatal error: free any database entries which have been read, and + * mark the database as having a permanent error. + */ + if (osinfo_db_size > 0) { +...
2015 Jun 16
5
[PATCH threads v2 0/5] Add support for thread-safe handle.
Previous discussion here: https://www.redhat.com/archives/libguestfs/2015-June/thread.html#00048 v2: - Use a cleanup handler to release the lock. - Rebase to upstream. Note I have not fixed the problem(s) with error handling (patch 3).
2012 Mar 29
3
[PATCH v3] New APIs: mount-local, mount-local-run and umount-local using FUSE
This changes the proposed API slightly. Previously 'mount-local' generating a 'mounted' event when the filesystem was ready, and from the 'mounted' event you had to effectively do a fork. Now, 'mount-local' just initializes the mountpoint and you have to call 'mount-local-run' to enter the FUSE main loop. Between these calls you can do a fork or whatever
2017 Jun 27
9
[PATCH v3 0/5] threads: Add support for thread-safe handle.
Previously posted in 2015: v1: https://www.redhat.com/archives/libguestfs/2015-June/msg00048.html v2: https://www.redhat.com/archives/libguestfs/2015-June/msg00118.html I have rebased and tidied up the patches, fixing a few spelling mistakes, but they are broadly the same as before. I also ran all the tests, which pass. As with the previous versions, this makes a change to the API, where you
2017 Feb 07
0
[PATCH v2 3/7] mllib: expose libosinfo DB reading functions in mllib
...OS found, the osinfo_ret pointer has been filled in + */ +int +guestfs_int_osinfo_map (guestfs_h *g, const struct guestfs_isoinfo *isoinfo, + const struct osinfo **osinfo_ret) +{ + size_t i; + + /* We only need to lock the database when reading it for the first time. */ + gl_lock_lock (osinfo_db_lock); + if (osinfo_db_size == 0) { + if (read_osinfo_db (g, read_osinfo_db_xml, NULL) == -1) { + /* Fatal error: free any database entries which have been read, and + * mark the database as having a permanent error. + */ + if (osinfo_db_size > 0) { +...