Linux v3.14-4555-gb33ce4429938
This commit is contained in:
parent
7f4b33905e
commit
ffe29321e1
79
btrfs-fix-lockdep-warning-with-reclaim-lock-inversion.patch
Normal file
79
btrfs-fix-lockdep-warning-with-reclaim-lock-inversion.patch
Normal file
@ -0,0 +1,79 @@
|
||||
From patchwork Wed Mar 26 18:11:26 2014
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
MIME-Version: 1.0
|
||||
Content-Transfer-Encoding: 7bit
|
||||
Subject: btrfs: fix lockdep warning with reclaim lock inversion
|
||||
From: Jeff Mahoney <jeffm@suse.com>
|
||||
X-Patchwork-Id: 3894781
|
||||
Message-Id: <5333184E.3090609@suse.com>
|
||||
To: linux-btrfs <linux-btrfs@vger.kernel.org>
|
||||
Date: Wed, 26 Mar 2014 14:11:26 -0400
|
||||
|
||||
When encountering memory pressure, testers have run into the following
|
||||
lockdep warning. It was caused by __link_block_group calling kobject_add
|
||||
with the groups_sem held. kobject_add calls kvasprintf with GFP_KERNEL,
|
||||
which gets us into reclaim context. The kobject doesn't actually need
|
||||
to be added under the lock -- it just needs to ensure that it's only
|
||||
added for the first block group to be linked.
|
||||
|
||||
|
||||
=========================================================
|
||||
[ INFO: possible irq lock inversion dependency detected ]
|
||||
3.14.0-rc8-default #1 Not tainted
|
||||
---------------------------------------------------------
|
||||
kswapd0/169 just changed the state of lock:
|
||||
(&delayed_node->mutex){+.+.-.}, at: [<ffffffffa018baea>] __btrfs_release_delayed_node+0x3a/0x200 [btrfs]
|
||||
but this lock took another, RECLAIM_FS-unsafe lock in the past:
|
||||
(&found->groups_sem){+++++.}
|
||||
|
||||
and interrupts could create inverse lock ordering between them.
|
||||
|
||||
other info that might help us debug this:
|
||||
Possible interrupt unsafe locking scenario:
|
||||
CPU0 CPU1
|
||||
---- ----
|
||||
lock(&found->groups_sem);
|
||||
local_irq_disable();
|
||||
lock(&delayed_node->mutex);
|
||||
lock(&found->groups_sem);
|
||||
<Interrupt>
|
||||
lock(&delayed_node->mutex);
|
||||
|
||||
*** DEADLOCK ***
|
||||
2 locks held by kswapd0/169:
|
||||
#0: (shrinker_rwsem){++++..}, at: [<ffffffff81159e8a>] shrink_slab+0x3a/0x160
|
||||
#1: (&type->s_umount_key#27){++++..}, at: [<ffffffff811bac6f>] grab_super_passive+0x3f/0x90
|
||||
|
||||
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
|
||||
---
|
||||
fs/btrfs/extent-tree.c | 10 +++++++---
|
||||
1 file changed, 7 insertions(+), 3 deletions(-)
|
||||
|
||||
--- a/fs/btrfs/extent-tree.c
|
||||
+++ b/fs/btrfs/extent-tree.c
|
||||
@@ -8343,9 +8343,15 @@ static void __link_block_group(struct bt
|
||||
struct btrfs_block_group_cache *cache)
|
||||
{
|
||||
int index = get_block_group_index(cache);
|
||||
+ bool first = false;
|
||||
|
||||
down_write(&space_info->groups_sem);
|
||||
- if (list_empty(&space_info->block_groups[index])) {
|
||||
+ if (list_empty(&space_info->block_groups[index]))
|
||||
+ first = true;
|
||||
+ list_add_tail(&cache->list, &space_info->block_groups[index]);
|
||||
+ up_write(&space_info->groups_sem);
|
||||
+
|
||||
+ if (first) {
|
||||
struct kobject *kobj = &space_info->block_group_kobjs[index];
|
||||
int ret;
|
||||
|
||||
@@ -8357,8 +8363,6 @@ static void __link_block_group(struct bt
|
||||
kobject_put(&space_info->kobj);
|
||||
}
|
||||
}
|
||||
- list_add_tail(&cache->list, &space_info->block_groups[index]);
|
||||
- up_write(&space_info->groups_sem);
|
||||
}
|
||||
|
||||
static struct btrfs_block_group_cache *
|
@ -61,7 +61,7 @@ Summary: The Linux kernel
|
||||
# The rc snapshot level
|
||||
%define rcrev 0
|
||||
# The git snapshot level
|
||||
%define gitrev 4
|
||||
%define gitrev 5
|
||||
# Set rpm version accordingly
|
||||
%define rpmversion 3.%{upstream_sublevel}.0
|
||||
%endif
|
||||
@ -652,6 +652,7 @@ Patch25055: net-enic-include-irq.h-for-irqreturn_t-definitions.patch
|
||||
Patch25056: net-bnx2x-include-irq.h-for-irqreturn_t-definitions.patch
|
||||
Patch25057: net-qlcnic-include-irq.h-for-irq-definitions.patch
|
||||
Patch25058: arm64-Fix-duplicated-Kconfig-entries-again.patch
|
||||
Patch25059: btrfs-fix-lockdep-warning-with-reclaim-lock-inversion.patch
|
||||
|
||||
# END OF PATCH DEFINITIONS
|
||||
|
||||
@ -1310,6 +1311,7 @@ ApplyPatch net-enic-include-irq.h-for-irqreturn_t-definitions.patch
|
||||
ApplyPatch net-bnx2x-include-irq.h-for-irqreturn_t-definitions.patch
|
||||
ApplyPatch net-qlcnic-include-irq.h-for-irq-definitions.patch
|
||||
ApplyPatch arm64-Fix-duplicated-Kconfig-entries-again.patch
|
||||
ApplyPatch btrfs-fix-lockdep-warning-with-reclaim-lock-inversion.patch
|
||||
|
||||
# END OF PATCH APPLICATIONS
|
||||
|
||||
@ -2090,6 +2092,9 @@ fi
|
||||
# ||----w |
|
||||
# || ||
|
||||
%changelog
|
||||
* Wed Apr 02 2014 Josh Boyer <jwboyer@fedoraproject.org> - 3.15.0-0.rc0.git5.1
|
||||
- Linux v3.14-4555-gb33ce4429938
|
||||
|
||||
* Wed Apr 02 2014 Josh Boyer <jwboyer@fedoraproject.org> - 3.15.0-0.rc0.git4.1
|
||||
- Linux v3.14-4227-g3e75c6de1ac3
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user