search for: is_locked

Displaying 20 results from an estimated 55 matches for "is_locked".

2019 May 30
3
[PATCH libnbd 0/2] Avoid lock and error overhead on some calls.
This works. I'm in the middle of testing whether there is any noticable benefit. Rich.
2019 Jun 05
0
[PATCH libnbd 1/4] lib: Move nbd_aio_is_* function impls to separate source file.
...nternal.h \ + is-state.c \ nbd-protocol.h \ poll.c \ protocol.c \ diff --git a/lib/aio.c b/lib/aio.c index a129af2..38e0318 100644 --- a/lib/aio.c +++ b/lib/aio.c @@ -48,84 +48,6 @@ nbd_unlocked_aio_notify_write (struct nbd_handle *h) return nbd_internal_run (h, notify_write); } -/* NB: is_locked = false, may_set_error = false. */ -int -nbd_unlocked_aio_is_created (struct nbd_handle *h) -{ - return h->state == STATE_START; -} - -static int -is_connecting_group (enum state_group group) -{ - switch (group) { - case GROUP_TOP: - return 0; - case GROUP_CONNECT: - case GROUP_CONNECT_T...
2019 Jun 05
9
[PATCH libnbd 0/4] lib: Atomically update h->state.
I need to think about this patch series a bit more, but it does at least pass the tests. Rich.
2019 Jun 05
0
[PATCH libnbd 2/4] lib: Split nbd_aio_is_* functions into internal.
...t nbd_internal_errno_of_nbd_error (uint32_t error); extern const char *nbd_internal_name_of_nbd_cmd (uint16_t type); diff --git a/lib/is-state.c b/lib/is-state.c index 5ed2ee9..55d103b 100644 --- a/lib/is-state.c +++ b/lib/is-state.c @@ -26,11 +26,12 @@ #include "internal.h" -/* NB: is_locked = false, may_set_error = false. */ -int -nbd_unlocked_aio_is_created (struct nbd_handle *h) +/* Internal functions to test state or groups of states. */ + +bool +nbd_internal_is_state_created (enum state state) { - return h->state == STATE_START; + return state == STATE_START; } static in...
2009 Oct 19
2
Old application very slow
...n of user 1007 Primary group is 1003 and contains 4 supplementary groups Group[ 0]: 1003 Group[ 1]: 100 Group[ 2]: 1007 Group[ 3]: 1008 [2009/10/19 14:45:28, 5] smbd/uid.c:change_to_user(322) change_to_user uid=(0,1007) gid=(0,1003) [2009/10/19 14:45:28, 10] locking/locking.c:is_locked(98) is_locked: optimisation - exclusive oplock on file ACE/TIKKLOK/PCBNR.NTX [2009/10/19 14:45:28, 10] locking/locking.c:is_locked(136) is_locked: flavour = WINDOWS_LOCK brl start=0 len=12 unlocked for fnum 6473 file ACE/TIKKLOK/PCBNR.NTX [2009/10/19 14:45:28, 10] smbd/fileio.c:read_file(104...
2019 Jun 08
0
[PATCH libnbd v3] lib: Atomically update h->state when leaving the locked region.
...oes nothing else with the handle. + (* Most functions must take a lock. The only known exceptions are: + * - functions which return a constant (eg. [nbd_supports_uri]) + * - functions which {b only} read from the atomic + * [get_public_state] and do nothing else with the handle. *) is_locked : bool; (* Most functions can call set_error. For functions which are @@ -2449,11 +2450,11 @@ let generate_lib_states_c () = pr " enum state next_state = %s;\n" state_enum; pr "\n"; pr " r = _enter_%s (h, &next_state, blocked);\n" state_e...
2019 Jun 05
1
[PATCH libnbd v2] lib: Atomically update h->state when leaving the locked region.
...e a lock. The only known exception is - * for a function which {b only} reads from the atomic [h->state] - * field and does nothing else with the handle. + * for a function which {b only} reads from the atomic + * [get_public_state] field and does nothing else with the handle. *) is_locked : bool; (* Most functions can call set_error. For functions which are @@ -2418,11 +2418,11 @@ let generate_lib_states_c () = pr " enum state next_state = %s;\n" state_enum; pr "\n"; pr " r = _enter_%s (h, &next_state, blocked);\n" state_e...
2004 Aug 30
3
cannot access files after update samba 3.0.5 -> 3.0.6 (Redhat 6.2)
...this with debug level 10: ... [2004/08/27 18:29:01, 3] smbd/process.c:switch_message(887) switch message SMBreadX (pid 15427) conn 0x833b760 [2004/08/27 18:29:01, 4] smbd/uid.c:change_to_user(193) change_to_user: Skipping user change - already user [2004/08/27 18:29:01, 10] locking/locking.c:is_locked(89) is_locked: brl start=0 len=16384 unlocked for file wk/xx [2004/08/27 18:29:01, 10] locking/posix.c:is_posix_locked(697) is_posix_locked: File wk/xx, offset = 0, count = 16384, type = READ [2004/08/27 18:29:01, 10] locking/posix.c:posix_lock_in_range(633) posix_lock_in_range: offset_out...
2019 Jun 08
4
[PATCH libnbd v3] lib: Atomically update h->state when leaving the locked region.
v1 was here: https://www.redhat.com/archives/libguestfs/2019-June/thread.html#00055 v2 was here: https://www.redhat.com/archives/libguestfs/2019-June/thread.html#00067 v3: - Fix atomicly -> atomically in commit message. - Fix a comment. - Fix TOCTTOU: There is now an inline function generated called <name>_is_permitted_state, and this is called twice, first outside the
2019 Jun 04
2
[PATCH libnbd] generator: Fix race condition when validating h->state.
...a/generator/generator b/generator/generator index ea6f739..8068762 100755 --- a/generator/generator +++ b/generator/generator @@ -2820,10 +2820,9 @@ let generate_lib_api_c () = pr " nbd_internal_reset_error (\"nbd_%s\");\n" name; pr "\n" ); + if is_locked then + pr " pthread_mutex_lock (&h->lock);\n"; if permitted_states <> [] then ( - pr " /* We can check the state outside the handle lock because the\n"; - pr " * the state is atomic.\n"; - pr " */\n"; let tes...
2006 Jul 05
1
File attribute problem 3.0.23
...ter writing. The latter one doesn't succeed if the writer != file owner. Dos filemode is enabled and manually setting is fine. Samba is 3.0.23RC3. Client is XP/SP2. Seems to loose the connection before setting the bit and a new smbd is spawn. Daniel [2006/07/05 09:32:36, 10] locking/locking.c:is_locked(96) is_locked: optimisation - exclusive oplock on file Dev/Inst.ism [2006/07/05 09:32:36, 10] locking/locking.c:is_locked(134) is_locked: flavour = WINDOWS_LOCK brl start=0 len=5429 unlocked for fnum 10866 file Dev/Inst.ism [2006/07/05 09:32:36, 8] smbd/dosmode.c:dos_mode(326) dos_mode: Dev/I...
2019 Jun 05
1
[libnbd PATCH] api: Add nbd_supports_tls
...er this is the case with C<nbd_supports_tls>."; }; "aio_connect_unix", { @@ -1876,6 +1898,15 @@ The release number is incremented for each release along a particular branch."; }; + "supports_tls", { + default_call with + args = []; ret = RBool; is_locked = false; may_set_error = false; + shortdesc = "return true if libnbd was compiled with support for TLS"; + longdesc = "\ +Returns true if libnbd was compiled with gnutls which is required +to support TLS encryption, or false if not. See C<nbd_set_tls>."; + }; +...
2019 Jun 05
0
[PATCH libnbd 3/4] lib: Add set_state / get_state macros.
...44 --- a/lib/is-state.c +++ b/lib/is-state.c @@ -104,40 +104,40 @@ nbd_internal_is_state_closed (enum state state) int nbd_unlocked_aio_is_created (struct nbd_handle *h) { - return nbd_internal_is_state_created (h->state); + return nbd_internal_is_state_created (get_state (h)); } /* NB: is_locked = false, may_set_error = false. */ int nbd_unlocked_aio_is_connecting (struct nbd_handle *h) { - return nbd_internal_is_state_connecting (h->state); + return nbd_internal_is_state_connecting (get_state (h)); } /* NB: is_locked = false, may_set_error = false. */ int nbd_unlocked_aio_is...
2008 Nov 20
0
strange problem with kernel oplocks
...5756 file ????????????? ??? ???/??????????/???????? ???????-2005?/Podschet_Sosn_ispr_2005/??? I. ?????1 ?????. ?????.????/??????? ? ??.1,2,3,4,10/ris.2.1.Tekt.wmf [2008/11/19 11:32:28, 10] locking/locking.c:is_locked(137) is_locked: flavour = WINDOWS_LOCK brl start=330004 len=24 unlocked for fnum 5756 file ????????????? ??? ???/??????????/???????? ???????-2005?/Podschet_Sos n_ispr_2005/??? I. ?????1 ?????. ????...
2019 Jun 04
0
Re: [PATCH libnbd] generator: Fix race condition when validating h->state.
...ator > index ea6f739..8068762 100755 > --- a/generator/generator > +++ b/generator/generator > @@ -2820,10 +2820,9 @@ let generate_lib_api_c () = > pr " nbd_internal_reset_error (\"nbd_%s\");\n" name; > pr "\n" > ); > + if is_locked then > + pr " pthread_mutex_lock (&h->lock);\n"; > if permitted_states <> [] then ( > - pr " /* We can check the state outside the handle lock because the\n"; > - pr " * the state is atomic.\n"; > - pr " *...
2019 Jun 05
2
Re: [PATCH libnbd 4/4] lib: Atomically update h->state when leaving the locked region.
..., I think you're still missing a change at the beginning of the wrapper that grabs the lock to do the state check after the lock. > let argnames = List.flatten (List.map name_of_arg args) in > List.iter (pr ", %s") argnames; > pr ");\n"; > - if is_locked then > - pr " pthread_mutex_unlock (&h->lock);\n"; > + if is_locked then ( > + pr " if (h->state != h->next_state)\n"; > + pr " h->state = h->next_state;\n"; > + pr " pthread_mutex_unlock (&h->l...
2019 Jun 05
1
Re: [PATCH libnbd 2/4] lib: Split nbd_aio_is_* functions into internal.
...ndle *h) > { > - > - if (nbd_unlocked_aio_is_ready (h) || > - nbd_unlocked_aio_is_processing (h)) { > + if (nbd_internal_is_state_ready (h->state) || > + nbd_internal_is_state_processing (h->state)) { Likewise safe for multiple h->state reads. > +/* NB: is_locked = false, may_set_error = false. */ > +int > +nbd_unlocked_aio_is_created (struct nbd_handle *h) > +{ > + return nbd_internal_is_state_created (h->state); > +} > + > +/* NB: is_locked = false, may_set_error = false. */ > +int > +nbd_unlocked_aio_is_connecting (struct n...
2019 Jun 03
3
[PATCH libnbd] api: nbd_get_version, nbd_supports_uri and nbd_get_package_name.
...r +++ b/generator/generator @@ -1823,6 +1823,49 @@ can be used for debugging or troubleshooting, but you should not rely on the state of connections since it may change in future versions."; }; + + "get_package_name", { + default_call with + args = []; ret = RConstString; is_locked = false; may_set_error = false; + shortdesc = "return the name of the library"; + longdesc = "\ +Returns the name of the library, always C<\"libnbd\"> unless +the library was modified with another name at compile time."; + }; + + "get_version",...
2019 Jul 25
2
[libnbd PATCH] generator: Let nbd_aio_get_direction return unsigned
...(* can be called in the START state *) | Connecting (* can be called when connecting/handshaking *) @@ -2013,7 +2014,7 @@ Do not do anything else with the file descriptor."; "aio_get_direction", { default_call with - args = []; ret = RInt; is_locked = false; may_set_error = false; + args = []; ret = RUInt; is_locked = false; may_set_error = false; shortdesc = "return the read or write direction"; longdesc = "\ Return the current direction of this connection, which means @@ -3040,13 +3041,15 @@ let () = (* !may_...
2020 Jul 31
1
[libnbd PATCH] generator: Trace return even when in wrong state
...if may_set_error then ( - pr "\n"; - print_trace_leave ret; - pr "\n" - ); + pr "\n"; if !need_out_label then pr " out:\n"; + if may_set_error then ( + print_trace_leave ret; + pr "\n" + ); if is_locked then ( pr " if (h->public_state != get_next_state (h))\n"; pr " h->public_state = get_next_state (h);\n"; -- 2.28.0