]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
Btrfs: fix delalloc accounting after copy_from_user faults
authorChris Mason <clm@fb.com>
Tue, 19 Jul 2016 12:52:36 +0000 (05:52 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 20 Aug 2016 16:10:56 +0000 (18:10 +0200)
commit8d32aaa89067225d4202a362dc201280e2514952
tree5595f641e90114924418d9feded08404d247888e
parentb9966750ff6c8641d6451f8b508815c4ba509f71
Btrfs: fix delalloc accounting after copy_from_user faults

commit 8b8b08cbfb9021af4b54b4175fc4c51d655aac8c upstream.

Commit 56244ef151c3cd11 was almost but not quite enough to fix the
reservation math after btrfs_copy_from_user returned partial copies.

Some users are still seeing warnings in btrfs_destroy_inode, and with a
long enough test run I'm able to trigger them as well.

This patch fixes the accounting math again, bringing it much closer to
the way it was before the sectorsize conversion Chandan did.  The
problem is accounting for the offset into the page/sector when we do a
partial copy.  This one just uses the dirty_sectors variable which
should already be updated properly.

Signed-off-by: Chris Mason <clm@fb.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/btrfs/file.c