* Patch "Btrfs: fix truncate_space_check" has been added to the 4.5-stable tree
@ 2016-05-17 0:01 gregkh
0 siblings, 0 replies; only message in thread
From: gregkh @ 2016-05-17 0:01 UTC (permalink / raw)
To: jbacik, dsterba, gregkh; +Cc: stable, stable-commits
This is a note to let you know that I've just added the patch titled
Btrfs: fix truncate_space_check
to the 4.5-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
btrfs-fix-truncate_space_check.patch
and it can be found in the queue-4.5 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.
>From dc95f7bfc57fa4b75a77d0da84d5db249d74aa3f Mon Sep 17 00:00:00 2001
From: Josef Bacik <jbacik@fb.com>
Date: Wed, 13 Jan 2016 11:48:06 -0500
Subject: Btrfs: fix truncate_space_check
From: Josef Bacik <jbacik@fb.com>
commit dc95f7bfc57fa4b75a77d0da84d5db249d74aa3f upstream.
truncate_space_check is using btrfs_csum_bytes_to_leaves() but forgetting to
multiply by nodesize so we get an actual byte count. We need a tracepoint here
so that we have the matching reserve for the release that will come later. Also
add a comment to make clear what the intent of truncate_space_check is.
Signed-off-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
fs/btrfs/inode.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -4211,11 +4211,20 @@ static int truncate_space_check(struct b
{
int ret;
+ /*
+ * This is only used to apply pressure to the enospc system, we don't
+ * intend to use this reservation at all.
+ */
bytes_deleted = btrfs_csum_bytes_to_leaves(root, bytes_deleted);
+ bytes_deleted *= root->nodesize;
ret = btrfs_block_rsv_add(root, &root->fs_info->trans_block_rsv,
bytes_deleted, BTRFS_RESERVE_NO_FLUSH);
- if (!ret)
+ if (!ret) {
+ trace_btrfs_space_reservation(root->fs_info, "transaction",
+ trans->transid,
+ bytes_deleted, 1);
trans->bytes_reserved += bytes_deleted;
+ }
return ret;
}
Patches currently in stable-queue which might be from jbacik@fb.com are
queue-4.5/btrfs-fix-truncate_space_check.patch
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2016-05-17 0:01 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-17 0:01 Patch "Btrfs: fix truncate_space_check" has been added to the 4.5-stable tree gregkh
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox