Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp5214233ybl; Tue, 27 Aug 2019 00:54:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqzY4P2kV1Lnn4Q/mDnPKCpaCVMe3hkuUuATfFsju/ZV6HXU5lMMNCMc3qq2xr61OeBdOWH/ X-Received: by 2002:a17:90a:e2ca:: with SMTP id fr10mr8103465pjb.72.1566892498030; Tue, 27 Aug 2019 00:54:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566892498; cv=none; d=google.com; s=arc-20160816; b=D7pe+ieGGu/PFPu6jQhRGOrjn16SihW/Yx3P5XFPsIn/3LsvLJM5D8ReuuRHhH6jNJ UDzphbT9CnDwBOFceRIZIQYxagd27UmMmVFe/zgFlYfTfp+w6bg0/t3/1UTqPKxOqV2b L6E6rf/CdqxmkE4Txx4+//uULsWc7gZA46ZIc/RkEE9a3PlOPGDKccJbTomAOUKZGgGj q+9vYFczvUeb35iiBl3Za//9RlVldI58JJE7BugWnND3UN1TP+UscGb4enue3QA1SjkI pr7kZF0+p/FTvIPW/TFes6nwWjhAmoO8OCtB24kcH/D7Gy1tha0wAcObuL8ZSpXPaond e1mw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=vq5KRgehVkJqRnzshSGGwOqybEHDdxN50SwQBweASKs=; b=bOSYk0aDWDRUx90M44QHj6O82O0KOp9QwjpHaGrgEnz7M3EdD9j2HqZbFWEemi0/UE H6fsscXdVwXAHhgMOrkjPeoura5mn1A+GmvDqUjNoK2aJk+hfOqwltQlJPOMKfyuhllp I4W+WtIiDOdF54/DCW/I6r+y6Y8qtcPTBV/TB00SykeoJzfofLSXtJwxPUiseg/aAD3z XqEAD94cmMLshPDACwas9aOPsd64pbNKLTkBBLLIaZKlvh3mwIMl1oJQmnazAgqKP6Y6 ox9bAmnkj1xl6B1lGMeUBo0qEZp1OjnVvopr0JjhxTmuNnJonexaAvBtVzFq5Bnl6eZR zFXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=GEwBolOS; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u70si11462044pgd.1.2019.08.27.00.54.42; Tue, 27 Aug 2019 00:54:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=GEwBolOS; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729732AbfH0HxQ (ORCPT + 99 others); Tue, 27 Aug 2019 03:53:16 -0400 Received: from mail.kernel.org ([198.145.29.99]:44674 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728836AbfH0HxM (ORCPT ); Tue, 27 Aug 2019 03:53:12 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 16F81217F5; Tue, 27 Aug 2019 07:53:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1566892391; bh=7WN0+bMcTcvSSgmiL/qEoFkf9ghDb+NMHD8d+5s8cCk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GEwBolOSq5yEK4MxfpBhchu1U95lHU55Z7BahAt3F3J5KD+5Bbe+udwQQxL6MQD95 w4/9qBjovhIx/0zJUv/9+lpim+E8S0yM65QC3Xi4I25BqeENKFEjO2uAZkmGyALzRj +epuF+SPFPzwwbBrmC03pT0MzJ7F7bU/3imB1rqs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mikulas Patocka , Mike Snitzer Subject: [PATCH 4.14 38/62] Revert "dm bufio: fix deadlock with loop device" Date: Tue, 27 Aug 2019 09:50:43 +0200 Message-Id: <20190827072702.856629894@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190827072659.803647352@linuxfoundation.org> References: <20190827072659.803647352@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mikulas Patocka commit cf3591ef832915892f2499b7e54b51d4c578b28c upstream. Revert the commit bd293d071ffe65e645b4d8104f9d8fe15ea13862. The proper fix has been made available with commit d0a255e795ab ("loop: set PF_MEMALLOC_NOIO for the worker thread"). Note that the fix offered by commit bd293d071ffe doesn't really prevent the deadlock from occuring - if we look at the stacktrace reported by Junxiao Bi, we see that it hangs in bit_wait_io and not on the mutex - i.e. it has already successfully taken the mutex. Changing the mutex from mutex_lock to mutex_trylock won't help with deadlocks that happen afterwards. PID: 474 TASK: ffff8813e11f4600 CPU: 10 COMMAND: "kswapd0" #0 [ffff8813dedfb938] __schedule at ffffffff8173f405 #1 [ffff8813dedfb990] schedule at ffffffff8173fa27 #2 [ffff8813dedfb9b0] schedule_timeout at ffffffff81742fec #3 [ffff8813dedfba60] io_schedule_timeout at ffffffff8173f186 #4 [ffff8813dedfbaa0] bit_wait_io at ffffffff8174034f #5 [ffff8813dedfbac0] __wait_on_bit at ffffffff8173fec8 #6 [ffff8813dedfbb10] out_of_line_wait_on_bit at ffffffff8173ff81 #7 [ffff8813dedfbb90] __make_buffer_clean at ffffffffa038736f [dm_bufio] #8 [ffff8813dedfbbb0] __try_evict_buffer at ffffffffa0387bb8 [dm_bufio] #9 [ffff8813dedfbbd0] dm_bufio_shrink_scan at ffffffffa0387cc3 [dm_bufio] #10 [ffff8813dedfbc40] shrink_slab at ffffffff811a87ce #11 [ffff8813dedfbd30] shrink_zone at ffffffff811ad778 #12 [ffff8813dedfbdc0] kswapd at ffffffff811ae92f #13 [ffff8813dedfbec0] kthread at ffffffff810a8428 #14 [ffff8813dedfbf50] ret_from_fork at ffffffff81745242 Signed-off-by: Mikulas Patocka Cc: stable@vger.kernel.org Fixes: bd293d071ffe ("dm bufio: fix deadlock with loop device") Depends-on: d0a255e795ab ("loop: set PF_MEMALLOC_NOIO for the worker thread") Signed-off-by: Mike Snitzer Signed-off-by: Greg Kroah-Hartman --- drivers/md/dm-bufio.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/md/dm-bufio.c +++ b/drivers/md/dm-bufio.c @@ -1630,7 +1630,9 @@ dm_bufio_shrink_scan(struct shrinker *sh unsigned long freed; c = container_of(shrink, struct dm_bufio_client, shrinker); - if (!dm_bufio_trylock(c)) + if (sc->gfp_mask & __GFP_FS) + dm_bufio_lock(c); + else if (!dm_bufio_trylock(c)) return SHRINK_STOP; freed = __scan(c, sc->nr_to_scan, sc->gfp_mask);