Btrfs: deal with short returns from copy_from_user
authorChris Mason <chris.mason@oracle.com>
Mon, 7 Mar 2011 16:10:24 +0000 (11:10 -0500)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 23 Mar 2011 19:49:56 +0000 (12:49 -0700)
commit64bb48e4e88b52e05e36b8b0d033a17fa9102962
tree76746d3b57cfb6b8e03191984535ff23b6beb93a
parent67725123d5df7aace72676b94e1bdffbdbbc0f75
Btrfs: deal with short returns from copy_from_user

commit 31339acd07b4ba687906702085127895a56eb920 upstream.

When copy_from_user is only able to copy some of the bytes we requested,
we may end up creating a partially up to date page.  To avoid garbage in
the page, we need to treat a partial copy as a zero length copy.

This makes the rest of the file_write code drop the page and
retry the whole copy instead of marking the partially up to
date page as dirty.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
fs/btrfs/file.c