Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp6962256ybh; Thu, 8 Aug 2019 08:15:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqx/5ry9rJfVRKAEubhgcQI3xht+sRnv4Iqr+l2uPbC9Vo0WcX4lHHFDHkGGoWy7r8UvNYTM X-Received: by 2002:a17:902:2aab:: with SMTP id j40mr13579788plb.76.1565277321447; Thu, 08 Aug 2019 08:15:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565277321; cv=none; d=google.com; s=arc-20160816; b=Rp/WKJEGB7ibbclqJE6ealVDOAC/8IlbjABoyUyUH5NgittavS/IObLL3HiuTpZOWB olwGdunyHHJFFBgvOnrWd74G48rVTpCjoEiqXnCzMt00yFZ8+BxdrgVq8vmSdYVS/8vg X4iGA12YCiXpAqqR/AN8KH6z1VFpU8FPnh3IxisYaOor4lHTAqf/0Iw4j48PK05o2Axa 5TGrGRN/YNr787Sszy4FoUItLP6akQijBXeZAz0e/XJMTvt/qFZHEDGkzpbrzyvLlPR3 QIYTfaz5twLFuBmlVKCGkPc9UDerNnzuLfN/9SgMnnaf6miPKB1b9Hll2DjeFCsEWVi9 Zxng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date; bh=810MyBTttZUGZcdSUdoJB1ESSYFwa9XfuY72nV405Uk=; b=yGRYaonlNDj4tu6CUTD7Odjnk2CudbKVe2nkQUvnZi1AMRDDa/C0c6UlrXcERDJFgG 7QApXaOKXqqh704vTbko0rARBEjxeiJH6S3+8yifyTwMLxbjjGKp+I4zl28eIc7/MC36 tWJ+xkXUyM1CqAVStLlRhlpqih+uMXjXbDR7+4QKVOlOHnXI6/69nwHi2VuFgKpd231p 7b2DJEfFRgo4k2iwIJvnTDD+r9KtqbKUMkAlmeVl0pnHPN0/YZPs36w5VkcUEVLuuH8e cp6DshX1AEAwBkTL4npZXpYGvcQORyPr3nDw5uoRayaGsMutIZRwPBEzOs+i7Tzg8URL AvSg== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d5si3835857pla.93.2019.08.08.08.15.05; Thu, 08 Aug 2019 08:15:21 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388481AbfHHPN7 (ORCPT + 99 others); Thu, 8 Aug 2019 11:13:59 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54620 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730678AbfHHPN6 (ORCPT ); Thu, 8 Aug 2019 11:13:58 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 606B93066FA7; Thu, 8 Aug 2019 15:13:58 +0000 (UTC) Received: from file01.intranet.prod.int.rdu2.redhat.com (file01.intranet.prod.int.rdu2.redhat.com [10.11.5.7]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 86F145D9E1; Thu, 8 Aug 2019 15:13:51 +0000 (UTC) Received: from file01.intranet.prod.int.rdu2.redhat.com (localhost [127.0.0.1]) by file01.intranet.prod.int.rdu2.redhat.com (8.14.4/8.14.4) with ESMTP id x78FDo4j019011; Thu, 8 Aug 2019 11:13:50 -0400 Received: from localhost (mpatocka@localhost) by file01.intranet.prod.int.rdu2.redhat.com (8.14.4/8.14.4/Submit) with ESMTP id x78FDoGF019007; Thu, 8 Aug 2019 11:13:50 -0400 X-Authentication-Warning: file01.intranet.prod.int.rdu2.redhat.com: mpatocka owned process doing -bs Date: Thu, 8 Aug 2019 11:13:50 -0400 (EDT) From: Mikulas Patocka X-X-Sender: mpatocka@file01.intranet.prod.int.rdu2.redhat.com To: Matthew Wilcox cc: Alexander Viro , "Darrick J. Wong" , Mike Snitzer , junxiao.bi@oracle.com, dm-devel@redhat.com, Alasdair Kergon , honglei.wang@oracle.com, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-xfs@vger.kernel.org Subject: Re: [PATCH] direct-io: use GFP_NOIO to avoid deadlock In-Reply-To: <20190808135329.GG5482@bombadil.infradead.org> Message-ID: References: <20190808135329.GG5482@bombadil.infradead.org> User-Agent: Alpine 2.02 (LRH 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Thu, 08 Aug 2019 15:13:58 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 8 Aug 2019, Matthew Wilcox wrote: > On Thu, Aug 08, 2019 at 05:50:10AM -0400, Mikulas Patocka wrote: > > A deadlock with this stacktrace was observed. > > > > The obvious problem here is that in the call chain > > xfs_vm_direct_IO->__blockdev_direct_IO->do_blockdev_direct_IO->kmem_cache_alloc > > we do a GFP_KERNEL allocation while we are in a filesystem driver and in a > > block device driver. > > But that's not the problem. The problem is the loop driver calls into the > filesystem without calling memalloc_noio_save() / memalloc_noio_restore(). > There are dozens of places in XFS which use GFP_KERNEL allocations and > all can trigger this same problem if called from the loop driver. OK. I'll send a new patch that sets PF_MEMALLOC_NOIO in the loop driver. Mikulas