public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Olaf Hering <olh@suse.de>
To: Andrew Morton <akpm@osdl.org>
Cc: linux-kernel@vger.kernel.org, viro@ftp.linux.org.uk
Subject: Re: [PATCH] cramfs corruption after BLKFLSBUF on loop device
Date: Thu, 1 Jun 2006 23:41:58 +0200	[thread overview]
Message-ID: <20060601214158.GA438@suse.de> (raw)
In-Reply-To: <20060601142400.1352f903.akpm@osdl.org>

 On Thu, Jun 01, Andrew Morton wrote:

> Olaf Hering <olh@suse.de> wrote:
> >
> > 
> >  
> > +/* return a page in PageUptodate state, BLKFLSBUF may have flushed the page */
> > +static struct page *cramfs_read_cache_page(struct address_space *m, unsigned int n)
> > +{
> > +	struct page *page;
> > +	int readagain = 5;
> > +retry:
> > +	page = read_cache_page(m, n, (filler_t *)m->a_ops->readpage, NULL);
> > +	if (IS_ERR(page))
> > +		return NULL;
> > +	lock_page(page);
> > +	if (PageUptodate(page))
> > +		return page;
> > +	unlock_page(page);
> > +	page_cache_release(page);
> > +	if (readagain--)
> > +		goto retry;
> > +	return NULL;
> > +}
> 
> Better, but it's still awful, isn't it?  The things you were discussing
> with Chris look more promising.  PG_Dirty would be a bit of a hack, but at
> least it'd be a 100% reliable hack, whereas the above is a
> whatever-the-previous-failure-rate-was-to-the-fifth hack.

Do you want it like that?

lock_page(page);
if (PageUptodate(page)) {
        SetPageDirty(page);
        mb();
        return page;
}

and perhaps a ClearPageDirty() after memcpy.

  reply	other threads:[~2006-06-01 21:42 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-29 21:40 cramfs corruption after BLKFLSBUF on loop device Olaf Hering
2006-05-30 13:19 ` Olaf Hering
2006-05-30 18:24 ` Olaf Hering
2006-06-01 18:49   ` [PATCH] " Olaf Hering
2006-06-01 19:12     ` Andrew Morton
2006-06-01 19:15       ` Andrew Morton
2006-06-01 20:10       ` Olaf Hering
2006-06-01 21:24         ` Andrew Morton
2006-06-01 21:41           ` Olaf Hering [this message]
2006-06-01 21:57             ` Andrew Morton
2006-06-02  8:43               ` Olaf Hering
2006-06-02  9:11                 ` Andrew Morton
2006-06-02 19:14                   ` Olaf Hering
2006-06-02 19:41                     ` Andrew Morton
2006-06-02 21:06                       ` Olaf Hering
2006-06-02 19:37                   ` Olaf Hering
2006-06-02 19:46                     ` Andrew Morton
2006-06-03 13:13                       ` Olaf Hering
2006-06-01 20:17     ` Chris Mason
2006-06-01 20:20       ` Olaf Hering
2006-06-01 20:29         ` Chris Mason
2006-09-20 13:20     ` Olaf Hering
2006-09-20 18:47       ` Andrew Morton

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=20060601214158.GA438@suse.de \
    --to=olh@suse.de \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@ftp.linux.org.uk \
    /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