Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp1697294pxp; Thu, 17 Mar 2022 14:49:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyVT56w1ukDYTHN82PxjrzUs6q+ny2DN4WfyzF8j7lqGMfkyJ26hwwT4IpiYfpuDymRpp6E X-Received: by 2002:a62:1407:0:b0:4fa:6d31:1056 with SMTP id 7-20020a621407000000b004fa6d311056mr617570pfu.7.1647553782393; Thu, 17 Mar 2022 14:49:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647553782; cv=none; d=google.com; s=arc-20160816; b=F3WIQSX5gmmfWr1AFjY0+kpEjY9LkYFzIhigRk+Fw+Amid1qG6c9PEdBExMce3u1Rg LWumqu1OwknNqkafs+DUfyKb1WP/1x9/CtcB24EkzEj1nCKd1AIs2HpjTvQ8RUVoZwL6 8YmvJjEI4Na5BNlBOpDJx8QX5xaADO6/heRUFt/T6+mBGNYGm3fRou1LgZVJSOKqs8IK pvXyZGSaqm3mvSmUvOSXZ4G91NgLcLZHrnvq6iwk5RwIh2nLQEO99qEZYqMjLpWKutJp /wDNb0vfPDMtBOodEPwyyzLHXacCSvIwdiKws9CoIIsn7h86xJ1C0PS5iyeBe1EpPxFb 1BUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=mQVi/8AUGelccD6B82H7IX/Q4dG4lWAcNI5AMJjQ7Ww=; b=ptwIDOF+N1iHH103tL+J+oFFRy2IVFsndo15w863slmNamS0YrhAnjvLfDoEs7kLoM HwiPYe7rkQUw8GiIW+7qvmGH1+N8cS9RGyeNYpcJ9bblbybf+TvcGrT7NQO9PdMdZlBI Em//5uPqO/RrQTTC94yCTYbVlDcoD90sh1PQLfsmUOTPyQGQ2HkdoCn7dG+CJgkpc7JR PZq4em/qRvgqDb57TXhWhdVWKVRnuEJ0ktHAD54nBUlL/URcdcx48KKl6FTJ26fjfvkQ 5DerjH5pHIyldw/8XHP5mzuO9Ps8qYxuo1UZplYJ5YBtv1w375DbufvCJJ5fV4qLCOzv C/UA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=hJe+x6yp; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id d184-20020a6336c1000000b003816043f010si3553841pga.517.2022.03.17.14.49.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Mar 2022 14:49:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=hJe+x6yp; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 4A87D1AAFC0; Thu, 17 Mar 2022 14:16:42 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230163AbiCQVRq (ORCPT + 99 others); Thu, 17 Mar 2022 17:17:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57842 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230135AbiCQVRq (ORCPT ); Thu, 17 Mar 2022 17:17:46 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 65F0A1A7770; Thu, 17 Mar 2022 14:16:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=mQVi/8AUGelccD6B82H7IX/Q4dG4lWAcNI5AMJjQ7Ww=; b=hJe+x6ypYZMPRYM+nzGb+mzE3o M4G15eQPY+WAdTrlxvOCmJxVkqSZvod7K8f+G3t1ZECiN/R9M9rrWjBJymo282e1laNhQutHt8jE3 eaJAmEcmTMVF3VAi8UZALMXOSsqaA2iDoghRHxTzSil6AMVmdndedIPoecexanjGyfPJuviG1gGce l8MIKXuzvBfPYYSDo3bv47PYE0zQDThYogTCLghFBfK6Ph6cp7lYNFQQfMq65hF6Vpfjmw9zB806A B4Wf4GAQMQ598uNZ+qDtoA7Wxj+OJFt27QVkKml6t4YMiBuC1wUNAW/XEYNwij4+//zDgcsGCDI4y TLkcR+GQ==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nUxTo-007KMx-A5; Thu, 17 Mar 2022 21:16:20 +0000 Date: Thu, 17 Mar 2022 21:16:20 +0000 From: Matthew Wilcox To: Linus Torvalds Cc: Brian Foster , Linux-MM , linux-fsdevel , linux-xfs , Hugh Dickins , Namjae Jeon , Ashish Sangwan , Theodore Ts'o , Jan Kara , linux-ext4@vger.kernel.org Subject: Re: writeback completion soft lockup BUG in folio_wake_bit() Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Thu, Mar 17, 2022 at 12:26:35PM -0700, Linus Torvalds wrote: > On Thu, Mar 17, 2022 at 8:04 AM Matthew Wilcox wrote: > > > > So how about we do something like this: > > > > - Make folio_start_writeback() and set_page_writeback() return void, > > fixing up AFS and NFS. > > - Add a folio_wait_start_writeback() to use in the VFS > > - Remove the calls to set_page_writeback() in the filesystems > > That sounds lovely, but it does worry me a bit. Not just the odd > 'keepwrite' thing, but also the whole ordering between the folio bit > and the tagging bits. Does the ordering possibly matter? I wouldn't change the ordering of setting the xarray bits and the writeback flag; they'd just be set a little earlier. It'd all be done while the page was still locked. But you're right, there's lots of subtle interactions here. > That whole "xyz_writeback_keepwrite()" thing seems odd. It's used in > only one place (the folio version isn't used at all): > > ext4_writepage(): > > ext4_walk_page_buffers() fails: > redirty_page_for_writepage(wbc, page); > keep_towrite = true; > ext4_bio_write_page(). > > which just looks odd. Why does it even try to continue to do the > writepage when the page buffer thing has failed? > > In the regular write path (ie ext4_write_begin()), a > ext4_walk_page_buffers() failure is fatal or causes a retry). Why is > ext4_writepage() any different? Particularly since it wants to keep > the page dirty, then trying to do the writeback just seems wrong. > > So this code is all a bit odd, I suspect there are decades of "people > continued to do what they historically did" changes, and it is all > worrisome. I found the commit: 1c8349a17137 ("ext4: fix data integrity sync in ordered mode"). Fortunately, we have a documented test for this, generic/127, so we'll know if we've broken it.