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=-3.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no 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 51785C561F8 for ; Wed, 21 Oct 2020 07:40:42 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C98C222251 for ; Wed, 21 Oct 2020 07:40:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="key not found in DNS" (0-bit key) header.d=szeredi.hu header.i=@szeredi.hu header.b="k3WmRGdA" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C98C222251 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=szeredi.hu Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id E93FD6B005C; Wed, 21 Oct 2020 03:40:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E44626B0062; Wed, 21 Oct 2020 03:40:39 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D33496B006E; Wed, 21 Oct 2020 03:40:39 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0098.hostedemail.com [216.40.44.98]) by kanga.kvack.org (Postfix) with ESMTP id A19476B005C for ; Wed, 21 Oct 2020 03:40:39 -0400 (EDT) Received: from smtpin16.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 242ED8344768 for ; Wed, 21 Oct 2020 07:40:39 +0000 (UTC) X-FDA: 77395135398.16.sugar76_5200a7827246 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin16.hostedemail.com (Postfix) with ESMTP id F354B1029370C for ; Wed, 21 Oct 2020 07:40:38 +0000 (UTC) X-HE-Tag: sugar76_5200a7827246 X-Filterd-Recvd-Size: 4263 Received: from mail-vs1-f65.google.com (mail-vs1-f65.google.com [209.85.217.65]) by imf34.hostedemail.com (Postfix) with ESMTP for ; Wed, 21 Oct 2020 07:40:38 +0000 (UTC) Received: by mail-vs1-f65.google.com with SMTP id l6so705851vsr.7 for ; Wed, 21 Oct 2020 00:40:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=szeredi.hu; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=+mtQOW6D1USj4MjnIX8atmYyrC1zhErL4qFSeejgPT8=; b=k3WmRGdAFyK8jMXfE7roxIWmia7TeryL7DVPGIAhx9S8ozMk7jwNZD668y6Oz1Faeg 5LN/AUxEQjonkjrr6wX1s0YwcnZz617LCFPrybtchZ6pzczGLmjPbeyemtzPkAMnv930 OO83ISIcg5X4BmqFg0rFSEowJmZ3z8w7i3SX8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=+mtQOW6D1USj4MjnIX8atmYyrC1zhErL4qFSeejgPT8=; b=qrjSusj3ZJqa9CdiLy5khvHrnL9h3KuLRWbpeH/KnLLBpDyxkDoLsOGO3pfanxfltB rBUWJvr5OjarA4jTIIXTzhuZCmXruKGfrGjFQWMeHOAdJmgFwOYyJLXm/VEpDNp1unpt 145j7YGVmV+MT/UXCh88BRH5f5U8NfiJgglJrlFCvnLNWWciOl3BYpLbK6HDwOEWPmo3 3ZwTR30XjLj+inCApnB/+QRAAjjmAytGNxks0E/vTv/DVytwghzULbsquBKnPDbJg3Dd JCZojO5kRtsJEiloOT5dcNmy9cc8ez4jnAmDJtO9gzSkIPfbibqhCzuq9gx1CEG6988t THoQ== X-Gm-Message-State: AOAM530tqVGQ0prFVWbKf1tGJZld3gM1L4HOuX19Qt7N9CJDMg4oRBG4 wzgXRSYYHseMEyPyVCB+eC0vNmlepiDREoeRDoPuwA== X-Google-Smtp-Source: ABdhPJxsPR/XLiWCus69OSm6AV0nscBgh+CbaaNx3IONePVwbpD6FAXRc791kqaLdWxN/7qWOH8bmMck3vMq/vJ25ng= X-Received: by 2002:a05:6102:21aa:: with SMTP id i10mr849419vsb.9.1603266037215; Wed, 21 Oct 2020 00:40:37 -0700 (PDT) MIME-Version: 1.0 References: <4794a3fa3742a5e84fb0f934944204b55730829b.camel@lca.pw> <20201015151606.GA226448@redhat.com> <20201015195526.GC226448@redhat.com> <20201020204226.GA376497@redhat.com> In-Reply-To: <20201020204226.GA376497@redhat.com> From: Miklos Szeredi Date: Wed, 21 Oct 2020 09:40:26 +0200 Message-ID: Subject: Re: Possible deadlock in fuse write path (Was: Re: [PATCH 0/4] Some more lock_page work..) To: Vivek Goyal Cc: Linus Torvalds , Qian Cai , Hugh Dickins , Matthew Wilcox , "Kirill A . Shutemov" , Linux-MM , Andrew Morton , linux-fsdevel , Amir Goldstein Content-Type: text/plain; charset="UTF-8" X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Tue, Oct 20, 2020 at 10:42 PM Vivek Goyal wrote: > As you said, for the full page WRITE, we can probably mark it > page uptodate write away and drop page lock (Keep reference and > send WRITE request to fuse server). For the partial page write this will > not work and there seem to be atleast two options. > > A. Either we read the page back from disk first and mark it uptodate. > > B. Or we keep track of such partial writes and block any further > reads/readpage/direct_IO on these pages till partial write is > complete. After that looks like page will be left notuptodate > in page cache and reader will read it from disk. We are doing > something similar for tracking writeback requests. It is much > more complicated though and we probably can design something > simpler for these writethrough/synchronous writes. > > I am assuming that A. will lead to performance penalty for short > random writes. C. Keep partial tail page locked. If write involves a partial and head AND tail page, then read head page first. I think that would be a good compromise between performance and simplicity. WDYT? Thanks, Miklos