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 8B76CC43381 for ; Wed, 20 Mar 2019 19:23:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6005621841 for ; Wed, 20 Mar 2019 19:23:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553109784; bh=2+qv8iiRp/3dJyBrmwgn3UHTyZ2mb26jdZFRDzlCQT4=; h=Subject:To:Cc:From:Date:List-ID:From; b=K/7Nb8DTwHAwOhxlYrGWF4d2zLrizVu5i9quWTvqP4rdSokcZhS2oy14P8CNZonAG nAXfthPKWt0ovwEZdfXfXh0MDuZOiU+IlCk0HPXHGS+llw9EWMGm31n4xe9f2oSoO4 MDL1rzAcrL4ltF5GveHqkmyha7DQuoJptILBsrO8= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726239AbfCTTXD (ORCPT ); Wed, 20 Mar 2019 15:23:03 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:37943 "EHLO out5-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726006AbfCTTXD (ORCPT ); Wed, 20 Mar 2019 15:23:03 -0400 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id BD9952379A; Wed, 20 Mar 2019 15:23:02 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Wed, 20 Mar 2019 15:23:02 -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=bceSBx BAait20OPiZch0rEyaGfl3y2V1aZXs3glPtxg=; b=m1Pnwp8+bad8JSs3JfDh9+ wW0jyRGlOzg3a2xIUK9lPOTToax62LNALQZhebw57uWGw2O/WXNFvllOxnZGOPtm l/n+bIqAu1sy88ZqePASX5DXrZpxVzh7mOzMecSg3coZopQ7A5dsNPU3Tt+BbjE1 WZFCOlU7W/qhgxTOm/KmSb0UCQfMtpZ8UCarsZtU8dS/XtLFtGHtN8WKDdVWzJZV nHZHQGhs7K4+wjiJd6S9lFD8eYSCjpC+AID03lvZ2jaBHm3bkqnT71br9BbNDlYc 3174rJLvtQwmpZ4M6P+j0Rzxhltu08Q6RapaFesdkMAa0GjNkurcV+DPSRdyQosA == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedutddrieeigdduvdegucetufdoteggodetrfdotf 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 DF6B2E465F; Wed, 20 Mar 2019 15:23:01 -0400 (EDT) Subject: FAILED: patch "[PATCH] Btrfs: setup a nofs context for memory allocation at" failed to apply to 4.9-stable tree To: fdmanana@suse.com, dsterba@suse.com, nborisov@suse.com Cc: From: Date: Wed, 20 Mar 2019 20:23:00 +0100 Message-ID: <15531097808170@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.9-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 a0873490660246db587849a9e172f2b7b21fa88a Mon Sep 17 00:00:00 2001 From: Filipe Manana Date: Thu, 13 Dec 2018 21:16:56 +0000 Subject: [PATCH] Btrfs: setup a nofs context for memory allocation at __btrfs_set_acl We are holding a transaction handle when setting an acl, therefore we can not allocate the xattr value buffer using GFP_KERNEL, as we could deadlock if reclaim is triggered by the allocation, therefore setup a nofs context. Fixes: 39a27ec1004e8 ("btrfs: use GFP_KERNEL for xattr and acl allocations") 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/acl.c b/fs/btrfs/acl.c index 3b66c957ea6f..5810463dc6d2 100644 --- a/fs/btrfs/acl.c +++ b/fs/btrfs/acl.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include "ctree.h" @@ -72,8 +73,16 @@ static int __btrfs_set_acl(struct btrfs_trans_handle *trans, } if (acl) { + unsigned int nofs_flag; + size = posix_acl_xattr_size(acl->a_count); + /* + * We're holding a transaction handle, so use a NOFS memory + * allocation context to avoid deadlock if reclaim happens. + */ + nofs_flag = memalloc_nofs_save(); value = kmalloc(size, GFP_KERNEL); + memalloc_nofs_restore(nofs_flag); if (!value) { ret = -ENOMEM; goto out;