ocfs2-devel.oss.oracle.com archive mirror
 help / color / mirror / Atom feed
From: Wengang Wang <wen.gang.wang@oracle.com>
To: ocfs2-devel@oss.oracle.com
Subject: [Ocfs2-devel] [PATCH] [ocfs2]: flock: drop cross-node lock when failed locally
Date: Fri, 28 Feb 2014 15:41:08 +0800	[thread overview]
Message-ID: <1393573268-21342-1-git-send-email-wen.gang.wang@oracle.com> (raw)

ocfs2_do_flock() calls ocfs2_file_lock() to get the cross-node clock and then
call flock_lock_file_wait() to compete with local processes. In case
flock_lock_file_wait() failed, say -ENOMEM, clean up work is not done.
This patch adds the cleanup --drop the cross-node lock which was just granted.

Signed-off-by: Wengang Wang <wen.gang.wang@oracle.com>
---
 fs/ocfs2/locks.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/ocfs2/locks.c b/fs/ocfs2/locks.c
index e57c804..4dc89ab 100644
--- a/fs/ocfs2/locks.c
+++ b/fs/ocfs2/locks.c
@@ -82,6 +82,9 @@ static int ocfs2_do_flock(struct file *file, struct inode *inode,
 	}
 
 	ret = flock_lock_file_wait(file, fl);
+	if (ret) {
+		ocfs2_file_unlock(file);
+	}
 
 out:
 	mutex_unlock(&fp->fp_mutex);
-- 
1.8.3.1

                 reply	other threads:[~2014-02-28  7:41 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1393573268-21342-1-git-send-email-wen.gang.wang@oracle.com \
    --to=wen.gang.wang@oracle.com \
    --cc=ocfs2-devel@oss.oracle.com \
    /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;
as well as URLs for NNTP newsgroup(s).