From: Andrew Morton <akpm@osdl.org>
To: Thomas Themel <themel@iwoars.net>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Device-backed loop broken in 2.6.0-test2?
Date: Wed, 6 Aug 2003 17:40:43 -0700 [thread overview]
Message-ID: <20030806174043.27fd674a.akpm@osdl.org> (raw)
In-Reply-To: <20030806224022.GA3741@iwoars.net>
Thomas Themel <themel@iwoars.net> wrote:
>
> it seems that device backed loopback is broken in the 2.6.0-test2 series.
doh.
We're currently setting PF_READAHEAD across a call into the page allocator.
We end up calling writepage() with PF_READAHEAD set and the block layer
aborts the writes, resulting in corrupted data.
It only seems to bite with loop-on-blockdev for some reason.
And add a warning in ll_rw_block() to catch any more occurrences.
drivers/block/ll_rw_blk.c | 8 +++++++-
mm/readahead.c | 22 +++++++++++-----------
2 files changed, 18 insertions(+), 12 deletions(-)
diff -puN mm/readahead.c~PF_READAHEAD-loop-fix mm/readahead.c
--- 25/mm/readahead.c~PF_READAHEAD-loop-fix 2003-08-06 16:59:29.000000000 -0700
+++ 25-akpm/mm/readahead.c 2003-08-06 16:59:29.000000000 -0700
@@ -202,9 +202,9 @@ out:
*
* Returns the number of pages which actually had IO started against them.
*/
-static inline int
+static int
__do_page_cache_readahead(struct address_space *mapping, struct file *filp,
- unsigned long offset, unsigned long nr_to_read)
+ unsigned long offset, unsigned long nr_to_read, int pf_readahead)
{
struct inode *inode = mapping->host;
struct page *page;
@@ -249,8 +249,11 @@ __do_page_cache_readahead(struct address
* uptodate then the caller will launch readpage again, and
* will then handle the error.
*/
- if (ret)
+ if (ret) {
+ current->flags |= pf_readahead;
read_pages(mapping, filp, &page_pool, ret);
+ current->flags &= ~pf_readahead;
+ }
BUG_ON(!list_empty(&page_pool));
out:
return ret;
@@ -275,8 +278,8 @@ int force_page_cache_readahead(struct ad
if (this_chunk > nr_to_read)
this_chunk = nr_to_read;
- err = __do_page_cache_readahead(mapping, filp,
- offset, this_chunk);
+ err = __do_page_cache_readahead(mapping, filp, offset,
+ this_chunk, 0);
if (err < 0) {
ret = err;
break;
@@ -300,12 +303,9 @@ int do_page_cache_readahead(struct addre
{
int ret = 0;
- if (!bdi_read_congested(mapping->backing_dev_info)) {
- current->flags |= PF_READAHEAD;
- ret = __do_page_cache_readahead(mapping, filp,
- offset, nr_to_read);
- current->flags &= ~PF_READAHEAD;
- }
+ if (!bdi_read_congested(mapping->backing_dev_info))
+ ret = __do_page_cache_readahead(mapping, filp, offset,
+ nr_to_read, PF_READAHEAD);
return ret;
}
diff -puN drivers/block/ll_rw_blk.c~PF_READAHEAD-loop-fix drivers/block/ll_rw_blk.c
--- 25/drivers/block/ll_rw_blk.c~PF_READAHEAD-loop-fix 2003-08-06 16:59:29.000000000 -0700
+++ 25-akpm/drivers/block/ll_rw_blk.c 2003-08-06 17:40:27.000000000 -0700
@@ -1847,7 +1847,13 @@ static int __make_request(request_queue_
barrier = test_bit(BIO_RW_BARRIER, &bio->bi_rw);
- ra = bio_flagged(bio, BIO_RW_AHEAD) || current->flags & PF_READAHEAD;
+ ra = bio_flagged(bio, BIO_RW_AHEAD);
+ if (current->flags & PF_READAHEAD) {
+ if (rw == WRITE)
+ WARN_ON(1);
+ else
+ ra = 1;
+ }
again:
insert_here = NULL;
_
next prev parent reply other threads:[~2003-08-07 0:38 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-08-06 22:40 Thomas Themel
2003-08-07 0:40 ` Andrew Morton [this message]
2003-08-07 7:23 ` Thomas Themel
2003-08-07 16:07 ` Valdis.Kletnieks
2003-08-07 16:24 ` Valdis.Kletnieks
2003-08-07 16:29 ` Andrew Morton
2003-08-09 20:48 ` cryptoloop data corruption (was Re: Device-backed loop broken in 2.6.0-test2?) Thomas Themel
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=20030806174043.27fd674a.akpm@osdl.org \
--to=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=themel@iwoars.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
all inboxes | Powered by JetHome®