linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Checks in ext4_ext_fiemap_cb() broken
@ 2011-07-25 15:58 Jan Kara
  2011-07-26  1:20 ` Yongqiang Yang
  0 siblings, 1 reply; 8+ messages in thread
From: Jan Kara @ 2011-07-25 15:58 UTC (permalink / raw)
  To: Yongqiang Yang; +Cc: linux-ext4, Andreas Dilger, tytso

  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

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2011-07-26 18:49 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

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).