fix btrfs deadlock on mount

This commit is contained in:
Tobias Powalowski 2015-04-08 06:49:55 +00:00
parent f442473e88
commit d161c321ee
2 changed files with 51 additions and 3 deletions

View File

@ -0,0 +1,43 @@
From 9c4f61f01d269815bb7c37be3ede59c5587747c6 Mon Sep 17 00:00:00 2001
From: David Sterba <dsterba@suse.cz>
Date: Fri, 2 Jan 2015 19:12:57 +0100
Subject: btrfs: simplify insert_orphan_item
We can search and add the orphan item in one go,
btrfs_insert_orphan_item will find out if the item already exists.
Signed-off-by: David Sterba <dsterba@suse.cz>
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 5be45c1..25a1c36 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -1254,21 +1254,13 @@ out:
}
static int insert_orphan_item(struct btrfs_trans_handle *trans,
- struct btrfs_root *root, u64 offset)
+ struct btrfs_root *root, u64 ino)
{
int ret;
- struct btrfs_path *path;
-
- path = btrfs_alloc_path();
- if (!path)
- return -ENOMEM;
- ret = btrfs_find_item(root, path, BTRFS_ORPHAN_OBJECTID,
- offset, BTRFS_ORPHAN_ITEM_KEY, NULL);
- if (ret > 0)
- ret = btrfs_insert_orphan_item(trans, root, offset);
-
- btrfs_free_path(path);
+ ret = btrfs_insert_orphan_item(trans, root, ino);
+ if (ret == -EEXIST)
+ ret = 0;
return ret;
}
--
cgit v0.10.2

View File

@ -5,7 +5,7 @@ pkgbase=linux # Build stock -ARCH kernel
#pkgbase=linux-custom # Build kernel with a different name #pkgbase=linux-custom # Build kernel with a different name
_srcname=linux-3.19 _srcname=linux-3.19
pkgver=3.19.3 pkgver=3.19.3
pkgrel=1 pkgrel=2
arch=('i686' 'x86_64') arch=('i686' 'x86_64')
url="http://www.kernel.org/" url="http://www.kernel.org/"
license=('GPL2') license=('GPL2')
@ -20,7 +20,7 @@ source=("https://www.kernel.org/pub/linux/kernel/v3.x/${_srcname}.tar.xz"
# standard config files for mkinitcpio ramdisk # standard config files for mkinitcpio ramdisk
'linux.preset' 'linux.preset'
'change-default-console-loglevel.patch' 'change-default-console-loglevel.patch'
) '0001-fix-btrfs-mount-deadlock.patch')
sha256sums=('be42511fe5321012bb4a2009167ce56a9e5fe362b4af43e8c371b3666859806c' sha256sums=('be42511fe5321012bb4a2009167ce56a9e5fe362b4af43e8c371b3666859806c'
'SKIP' 'SKIP'
'cd9474b61b859d68f83ff0b769bafef8489d2090e0a933d2a7e5f76a23cc071a' 'cd9474b61b859d68f83ff0b769bafef8489d2090e0a933d2a7e5f76a23cc071a'
@ -28,7 +28,8 @@ sha256sums=('be42511fe5321012bb4a2009167ce56a9e5fe362b4af43e8c371b3666859806c'
'704a479de77c9022e5c7a797d2cd7fd0e4ba1f52f9039ec8a80efd57f7e9f0d8' '704a479de77c9022e5c7a797d2cd7fd0e4ba1f52f9039ec8a80efd57f7e9f0d8'
'59830f47c1be39f874640d762dca55f972aca549a7a65ba2f1dac184251dabb2' '59830f47c1be39f874640d762dca55f972aca549a7a65ba2f1dac184251dabb2'
'f0d90e756f14533ee67afda280500511a62465b4f76adcc5effa95a40045179c' 'f0d90e756f14533ee67afda280500511a62465b4f76adcc5effa95a40045179c'
'1256b241cd477b265a3c2d64bdc19ffe3c9bbcee82ea3994c590c2c76e767d99') '1256b241cd477b265a3c2d64bdc19ffe3c9bbcee82ea3994c590c2c76e767d99'
'5967cf53cb9db9f070e8f346c3d7045748e4823a7fe2ee330acd18c9d02bbb77')
validpgpkeys=( validpgpkeys=(
'ABAF11C65A2970B130ABE3C479BE3E4300411886' # Linus Torvalds 'ABAF11C65A2970B130ABE3C479BE3E4300411886' # Linus Torvalds
'647F28654894E3BD457199BE38DBBDC86092693E' # Greg Kroah-Hartman '647F28654894E3BD457199BE38DBBDC86092693E' # Greg Kroah-Hartman
@ -50,6 +51,10 @@ prepare() {
# (relevant patch sent upstream: https://lkml.org/lkml/2011/7/26/227) # (relevant patch sent upstream: https://lkml.org/lkml/2011/7/26/227)
patch -p1 -i "${srcdir}/change-default-console-loglevel.patch" patch -p1 -i "${srcdir}/change-default-console-loglevel.patch"
# fix #44495 and #44385 deadlock on btrfs mount
# https://btrfs.wiki.kernel.org/index.php/Gotchas
patch -Np1 -i "${srcdir}/0001-fix-btrfs-mount-deadlock.patch"
if [ "${CARCH}" = "x86_64" ]; then if [ "${CARCH}" = "x86_64" ]; then
cat "${srcdir}/config.x86_64" > ./.config cat "${srcdir}/config.x86_64" > ./.config
else else