diff options
author | Xavi Hernandez <xhernandez@users.noreply.github.com> | 2021-02-24 16:44:55 +0100 |
---|---|---|
committer | Xavi Hernandez <xhernandez@gmail.com> | 2021-04-12 15:03:39 +0200 |
commit | 7feaeeabd3ad0b1410e78f584b7c5bbfb41ae0e6 (patch) | |
tree | 0ef8df3c78ce80ae17e49c376a3662dbca943728 /xlators/features/index | |
parent | 779f86d860e1ab98ee1c9bfc5214c9bd526a98ed (diff) | |
download | glusterfs-7feaeeabd3ad0b1410e78f584b7c5bbfb41ae0e6.tar.gz glusterfs-7feaeeabd3ad0b1410e78f584b7c5bbfb41ae0e6.tar.xz glusterfs-7feaeeabd3ad0b1410e78f584b7c5bbfb41ae0e6.zip |
cluster/afr: Fix race in lockinfo (f)getxattr
* cluster/afr: Fix race in lockinfo (f)getxattr
A shared dictionary was updated outside the lock after having updated
the number of remaining answers. This means that one thread may be
processing the last answer and unwinding the request before another
thread completes updating the dict.
Thread 1 Thread 2
LOCK()
call_cnt-- (=1)
UNLOCK()
LOCK()
call_cnt-- (=0)
UNLOCK()
update_dict(dict)
if (call_cnt == 0) {
STACK_UNWIND(dict);
}
update_dict(dict)
if (call_cnt == 0) {
STACK_UNWIND(dict);
}
The updates from thread 1 are lost.
This patch also reduces the work done inside the locked region and
reduces code duplication.
Fixes: #2161
Change-Id: Idc0d34ab19ea6031de0641f7b05c624d90fac8fa
Signed-off-by: Xavi Hernandez <xhernandez@redhat.com>
Diffstat (limited to 'xlators/features/index')
0 files changed, 0 insertions, 0 deletions