mirror of
https://github.com/kdave/btrfs-progs
synced 2024-12-23 14:45:19 +00:00
Btrfs-progs: scrub: don't call unlock if pthread_mutex_lock fails
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>
This commit is contained in:
parent
87d1676b22
commit
5d48302236
@ -776,7 +776,7 @@ static int scrub_write_progress(pthread_mutex_t *m, const char *fsid,
|
||||
ret = pthread_mutex_lock(m);
|
||||
if (ret) {
|
||||
err = -ret;
|
||||
goto out;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
ret = pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &old);
|
||||
@ -808,6 +808,7 @@ out:
|
||||
if (ret && !err)
|
||||
err = -ret;
|
||||
|
||||
fail:
|
||||
ret = pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, &old);
|
||||
if (ret && !err)
|
||||
err = -ret;
|
||||
|
Loading…
Reference in New Issue
Block a user