Skip to contentSkip to conversation

ocfs2: flock: drop cross-node lock when failed locally

PATCH New akpm at linux-foundation.org 3 participants 3 messages Mar 19, 2014 – Mar 31, 2014 OCFS2

lore
Share & tools
lore
#0 lore raw

PATCH 2/8 ocfs2: flock: drop cross-node lock when failed locally

From: Wengang Wang <[email protected]>
Subject: 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 at linux-foundation.org: coding-style fixes]
Cc Joel Becker <[email protected]>
Cc Mark Fasheh <[email protected]>

---

 fs/ocfs2/locks.c |    2 ++
 1 file changed, 2 insertions(+)
fs/ocfs2/locks.c renamed from fs/ocfs2/locks.c~ocfs2-flock-drop-cross-node-lock-when-failed-locally +2 -0
diff -puN fs/ocfs2/locks.c~ocfs2-flock-drop-cross-node-lock-when-failed-locally fs/ocfs2/locks.c
@@ -82,6 +82,8 @@ static int ocfs2_do_flock(struct file *f
 	}
 
 	ret = flock_lock_file_wait(file, fl);
+	if (ret)
+		ocfs2_file_unlock(file);
 
 out:
 	mutex_unlock(&fp->fp_mutex);

_

#1 lore raw

PATCH 2/8 ocfs2: flock: drop cross-node lock when failed locally

Quoted 8 lines · Andrew Morton

From: Wengang Wang <[email protected]>
Subject: 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.

Out of curiousity was this a bug someone hit, or did you catch this via code review.

	--Mark

--
Mark Fasheh

#2 lore raw

PATCH 2/8 ocfs2: flock: drop cross-node lock when failed locally

Hi Mark,

I find it by code review.

thanks,
wengang

? 2014?03?31? 09:30, Mark Fasheh ??:

Quoted 22 lines · Andrew Morton
Quoted 8 lines

From: Wengang Wang <[email protected]>
Subject: 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.

Out of curiousity was this a bug someone hit, or did you catch this via code review.

	--Mark

--
Mark Fasheh

_______________________________________________
Ocfs2-devel mailing list
Ocfs2-devel at oss.oracle.com
https://oss.oracle.com/mailman/listinfo/ocfs2-devel