summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fs/btrfs/file.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index 72df63b0c799..3dfd8db0e243 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -1591,9 +1591,10 @@ again:
unlock_extent_cached(&BTRFS_I(inode)->io_tree,
lockstart, lockend, &cached_state,
GFP_NOFS);
- btrfs_drop_pages(pages, num_pages);
- if (ret)
+ if (ret) {
+ btrfs_drop_pages(pages, num_pages);
break;
+ }
release_bytes = 0;
if (only_release_metadata && copied > 0) {
@@ -1607,6 +1608,8 @@ again:
only_release_metadata = false;
}
+ btrfs_drop_pages(pages, num_pages);
+
cond_resched();
balance_dirty_pages_ratelimited(inode->i_mapping);