Skip to content

Commit

Permalink
jffs2: use mutex_is_locked() in __jffs2_flush_wbuf()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Alexey Khoroshilov authored and Artem Bityutskiy committed Sep 11, 2011
1 parent 9786f6e commit 51b11e3
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions fs/jffs2/wbuf.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down

0 comments on commit 51b11e3

Please sign in to comment.