All of lore.kernel.org
 help / color / mirror / Atom feed
* linux-next: manual merge of the btrfs-kdave tree with the btrfs-fixes tree
@ 2019-04-04 23:03 Stephen Rothwell
  0 siblings, 0 replies; 3+ messages in thread
From: Stephen Rothwell @ 2019-04-04 23:03 UTC (permalink / raw)
  To: David Sterba
  Cc: Linux Next Mailing List, Linux Kernel Mailing List, Anand Jain

[-- Attachment #1: Type: text/plain, Size: 844 bytes --]

Hi all,

Today's linux-next merge of the btrfs-kdave tree got a conflict in:

  fs/btrfs/props.c

between commits:

  50398fde997f ("btrfs: prop: fix zstd compression parameter validation")
  272e5326c783 ("btrfs: prop: fix vanished compression property after failed set")

from the btrfs-fixes tree and commit:

  10e02a8f96ea ("btrfs: drop redundant forward declaration in props.c")

from the btrfs-kdave tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.



-- 
Cheers,
Stephen Rothwell

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* linux-next: manual merge of the btrfs-kdave tree with the btrfs-fixes tree
@ 2019-08-08  0:54 Stephen Rothwell
  0 siblings, 0 replies; 3+ messages in thread
From: Stephen Rothwell @ 2019-08-08  0:54 UTC (permalink / raw)
  To: David Sterba
  Cc: Linux Next Mailing List, Linux Kernel Mailing List,
	Filipe Manana, Qu Wenruo, Josef Bacik

[-- Attachment #1: Type: text/plain, Size: 5991 bytes --]

Hi all,

Today's linux-next merge of the btrfs-kdave tree got conflicts in:

  fs/btrfs/ctree.h
  fs/btrfs/extent-tree.c

between commits:

  d7cd4dd907c1 ("Btrfs: fix sysfs warning and missing raid sysfs directories")
  07301df7d2fc ("btrfs: trim: Check the range passed into to prevent overflow")

from the btrfs-fixes tree and commit:

  4dfbf33fbfb6 ("btrfs: migrate the block group lookup code")
  f35f767acec1 ("btrfs: move sysfs declarations out of ctree.h")
  76c49f86437b ("btrfs: factor sysfs code out of link_block_group")

from the btrfs-kdave tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

I also added this patch:

From: Stephen Rothwell <sfr@canb.auug.org.au>
Date: Thu, 8 Aug 2019 10:14:25 +1000
Subject: [PATCH] btrfs: merge fix up for "Btrfs: fix sysfs warning and missing
 raid sysfs directories"

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 fs/btrfs/sysfs.c | 52 +++++++++++++++++++-----------------------------
 1 file changed, 21 insertions(+), 31 deletions(-)

diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
index 600db4be740d..ee6f70e8f258 100644
--- a/fs/btrfs/sysfs.c
+++ b/fs/btrfs/sysfs.c
@@ -4,6 +4,7 @@
  */
 
 #include <linux/sched.h>
+#include <linux/sched/mm.h>
 #include <linux/slab.h>
 #include <linux/spinlock.h>
 #include <linux/completion.h>
@@ -27,7 +28,6 @@ struct btrfs_feature_attr {
 struct raid_kobject {
 	u64 flags;
 	struct kobject kobj;
-	struct list_head list;
 };
 
 #define __INIT_KOBJ_ATTR(_name, _mode, _show, _store)			\
@@ -819,33 +819,6 @@ static void init_feature_attrs(void)
 	}
 }
 
-/* link_block_group will queue up kobjects to add when we're reclaim-safe */
-void btrfs_add_raid_kobjects(struct btrfs_fs_info *fs_info)
-{
-	struct btrfs_space_info *space_info;
-	struct raid_kobject *rkobj;
-	LIST_HEAD(list);
-	int ret = 0;
-
-	spin_lock(&fs_info->pending_raid_kobjs_lock);
-	list_splice_init(&fs_info->pending_raid_kobjs, &list);
-	spin_unlock(&fs_info->pending_raid_kobjs_lock);
-
-	list_for_each_entry(rkobj, &list, list) {
-		space_info = btrfs_find_space_info(fs_info, rkobj->flags);
-
-		ret = kobject_add(&rkobj->kobj, &space_info->kobj,
-				"%s", btrfs_bg_type_to_raid_name(rkobj->flags));
-		if (ret) {
-			kobject_put(&rkobj->kobj);
-			break;
-		}
-	}
-	if (ret)
-		btrfs_warn(fs_info,
-			   "failed to add kobject for block cache, ignoring");
-}
-
 /*
  * Create a sysfs entry for a given block group type at path
  * /sys/fs/btrfs/UUID/allocation/data/TYPE
@@ -855,10 +828,21 @@ void btrfs_sysfs_add_block_group_type(struct btrfs_block_group_cache *cache)
 	struct btrfs_fs_info *fs_info = cache->fs_info;
 	struct btrfs_space_info *space_info = cache->space_info;
 	struct raid_kobject *rkobj;
+	unsigned int nofs_flag;
+	int ret;
 	const int index = btrfs_bg_flags_to_raid_index(cache->flags);
 
+	/*
+	 * Setup a NOFS context because kobject_add(), deep in its call
+	 * chain, does GFP_KERNEL allocations, and we are often called
+	 * in a context where if reclaim is triggered we can deadlock
+	 * (we are either holding a transaction handle or some lock
+	 * required for a transaction commit).
+	 */
+	nofs_flag = memalloc_nofs_save();
 	rkobj = kzalloc(sizeof(*rkobj), GFP_NOFS);
 	if (!rkobj) {
+		memalloc_nofs_restore(nofs_flag);
 		btrfs_warn(cache->fs_info,
 				"couldn't alloc memory for raid level kobject");
 		return;
@@ -867,9 +851,15 @@ void btrfs_sysfs_add_block_group_type(struct btrfs_block_group_cache *cache)
 	rkobj->flags = cache->flags;
 	kobject_init(&rkobj->kobj, &btrfs_raid_ktype);
 
-	spin_lock(&fs_info->pending_raid_kobjs_lock);
-	list_add_tail(&rkobj->list, &fs_info->pending_raid_kobjs);
-	spin_unlock(&fs_info->pending_raid_kobjs_lock);
+	ret = kobject_add(&rkobj->kobj, &space_info->kobj, "%s",
+			  btrfs_bg_type_to_raid_name(rkobj->flags));
+	memalloc_nofs_restore(nofs_flag);
+	if (ret) {
+		kobject_put(&rkobj->kobj);
+		btrfs_warn(fs_info,
+		   "failed to add kobject for block cache, ignoring");
+		return;
+	}
 	space_info->block_group_kobjs[index] = &rkobj->kobj;
 }
 
-- 
2.20.1


-- 
Cheers,
Stephen Rothwell

diff --cc fs/btrfs/ctree.h
index 94660063a162,357316173d84..000000000000
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
diff --cc fs/btrfs/extent-tree.c
index 8b7eb22d508a,ad15d05e256b..000000000000
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@@ -8976,27 -8751,20 +8752,27 @@@ int btrfs_trim_fs(struct btrfs_fs_info 
  	int dev_ret = 0;
  	int ret = 0;
  
 +	/*
 +	 * Check range overflow if range->len is set.
 +	 * The default range->len is U64_MAX.
 +	 */
 +	if (range->len != U64_MAX &&
 +	    check_add_overflow(range->start, range->len, &range_end))
 +		return -EINVAL;
 +
  	cache = btrfs_lookup_first_block_group(fs_info, range->start);
- 	for (; cache; cache = next_block_group(cache)) {
+ 	for (; cache; cache = btrfs_next_block_group(cache)) {
 -		if (cache->key.objectid >= (range->start + range->len)) {
 +		if (cache->key.objectid >= range_end) {
  			btrfs_put_block_group(cache);
  			break;
  		}
  
  		start = max(range->start, cache->key.objectid);
 -		end = min(range->start + range->len,
 -				cache->key.objectid + cache->key.offset);
 +		end = min(range_end, cache->key.objectid + cache->key.offset);
  
  		if (end - start >= range->minlen) {
- 			if (!block_group_cache_done(cache)) {
- 				ret = cache_block_group(cache, 0);
+ 			if (!btrfs_block_group_cache_done(cache)) {
+ 				ret = btrfs_cache_block_group(cache, 0);
  				if (ret) {
  					bg_failed++;
  					bg_ret = ret;

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* linux-next: manual merge of the btrfs-kdave tree with the btrfs-fixes tree
@ 2018-05-15 23:47 Stephen Rothwell
  0 siblings, 0 replies; 3+ messages in thread
From: Stephen Rothwell @ 2018-05-15 23:47 UTC (permalink / raw)
  To: David Sterba
  Cc: Linux-Next Mailing List, Linux Kernel Mailing List,
	Misono Tomohiro, Adam Borowski

[-- Attachment #1: Type: text/plain, Size: 1620 bytes --]

Hi David,

Today's linux-next merge of the btrfs-kdave tree got a conflict in:

  fs/btrfs/props.c

between commit:

  f764b4f4bb26 ("btrfs: property: Set incompat flag if lzo/zstd compression is set")

from the btrfs-fixes tree and commit:

  e37739baf401 ("btrfs: allow setting zstd level")

from the btrfs-kdave tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc fs/btrfs/props.c
index dc6140013ae8,c85bb04a1cc3..000000000000
--- a/fs/btrfs/props.c
+++ b/fs/btrfs/props.c
@@@ -391,17 -390,14 +391,17 @@@ static int prop_compression_apply(struc
  		return 0;
  	}
  
 -	if (!strncmp("lzo", value, 3))
 +	if (!strncmp("lzo", value, 3)) {
  		type = BTRFS_COMPRESS_LZO;
 -	else if (!strncmp("zlib", value, 4))
 +		btrfs_set_fs_incompat(fs_info, COMPRESS_LZO);
 +	} else if (!strncmp("zlib", value, 4)) {
  		type = BTRFS_COMPRESS_ZLIB;
- 	} else if (!strncmp("zstd", value, len)) {
 -	else if (!strncmp("zstd", value, 4))
++	} else if (!strncmp("zstd", value, 4)) {
  		type = BTRFS_COMPRESS_ZSTD;
 -	else
 +		btrfs_set_fs_incompat(fs_info, COMPRESS_ZSTD);
 +	} else {
  		return -EINVAL;
 +	}
  
  	BTRFS_I(inode)->flags &= ~BTRFS_INODE_NOCOMPRESS;
  	BTRFS_I(inode)->flags |= BTRFS_INODE_COMPRESS;

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-08-08  0:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-04 23:03 linux-next: manual merge of the btrfs-kdave tree with the btrfs-fixes tree Stephen Rothwell
  -- strict thread matches above, loose matches on Subject: below --
2019-08-08  0:54 Stephen Rothwell
2018-05-15 23:47 Stephen Rothwell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.