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=-1.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,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 BD25AC43381 for ; Wed, 27 Mar 2019 16:49:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9849D20645 for ; Wed, 27 Mar 2019 16:49:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727234AbfC0Qtz (ORCPT ); Wed, 27 Mar 2019 12:49:55 -0400 Received: from smtp03.citrix.com ([162.221.156.55]:48116 "EHLO SMTP03.CITRIX.COM" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726990AbfC0Qtz (ORCPT ); Wed, 27 Mar 2019 12:49:55 -0400 X-IronPort-AV: E=Sophos;i="5.60,277,1549929600"; d="scan'208";a="81992541" Subject: Re: gfs2 iomap dealock, IOMAP_F_UNBALANCED To: Andreas Gruenbacher , Dave Chinner CC: Christoph Hellwig , cluster-devel , Mark Syms , =?UTF-8?B?RWR3aW4gVMO2csO2aw==?= , linux-fsdevel References: <20190321131304.21618-1-agruenba@redhat.com> <20190321214345.GE26298@dastard> <20190322002100.5628-1-agruenba@redhat.com> From: Ross Lagerwall Message-ID: <6e564e4b-2366-8728-c1cb-3467aad2d0f0@citrix.com> Date: Wed, 27 Mar 2019 16:49:47 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: <20190322002100.5628-1-agruenba@redhat.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org On 3/22/19 12:21 AM, Andreas Gruenbacher wrote: > On Fri, 22 Mar 2019 at 00:01, Andreas Gruenbacher wrote: >> On Thu, 21 Mar 2019 at 22:43, Dave Chinner wrote: >>> The problem is calling balance_dirty_pages() inside the >>> ->iomap_begin/->iomap_end calls and not that it is called by the >>> iomap infrastructure itself, right? >>> >>> Is so, I'd prefer to see this in iomap_apply() after the call to >>> ops->iomap_end because iomap_file_buffered_write() can iterate and >>> call iomap_apply() multiple times. This would keep the balancing to >>> a per-iomap granularity, rather than a per-syscall granularity. >>> >>> i.e. if we do write(2GB), we want more than one balancing call >>> during that syscall, so it would be up to the filesystem to a) limit >>> the size of write mappings to something smaller (e.g. 1024 pages) >>> so that there are still frequent balancing calls for large writes. >> >> Hmm. The looping across multiple mappings isn't done in iomap_apply >> but in iomap_file_buffered_write, so the balancing could go into >> iomap_apply or iomap_file_buffered_write, but can't go further up the >> stack. Given that, iomap_file_buffered_write seems the better place, >> but this is still quite horrible. > > Here's a more reasonable version of my first patch, with a cleaned up > and hopefully fixed gfs2 part. > > In addition, this checks for IOMAP_F_UNBALANCED in iomap_dirty_actor, > the actor for iomap_file_dirty. We don't use iomap_file_dirty in gfs2, > but we should probably allowing to skip the dirty page balancing there > as well. > > Thanks, > Andreas > --- > fs/gfs2/bmap.c | 64 +++++++++++++++++++++++++++++++++---------- > fs/iomap.c | 6 ++-- > include/linux/iomap.h | 1 + > 3 files changed, 55 insertions(+), 16 deletions(-) > Thanks, this fixes the reported deadlock. I haven't yet checked whether it has any performance impact. Tested-by: Ross Lagerwall