lkml.org 
[lkml]   [2003]   [Jun]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] lock_buffer_wq do lock
On Mon, Jun 16, 2003 at 02:47:32PM +0100, Hugh Dickins wrote:
> I've twice got fs/buffer.c:2668 submit_bh BUG_ON(!buffer_locked(bh)):
> when called from sync_dirty_buffer which clearly does the lock_buffer.
> My suspicion falls on lock_buffer_wq (whereas __lock_page_wq looks OK).
>
> I'm leaving a test running,
> can't judge until tomorrow whether this is indeed the fix to that.
>
> Hugh
>
> --- 2.5.71-mm1/include/linux/buffer_head.h Sun Jun 15 12:36:11 2003
> +++ linux/include/linux/buffer_head.h Mon Jun 16 14:13:25 2003
> @@ -291,9 +291,11 @@
>
> static inline int lock_buffer_wq(struct buffer_head *bh, wait_queue_t *wait)
> {
> - if (test_set_buffer_locked(bh))
> - return __wait_on_buffer_wq(bh, wait);
> -
> + while (test_set_buffer_locked(bh)) {
> + int ret = __wait_on_buffer_wq(bh, wait);
> + if (ret)
> + return ret;
> + }
> return 0;
> }

You are right - this should be a while loop mirroring what
lock_buffer does.

Actually, I probably ought to just avoid the dual paths,
and make lock_buffer a wrapper for lock_buffer_wq -- less
chances of divergence between the two.

Regards
Suparna

--
Suparna Bhattacharya (suparna@in.ibm.com)
Linux Technology Center
IBM Software Labs, India

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:36    [W:1.192 / U:0.008 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site