public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* Patch "btrfs: fallback to vmalloc in btrfs_compare_tree" has been added to the 4.5-stable tree
@ 2016-05-17  1:11 gregkh
  0 siblings, 0 replies; only message in thread
From: gregkh @ 2016-05-17  1:11 UTC (permalink / raw)
  To: dsterba, gregkh, jd.girard; +Cc: stable, stable-commits


This is a note to let you know that I've just added the patch titled

    btrfs: fallback to vmalloc in btrfs_compare_tree

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-fallback-to-vmalloc-in-btrfs_compare_tree.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 8f282f71eaee7ac979cdbe525f76daa0722798a8 Mon Sep 17 00:00:00 2001
From: David Sterba <dsterba@suse.com>
Date: Wed, 30 Mar 2016 16:01:12 +0200
Subject: btrfs: fallback to vmalloc in btrfs_compare_tree

From: David Sterba <dsterba@suse.com>

commit 8f282f71eaee7ac979cdbe525f76daa0722798a8 upstream.

The allocation of node could fail if the memory is too fragmented for a
given node size, practically observed with 64k.

http://article.gmane.org/gmane.comp.file-systems.btrfs/54689

Reported-and-tested-by: Jean-Denis Girard <jd.girard@sysnux.pf>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 fs/btrfs/ctree.c |   12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -19,6 +19,7 @@
 #include <linux/sched.h>
 #include <linux/slab.h>
 #include <linux/rbtree.h>
+#include <linux/vmalloc.h>
 #include "ctree.h"
 #include "disk-io.h"
 #include "transaction.h"
@@ -5361,10 +5362,13 @@ int btrfs_compare_trees(struct btrfs_roo
 		goto out;
 	}
 
-	tmp_buf = kmalloc(left_root->nodesize, GFP_NOFS);
+	tmp_buf = kmalloc(left_root->nodesize, GFP_KERNEL | __GFP_NOWARN);
 	if (!tmp_buf) {
-		ret = -ENOMEM;
-		goto out;
+		tmp_buf = vmalloc(left_root->nodesize);
+		if (!tmp_buf) {
+			ret = -ENOMEM;
+			goto out;
+		}
 	}
 
 	left_path->search_commit_root = 1;
@@ -5565,7 +5569,7 @@ int btrfs_compare_trees(struct btrfs_roo
 out:
 	btrfs_free_path(left_path);
 	btrfs_free_path(right_path);
-	kfree(tmp_buf);
+	kvfree(tmp_buf);
 	return ret;
 }
 


Patches currently in stable-queue which might be from dsterba@suse.com are

queue-4.5/btrfs-csum_tree_block-return-proper-errno-value.patch
queue-4.5/btrfs-fix-invalid-reference-in-replace_path.patch
queue-4.5/btrfs-do-not-write-corrupted-metadata-blocks-to-disk.patch
queue-4.5/btrfs-handle-non-fatal-errors-in-btrfs_qgroup_inherit.patch
queue-4.5/btrfs-remove-error-message-from-search-ioctl-for-nonexistent-tree.patch
queue-4.5/btrfs-change-max_inline-default-to-2048.patch
queue-4.5/btrfs-fix-truncate_space_check.patch
queue-4.5/btrfs-reset-io-error-counters-before-start-of-device-replacing.patch
queue-4.5/btrfs-reada-fix-in-segment-calculation-for-reada.patch
queue-4.5/btrfs-don-t-use-src-fd-for-printk.patch
queue-4.5/btrfs-fallback-to-vmalloc-in-btrfs_compare_tree.patch

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-05-17  1:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-17  1:11 Patch "btrfs: fallback to vmalloc in btrfs_compare_tree" 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