* [Ocfs2-devel] [PATCH] [ocfs2]: flock: drop cross-node lock when failed locally
@ 2014-02-28 7:41 Wengang Wang
0 siblings, 0 replies; only message in thread
From: Wengang Wang @ 2014-02-28 7:41 UTC (permalink / raw)
To: ocfs2-devel
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
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2014-02-28 7:41 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-28 7:41 [Ocfs2-devel] [PATCH] [ocfs2]: flock: drop cross-node lock when failed locally Wengang Wang
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).