From: Tejun Heo <htejun@gmail.com>
To: Chris Frey <cdfrey@foursquare.net>
Cc: Jens Axboe <jaxboe@fusionio.com>,
Richard Weinberger <richard@nod.at>,
Andrew Morton <akpm@linux-foundation.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"jdike@addtoit.com" <jdike@addtoit.com>,
"user-mode-linux-devel@lists.sourceforge.net"
<user-mode-linux-devel@lists.sourceforge.net>,
"user-mode-linux-user@lists.sourceforge.net"
<user-mode-linux-user@lists.sourceforge.net>,
"janjaap@bos.nl" <janjaap@bos.nl>,
"geert@linux-m68k.org" <geert@linux-m68k.org>,
"martin.petersen@oracle.com" <martin.petersen@oracle.com>,
"adobriyan@gmail.com" <adobriyan@gmail.com>,
"syzop@vulnscan.org" <syzop@vulnscan.org>
Subject: Re: [PATCH 1/1] um: ubd: Fix data corruption
Date: Tue, 05 Oct 2010 10:23:19 +0200 [thread overview]
Message-ID: <4CAAE077.9010500@gmail.com> (raw)
In-Reply-To: <20101004195152.GA31583@foursquare.net>
On 10/04/2010 09:51 PM, Chris Frey wrote:
> On Mon, Oct 04, 2010 at 06:37:36PM +0200, Tejun Heo wrote:
>> Hello, sorry about chiming in later. I was off last week.
>
> No problem, I'm eager to test patches to fix this.
>
>> I think we're on the right track. The problem with Jens' patch was
>> that it didn't consider the fact that blk_end_request() now internally
>> updates the current position of the request, so if restart happens
>> after some of part of the request is complete it will end up adding
>> the offsets multiple times. I think slightly modifying it to track
>> the current position instead of offset should do it. Chris, can you
>> please try the following patch and see whether the problem goes away?
>
> Unfortunately, this patch does not fix it for me. I applied your patch
> to kernel 2.6.35.5, and got the usual error:
>
> EXT3-fs error (device ubda): ext3_lookup: deleted inode referenced: 566188
>
> Lots of them, actually.
Hmmmm, can you please give a shot at the following one? Thank you.
diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c
index 1bcd208..0435d21 100644
--- a/arch/um/drivers/ubd_kern.c
+++ b/arch/um/drivers/ubd_kern.c
@@ -163,6 +163,7 @@ struct ubd {
struct scatterlist sg[MAX_SG];
struct request *request;
int start_sg, end_sg;
+ sector_t rq_pos;
};
#define DEFAULT_COW { \
@@ -187,6 +188,7 @@ struct ubd {
.request = NULL, \
.start_sg = 0, \
.end_sg = 0, \
+ .rq_pos = 0, \
}
/* Protected by ubd_lock */
@@ -1228,7 +1230,6 @@ static void do_ubd_request(struct request_queue *q)
{
struct io_thread_req *io_req;
struct request *req;
- sector_t sector;
int n;
while(1){
@@ -1239,12 +1240,12 @@ static void do_ubd_request(struct request_queue *q)
return;
dev->request = req;
+ dev->rq_pos = blk_rq_pos(req);
dev->start_sg = 0;
dev->end_sg = blk_rq_map_sg(q, req, dev->sg);
}
req = dev->request;
- sector = blk_rq_pos(req);
while(dev->start_sg < dev->end_sg){
struct scatterlist *sg = &dev->sg[dev->start_sg];
@@ -1256,10 +1257,10 @@ static void do_ubd_request(struct request_queue *q)
return;
}
prepare_request(req, io_req,
- (unsigned long long)sector << 9,
+ (unsigned long long)dev->rq_pos << 9,
sg->offset, sg->length, sg_page(sg));
- sector += sg->length >> 9;
+ dev->rq_pos += sg->length >> 9;
n = os_write_file(thread_fd, &io_req,
sizeof(struct io_thread_req *));
if(n != sizeof(struct io_thread_req *)){
next prev parent reply other threads:[~2010-10-05 8:21 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-28 21:47 [PATCH 1/1] um: ubd: Fix data corruption Richard Weinberger
2010-09-28 22:00 ` Andrew Morton
2010-09-28 22:13 ` Richard Weinberger
2010-09-28 22:52 ` Chris Frey
2010-09-28 23:10 ` Jens Axboe
2010-09-29 0:48 ` Janjaap Bos
2010-09-29 1:29 ` Chris Frey
2010-09-29 5:21 ` Jens Axboe
2010-09-29 6:34 ` Chris Frey
2010-10-04 16:37 ` Tejun Heo
2010-10-04 19:51 ` Chris Frey
2010-10-05 8:23 ` Tejun Heo [this message]
2010-10-05 20:31 ` Chris Frey
2010-10-07 7:58 ` Jens Axboe
2010-10-07 20:23 ` Chris Frey
2010-10-14 13:14 ` Tejun Heo
2010-10-14 14:20 ` richard -rw- weinberger
2010-10-14 18:03 ` Tejun Heo
2010-10-14 21:24 ` Richard Weinberger
2010-10-15 4:47 ` Chris Frey
2010-10-02 17:27 ` richard -rw- weinberger
2010-09-29 3:30 ` Chris Frey
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=4CAAE077.9010500@gmail.com \
--to=htejun@gmail.com \
--cc=adobriyan@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=cdfrey@foursquare.net \
--cc=geert@linux-m68k.org \
--cc=janjaap@bos.nl \
--cc=jaxboe@fusionio.com \
--cc=jdike@addtoit.com \
--cc=linux-kernel@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=richard@nod.at \
--cc=syzop@vulnscan.org \
--cc=user-mode-linux-devel@lists.sourceforge.net \
--cc=user-mode-linux-user@lists.sourceforge.net \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox