Toggle navigation
Toggle navigation
This project
Loading...
Sign in
UT
/
clsync
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
redmine
2015-05-21 20:24:11 +0300
1
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
a96d68fcbf9de873f0ad9a00a69e7b6054b12f42
a96d68fc
1 parent
e860a988
[hllock] fixed a potential deadlock based on race condition
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
12 deletions
privileged.c
privileged.c
View file @
a96d68f
...
...
@@ -342,6 +342,7 @@ volatile struct hl_lock *hl_lock_p;
static
inline
void
hl_lock_init
(
volatile
struct
hl_lock
*
hl_lock_p
)
{
debug
(
10
,
""
);
hl_lock_p
->
enabled
=
1
;
hl_lock_p
->
locallock_hl_setstate_ifstate
=
1
;
# ifdef HL_LOCK_TRIES_AUTO
int
i
;
i
=
0
;
...
...
@@ -730,26 +731,17 @@ int hl_setstate_ifstate(int lockid, hllock_state_t stateid_new, hllock_state_t s
volatile
int
*
local_lock_p
=
&
hl_lock_p
->
locallock_hl_setstate_ifstate
;
debug
(
90
,
"%i, 0x%o, 0x%o"
,
lockid
,
stateid_new
,
stateid_old_mask
);
if
(
*
local_lock_p
)
if
(
!
g_atomic_int_dec_and_test
(
local_lock_p
)
)
return
0
;
debug
(
92
,
"%i"
,
*
local_lock_p
);
g_atomic_int_inc
(
local_lock_p
);
debug
(
92
,
"%i"
,
*
local_lock_p
);
if
(
*
local_lock_p
!=
1
)
{
g_atomic_int_dec_and_test
(
local_lock_p
);
return
0
;
}
if
(
!
(
hl_lock_p
->
state
[
lockid
]
&
stateid_old_mask
))
{
g_atomic_int_
dec_and_test
(
local_lock_p
);
g_atomic_int_
inc
(
local_lock_p
);
return
0
;
}
debug
(
50
,
"success"
);
g_atomic_int_set
(
&
hl_lock_p
->
state
[
lockid
],
stateid_new
);
g_atomic_int_dec_and_test
(
local_lock_p
);
#undef local_lock
g_atomic_int_inc
(
local_lock_p
);
return
1
;
}
...
...
Please
register
or
login
to post a comment