Bug 1370921

Summary: Improve robustness by checking result of pthread_mutex_lock()
Product: [Community] GlusterFS Reporter: Niels de Vos <ndevos>
Component: coreAssignee: bugs <bugs>
Status: CLOSED WONTFIX QA Contact:
Severity: low Docs Contact:
Priority: low    
Version: mainlineCC: bugs, moagrawa, pasik
Target Milestone: ---Keywords: EasyFix, Improvement, StudentProject, Tracking, Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
URL: http://www.gluster.org/pipermail/maintainers/2016-August/001296.html
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-11-19 12:44:21 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Niels de Vos 2016-08-28 11:00:04 UTC
Description of problem:
pthread_mutex_lock() can return without successfully locking the mutex. Many calls to this function assume that is always blocks until the locking succeeds.

Version-Release number of selected component (if applicable):
all

How reproducible:
code review

Actual results:
Many data structures use a pthread_mutex for exclusive access and guaranteeing atomic updates. Unfortunately a lot of occurrences do not check the success/fail result of the call to pthread_mutex_lock().

Expected results:
In case pthread_mutex_lock() fails, a retry or abort of the function should be done, depending on the result errno contains.

Additional info:
See 'man 3p pthreead_mutex_lock'.

Comment 1 Mohit Agrawal 2019-11-19 12:44:21 UTC
I don't think we will get some improvement after check the return code of pthread_mutex_(lock|unlock) call
so  I am closing this enhancement. Please feel free to reopen the bug if you think it is useful to improve the performance.

Thanks,
Mohit Agrawal