Patchwork jffs2: use mutex_is_locked() in __jffs2_flush_wbuf()

login
register
mail settings
Submitter Alexey Khoroshilov
Date June 27, 2011, 8:21 p.m.
Message ID <1309206090-2805-1-git-send-email-khoroshilov@ispras.ru>
Download mbox | patch
Permalink /patch/102266/
State New
Headers show

Comments

Alexey Khoroshilov - June 27, 2011, 8:21 p.m.
Use a helper to test if a mutex is held instead of a hack with
mutex_trylock().

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
---
 fs/jffs2/wbuf.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
Artem Bityutskiy - June 29, 2011, 6:05 a.m.
On Tue, 2011-06-28 at 00:21 +0400, Alexey Khoroshilov wrote:
> Use a helper to test if a mutex is held instead of a hack with
> mutex_trylock().
> 
> Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>

Pushed to l2-mtd-2.6.git, thanks.

Patch

diff --git a/fs/jffs2/wbuf.c b/fs/jffs2/wbuf.c
index 4515bea..a10fb24 100644
--- a/fs/jffs2/wbuf.c
+++ b/fs/jffs2/wbuf.c
@@ -578,8 +578,7 @@  static int __jffs2_flush_wbuf(struct jffs2_sb_info *c, int pad)
 	if (!jffs2_is_writebuffered(c))
 		return 0;
 
-	if (mutex_trylock(&c->alloc_sem)) {
-		mutex_unlock(&c->alloc_sem);
+	if (!mutex_is_locked(&c->alloc_sem)) {
 		printk(KERN_CRIT "jffs2_flush_wbuf() called with alloc_sem not locked!\n");
 		BUG();
 	}