Rakesh Pandit
2014-Mar-14 23:49 UTC
[PATCH] 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. Signed-off-by: Rakesh Pandit <rakesh@tuxera.com> --- cmds-scrub.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmds-scrub.c b/cmds-scrub.c index 128537b..ca11fb5 100644 --- a/cmds-scrub.c +++ b/cmds-scrub.c @@ -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; -- 1.8.5.3 -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html