Skip to content

Commit

Permalink
ocfs2: flock: drop cross-node lock when failed locally
Browse files Browse the repository at this point in the history
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.

[[email protected]: coding-style fixes]
Signed-off-by: Wengang Wang <[email protected]>
Cc: Joel Becker <[email protected]>
Reviewed-by: Mark Fasheh <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Wengang-oracle authored and torvalds committed Apr 3, 2014
1 parent 6fdb702 commit e228f64
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions fs/ocfs2/locks.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ 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);
Expand Down

0 comments on commit e228f64

Please sign in to comment.