From: Rakesh Pandit <rakesh@tuxera.com>
To: <linux-btrfs@vger.kernel.org>
Subject: [PATCH] Btrfs-progs: scrub: don't call unlock if pthread_mutex_lock fails
Date: Sat, 15 Mar 2014 01:49:45 +0200 [thread overview]
Message-ID: <20140314234943.GA28451@localhost.localdomain> (raw)
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
next reply other threads:[~2014-03-14 23:49 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-14 23:49 Rakesh Pandit [this message]
2014-03-15 0:29 ` [PATCH] Btrfs-progs: scrub: don't call unlock if pthread_mutex_lock fails Rakesh Pandit
2014-03-17 12:44 ` David Sterba
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140314234943.GA28451@localhost.localdomain \
--to=rakesh@tuxera.com \
--cc=linux-btrfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox