linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Yongqiang Yang <xiaoqiangnk@gmail.com>
Cc: Jan Kara <jack@suse.cz>, Ted Ts'o <tytso@mit.edu>,
	linux-ext4@vger.kernel.org, Andreas Dilger <adilger@dilger.ca>
Subject: Re: Checks in ext4_ext_fiemap_cb() broken
Date: Tue, 26 Jul 2011 14:12:25 +0200	[thread overview]
Message-ID: <20110726121225.GC20131@quack.suse.cz> (raw)
In-Reply-To: <CAGBYx2ZsxvmEcC0akMRQTgDWUmkUHOp=D4Ff69_pSMb+bGH5Sg@mail.gmail.com>

  Hi Yongqiang,

On Tue 26-07-11 09:20:28, Yongqiang Yang wrote:
> I have been thinking if we can handle fiemap much simpler for a while.
>  Current code is very ugly due to page cache look up.  I have a
> thought on simplifying these code.  The reason leading us to looking
> up page cache is that delayed extents are not in extents tree.  I
> think we can add an in-memory delayed extents list in inode, and we
> can delete entries in the list after we allocate blocks for them.
> There is no limit on length of extents in the list, this way can an
> entry contain as many blocks as they are contiguous logically.
> 
> What's your opinion?
  Yes, that should be doable and shouldn't have too big overhead. It's just
stupid we'll do all this stuff only for fiemap call which is relatively
rare.

								Honza

> On Mon, Jul 25, 2011 at 11:58 PM, Jan Kara <jack@suse.cz> wrote:
> >  Hello,
> >
> >  I just had a look at the code checking delayed allocated buffers in
> > ext4_ext_fiemap_cb(). I believe the checks there could use some elimiation
> > of common patterns but that's just a minor thing. The main problem is that
> > the code can easily crash the kernel when it races with page reclaim. You
> > just cannot access most of the page contents (and for buffers it is
> > especially true) without locking the page. Getting a reference via
> > find_get_pages_tag() guarantees you the structure cannot go away but mm is
> > still free to detach the page from the mapping at any moment. So you must
> > always lock a page and check that it still belongs to the desired mapping
> > before you check 'page_has_buffers()'.
> >
> >                                                                Honza
> > --
> > Jan Kara <jack@suse.cz>
> > SUSE Labs, CR
> >
> 
> 
> 
> -- 
> Best Wishes
> Yongqiang Yang
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2011-07-26 12:12 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-25 15:58 Checks in ext4_ext_fiemap_cb() broken Jan Kara
2011-07-26  1:20 ` Yongqiang Yang
2011-07-26 12:12   ` Jan Kara [this message]
2011-07-26 12:48     ` Yongqiang Yang
2011-07-26 16:30       ` Allison Henderson
2011-07-26 16:44         ` Andreas Dilger
2011-07-26 17:07       ` Ted Ts'o
2011-07-26 18:48     ` Aditya Kali

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=20110726121225.GC20131@quack.suse.cz \
    --to=jack@suse.cz \
    --cc=adilger@dilger.ca \
    --cc=linux-ext4@vger.kernel.org \
    --cc=tytso@mit.edu \
    --cc=xiaoqiangnk@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).