* [PATCH] lock_buffer_wq do lock
@ 2003-06-16 13:47 Hugh Dickins
2003-06-16 14:09 ` Suparna Bhattacharya
0 siblings, 1 reply; 2+ messages in thread
From: Hugh Dickins @ 2003-06-16 13:47 UTC (permalink / raw)
To: Andrew Morton; +Cc: Suparna Bhattacharya, linux-kernel
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;
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] lock_buffer_wq do lock
2003-06-16 13:47 [PATCH] lock_buffer_wq do lock Hugh Dickins
@ 2003-06-16 14:09 ` Suparna Bhattacharya
0 siblings, 0 replies; 2+ messages in thread
From: Suparna Bhattacharya @ 2003-06-16 14:09 UTC (permalink / raw)
To: Hugh Dickins; +Cc: Andrew Morton, linux-kernel
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2003-06-16 13:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-06-16 13:47 [PATCH] lock_buffer_wq do lock Hugh Dickins
2003-06-16 14:09 ` Suparna Bhattacharya
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®