From: Peter Zijlstra <a.p.zijlstra@chello.nl>
To: Rogier Wolff <R.E.Wolff@BitWizard.nl>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Linus Torvalds <torvalds@linux-foundation.org>,
Florin Iucha <florin@iucha.net>,
Trond Myklebust <Trond.Myklebust@netapp.com>,
Adrian Bunk <bunk@stusta.de>,
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 0/4] 2.6.21-rc7 NFS writes: fix a series of issues
Date: Sun, 29 Apr 2007 22:09:38 +0200 [thread overview]
Message-ID: <1177877378.28223.41.camel@twins> (raw)
In-Reply-To: <20070429194129.GA747@bitwizard.nl>
On Sun, 2007-04-29 at 21:41 +0200, Rogier Wolff wrote:
> On Tue, Apr 17, 2007 at 10:37:38PM -0700, Andrew Morton wrote:
> > Florin, can we please see /proc/meminfo as well?
> >
> > Also the result of `echo m > /proc/sysrq-trigger'
>
> Hi,
>
> It's been a while since this thread died out, but maybe I'm
> having the same problem. Networking, large part of memory is
> buffering writes.....
>
> In my case I'm using NBD.
>
> Oh,
>
> /sys/block/nbd0/stat gives:
> 636 88 5353 1700 991 19554 162272 63156 43 1452000 61802352
> I put some debugging stuff in nbd, and it DOES NOT KNOW about the
> 43 requests that the io scheduler claims are in flight at the
> driver....
AFAIK nbd is a tad broken; the following patch used to fix it, although
not in the proper way. Hence it never got merged.
There is a race where the plug state of the device queue gets confused,
which causes requests to just sit on the queue, without further action.
---
Subject: nbd: request_fn fixup
Dropping the queue_lock opens up a nasty race, fix this race by
plugging the device when we're done.
Also includes a small cleanup.
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
CC: Daniel Phillips <phillips@google.com>
CC: Pavel Machek <pavel@ucw.cz>
---
drivers/block/nbd.c | 67 ++++++++++++++++++++++++++++++++++++++--------------
1 file changed, 49 insertions(+), 18 deletions(-)
Index: linux-2.6/drivers/block/nbd.c
===================================================================
--- linux-2.6.orig/drivers/block/nbd.c 2006-09-07 17:20:52.000000000 +0200
+++ linux-2.6/drivers/block/nbd.c 2006-09-07 17:35:05.000000000 +0200
@@ -97,20 +97,24 @@ static const char *nbdcmd_to_ascii(int c
}
#endif /* NDEBUG */
-static void nbd_end_request(struct request *req)
+static void __nbd_end_request(struct request *req)
{
int uptodate = (req->errors == 0) ? 1 : 0;
- request_queue_t *q = req->q;
- unsigned long flags;
dprintk(DBG_BLKDEV, "%s: request %p: %s\n", req->rq_disk->disk_name,
req, uptodate? "done": "failed");
- spin_lock_irqsave(q->queue_lock, flags);
- if (!end_that_request_first(req, uptodate, req->nr_sectors)) {
+ if (!end_that_request_first(req, uptodate, req->nr_sectors))
end_that_request_last(req, uptodate);
- }
- spin_unlock_irqrestore(q->queue_lock, flags);
+}
+
+static void nbd_end_request(struct request *req)
+{
+ request_queue_t *q = req->q;
+
+ spin_lock_irq(q->queue_lock);
+ __nbd_end_request(req);
+ spin_unlock_irq(q->queue_lock);
}
/*
@@ -435,10 +439,8 @@ static void do_nbd_request(request_queue
mutex_unlock(&lo->tx_lock);
printk(KERN_ERR "%s: Attempted send on closed socket\n",
lo->disk->disk_name);
- req->errors++;
- nbd_end_request(req);
spin_lock_irq(q->queue_lock);
- continue;
+ goto error_out;
}
lo->active_req = req;
@@ -463,10 +465,13 @@ static void do_nbd_request(request_queue
error_out:
req->errors++;
- spin_unlock(q->queue_lock);
- nbd_end_request(req);
- spin_lock(q->queue_lock);
+ __nbd_end_request(req);
}
+ /*
+ * q->queue_lock has been dropped, this opens up a race
+ * plug the device to close it.
+ */
+ blk_plug_device(q);
return;
}
next prev parent reply other threads:[~2007-04-29 20:09 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1176736734.6761.45.camel@heimdal.trondhjem.org>
[not found] ` <Pine.LNX.4.64.0704160904560.5473@woody.linux-foundation.org>
[not found] ` <1176740307.6761.56.camel@heimdal.trondhjem.org>
[not found] ` <1176741408.6761.62.camel@heimdal.trondhjem.org>
[not found] ` <20070416125905.GA2769@iucha.net>
[not found] ` <1176792399.3035.30.camel@twins>
[not found] ` <1176796503.3035.33.camel@twins>
2007-04-17 17:01 ` nfs: desynchronized value of nfs_i.ncommit OGAWA Hirofumi
2007-04-17 22:44 ` Trond Myklebust
2007-04-18 1:19 ` [PATCH 0/4] 2.6.21-rc7 NFS writes: fix a series of issues Trond Myklebust
2007-04-18 1:29 ` [PATCH 1/4] NFS: clean up the unstable write code Trond Myklebust
2007-04-18 1:29 ` [PATCH 2/4] NFS: Don't clear PG_writeback until after we've processed unstable writes Trond Myklebust
2007-04-18 1:29 ` [PATCH 3/4] NFS: Fix the 'desynchronized value of nfs_i.ncommit' error Trond Myklebust
2007-04-18 1:29 ` [PATCH 4/4] NFS: Fix race in nfs_set_page_dirty Trond Myklebust
2007-04-18 2:58 ` [PATCH 0/4] 2.6.21-rc7 NFS writes: fix a series of issues Andrew Morton
2007-04-18 3:06 ` Trond Myklebust
2007-04-18 3:30 ` Florin Iucha
2007-04-18 3:54 ` Trond Myklebust
2007-04-18 4:07 ` Florin Iucha
2007-04-18 4:13 ` Andrew Morton
2007-04-18 4:30 ` Florin Iucha
2007-04-18 5:14 ` Linus Torvalds
2007-04-18 5:26 ` Florin Iucha
2007-04-18 5:37 ` Andrew Morton
2007-04-18 12:38 ` Florin Iucha
2007-04-18 13:15 ` Trond Myklebust
2007-04-18 13:42 ` Florin Iucha
2007-04-18 14:11 ` Trond Myklebust
2007-04-18 14:17 ` Florin Iucha
2007-04-18 14:19 ` Trond Myklebust
2007-04-19 1:52 ` Florin Iucha
2007-04-19 2:45 ` Trond Myklebust
2007-04-19 4:38 ` Success! Was: " Florin Iucha
2007-04-19 15:12 ` Chuck Lever
2007-04-19 15:17 ` Trond Myklebust
2007-04-19 15:50 ` Florin Iucha
2007-04-19 16:09 ` Trond Myklebust
2007-04-19 19:58 ` Failure! " Florin Iucha
2007-04-19 21:30 ` Trond Myklebust
2007-04-19 21:49 ` Florin Iucha
2007-04-20 13:30 ` Success! Was: " Florin Iucha
2007-04-20 13:37 ` Trond Myklebust
2007-04-20 13:51 ` Florin Iucha
2007-04-18 14:14 ` Florin Iucha
2007-04-29 19:41 ` Rogier Wolff
2007-04-29 20:09 ` Peter Zijlstra [this message]
2007-04-18 11:38 ` Trond Myklebust
2007-04-18 9:54 ` OGAWA Hirofumi
2007-04-18 8:19 ` Peter Zijlstra
2007-04-18 16:41 ` Peter Zijlstra
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1177877378.28223.41.camel@twins \
--to=a.p.zijlstra@chello.nl \
--cc=R.E.Wolff@BitWizard.nl \
--cc=Trond.Myklebust@netapp.com \
--cc=akpm@linux-foundation.org \
--cc=bunk@stusta.de \
--cc=florin@iucha.net \
--cc=hirofumi@mail.parknet.co.jp \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.