If pthread_mutex_lock fails (rare but fix it anyway), don't call
pthread_mutex_unlock on mutex.
Rationale being that if pthread_mutex_lock fails pthread_mutex_unlock
will always fail and overwrite actual error value in err.
Signed-off-by: Rakesh Pandit <rakesh@tuxera.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <clm@fb.com>
ret = pthread_mutex_lock(m);
if (ret) {
err = -ret;
- goto out;
+ goto fail;
}
ret = pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &old);
if (ret && !err)
err = -ret;
+fail:
ret = pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, &old);
if (ret && !err)
err = -ret;