redmine

[hllock] [dangerous commit] Temporary fix of non-priv side HL

Issue: https://github.com/xaionaro/clsync/issues/140

Non-priv thread/process eat 100% while priv thread is working. This
commit is a temporary fix of the problem.
... ... @@ -215,6 +215,8 @@ expire-after:20M\n\
// Upper limit
#define HL_LOCK_AUTO_LIMIT_HIGH (1<<20)
#define HL_LOCK_NONPRIV_TRIES HL_LOCK_AUTO_LIMIT_HIGH
//#define READWRITE_SIGNALLING
#define CG_DEV_CONSOLE "c 5:1"
... ... @@ -241,4 +243,5 @@ expire-after:20M\n\
#define BSM_QUEUE_LENGTH_MAX (1024*1024)
#define GIO_QUEUE_LENGTH_MAX BSM_QUEUE_LENGTH_MAX
#endif
... ...
... ... @@ -1227,12 +1227,19 @@ static inline int privileged_action(
debug(10, "Waiting the privileged thread/process to get prepared for signal");
# ifdef HL_LOCKS
if (hl_lock_p->enabled) {
while (!hl_isanswered(HLLOCK_HANDLER))
long long counter = 0;
while (!hl_isanswered(HLLOCK_HANDLER)) {
if (!helper_isalive_cache) {
debug(1, "The privileged thread/process is dead (#0). Ignoring the command.");
rc = ENOENT;
goto privileged_action_end;
}
if (++counter > HL_LOCK_NONPRIV_TRIES) {
sleep(SLEEP_SECONDS);
counter = 0;
}
}
} else {
# endif
critical_on(!helper_isalive_cache);
... ...