diff options
author | Wengang Wang <wen.gang.wang@oracle.com> | 2014-04-03 17:47:09 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-04-03 19:20:56 -0400 |
commit | e228f6439862359f9b26f9d62634e4fce180b54a (patch) | |
tree | 851d13a3446d8a00fad17470c2c33cd00b27c632 /fs/ocfs2/locks.c | |
parent | 6fdb702d6262b18b1b41a35f1f81903b0a2bc2c9 (diff) |
ocfs2: flock: drop cross-node lock when failed locally
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.
[akpm@linux-foundation.org: coding-style fixes]
Signed-off-by: Wengang Wang <wen.gang.wang@oracle.com>
Cc: Joel Becker <jlbec@evilplan.org>
Reviewed-by: Mark Fasheh <mfasheh@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/ocfs2/locks.c')
-rw-r--r-- | fs/ocfs2/locks.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/ocfs2/locks.c b/fs/ocfs2/locks.c index e57c804069ea..6b6d092b0998 100644 --- a/fs/ocfs2/locks.c +++ b/fs/ocfs2/locks.c | |||
@@ -82,6 +82,8 @@ static int ocfs2_do_flock(struct file *file, struct inode *inode, | |||
82 | } | 82 | } |
83 | 83 | ||
84 | ret = flock_lock_file_wait(file, fl); | 84 | ret = flock_lock_file_wait(file, fl); |
85 | if (ret) | ||
86 | ocfs2_file_unlock(file); | ||
85 | 87 | ||
86 | out: | 88 | out: |
87 | mutex_unlock(&fp->fp_mutex); | 89 | mutex_unlock(&fp->fp_mutex); |