From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 449F5C43381 for ; Wed, 20 Mar 2019 17:43:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1B995218A1 for ; Wed, 20 Mar 2019 17:43:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553103819; bh=Hs5O4dHRM2cptZjxQtily2mUeKWsGj21Zw/mMlrP9yA=; h=Subject:To:Cc:From:Date:List-ID:From; b=1NPpsHQc96+Z84o9gSKWav2D30gAmzabCtiEzl5N5bnUYxq4qFUzN1AsM81oIcoU/ t4c2LSYq4U8XTnovT19JieaoUiihwKHsP7sdm9516irxkh/XRDswQ9Ta+yEEoO2NZR 85zvMV67yofUEoqoPPMObuCrfdtZOMeBmwS8Z3GE= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726437AbfCTRni (ORCPT ); Wed, 20 Mar 2019 13:43:38 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:45605 "EHLO out5-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727241AbfCTRni (ORCPT ); Wed, 20 Mar 2019 13:43:38 -0400 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 926F222165; Wed, 20 Mar 2019 13:43:37 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Wed, 20 Mar 2019 13:43:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:message-id:mime-version:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=JxkDeD O9FIAQ7Dz4CFUqG+c8nAHrdfoKUe7loB/z/F0=; b=HjfwJ/QdmUeRZuSruiqz0p m5ilD05ht0tdmd3wCSN+gFZTmOzOP0n2tL1nEjN6Sj0iQTvInwRjByRVGWk14pja e+JcWkrdCu12x6Ol5R9PGUsADp2rdpV8wWjBWaJsR2xCkH1GbooMZWl4Yupviwcd tZQdB02T1IbtiJp9CYHArNHcxdnmt//f1LXlEfnWwEsnunv4I3tLzbI59nqsXNLX 5PxpyS9Iq8DyG86wPYaC/CIXySyBzVsEY83tde5nXCoXvBU69sPqJ0fumOVlisDD CwzPs70bvPfYoqNWnHLtrQCp0p4HmEUOm2r4G1cRG/QQA6ylSJgz3X5H7HAbBL7g == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedutddrieeigddutdegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefuvffhfffkgggtgfesthekredttd dtlfenucfhrhhomhepoehgrhgvghhkhheslhhinhhugihfohhunhgurghtihhonhdrohhr gheqnecukfhppeekfedrkeeirdekledruddtjeenucfrrghrrghmpehmrghilhhfrhhomh epghhrvghgsehkrhhorghhrdgtohhmnecuvehluhhsthgvrhfuihiivgeptd X-ME-Proxy: Received: from localhost (5356596b.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) by mail.messagingengine.com (Postfix) with ESMTPA id 53743E4360; Wed, 20 Mar 2019 13:43:36 -0400 (EDT) Subject: FAILED: patch "[PATCH] Btrfs: setup a nofs context for memory allocation at" failed to apply to 4.14-stable tree To: fdmanana@suse.com, dsterba@suse.com, nborisov@suse.com Cc: From: Date: Wed, 20 Mar 2019 18:43:34 +0100 Message-ID: <1553103814691@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org The patch below does not apply to the 4.14-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From b89f6d1fcb30a8cbdc18ce00c7d93792076af453 Mon Sep 17 00:00:00 2001 From: Filipe Manana Date: Thu, 13 Dec 2018 21:16:45 +0000 Subject: [PATCH] Btrfs: setup a nofs context for memory allocation at btrfs_create_tree() We are holding a transaction handle when creating a tree, therefore we can not allocate the root using GFP_KERNEL, as we could deadlock if reclaim is triggered by the allocation, therefore setup a nofs context. Fixes: 74e4d82757f74 ("btrfs: let callers of btrfs_alloc_root pass gfp flags") CC: stable@vger.kernel.org # 4.9+ Reviewed-by: Nikolay Borisov Signed-off-by: Filipe Manana Reviewed-by: David Sterba Signed-off-by: David Sterba diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 6a2a2a951705..888d72dda794 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include "ctree.h" #include "disk-io.h" @@ -1258,10 +1259,17 @@ struct btrfs_root *btrfs_create_tree(struct btrfs_trans_handle *trans, struct btrfs_root *tree_root = fs_info->tree_root; struct btrfs_root *root; struct btrfs_key key; + unsigned int nofs_flag; int ret = 0; uuid_le uuid = NULL_UUID_LE; + /* + * We're holding a transaction handle, so use a NOFS memory allocation + * context to avoid deadlock if reclaim happens. + */ + nofs_flag = memalloc_nofs_save(); root = btrfs_alloc_root(fs_info, GFP_KERNEL); + memalloc_nofs_restore(nofs_flag); if (!root) return ERR_PTR(-ENOMEM);