Skip to content
Commit bb1591b4 authored by Chris Mason's avatar Chris Mason
Browse files

Btrfs: check prepare_uptodate_page() error code earlier



prepare_pages() may end up calling prepare_uptodate_page() twice if our
write only spans a single page.  But if the first call returns an error,
our page will be unlocked and its not safe to call it again.

This bug goes all the way back to 2011, and it's not something commonly
hit.

While we're here, add a more explicit check for the page being truncated
away.  The bare lock_page() alone is protected only by good thoughts and
i_mutex, which we're sure to regret eventually.

Reported-by: default avatarDave Jones <dsj@fb.com>
Signed-off-by: default avatarChris Mason <clm@fb.com>
parent 1b9b922a
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment