jffs2: use mutex_is_locked() in __jffs2_flush_wbuf()
authorAlexey Khoroshilov <khoroshilov@ispras.ru>
Mon, 27 Jun 2011 20:21:30 +0000 (00:21 +0400)
committerArtem Bityutskiy <artem.bityutskiy@intel.com>
Sun, 11 Sep 2011 12:02:14 +0000 (15:02 +0300)
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>
Signed-off-by: Artem Bityutskiy <dedekind1@gmail.com>
fs/jffs2/wbuf.c

index 4515bea..a10fb24 100644 (file)
@@ -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();
        }