Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp6429948rwd; Mon, 19 Jun 2023 07:13:12 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7/lPEYpgj9RksOQG3rC/nCSob+KYLaEuk2qYs1YbmxPmZd+Y3PLjbL358cw8pf29vLc04x X-Received: by 2002:a05:6a20:3d92:b0:11d:38ea:7586 with SMTP id s18-20020a056a203d9200b0011d38ea7586mr13441330pzi.9.1687183992221; Mon, 19 Jun 2023 07:13:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687183992; cv=none; d=google.com; s=arc-20160816; b=oiAzOJDsTPAIUtdI8mcwMw9dPG0cN/VcH4y+cjUxL7RBQs9uU6bzHW6akiSyeW7k24 vxtrhl/5A9f5E9OJKsnZxaIUjtXjKnsAsTksav//cnKYwAwNsI+/tgNWvuY2OPGytpXI XxSRK4hInyPKsJX2EKufOACuTBL7bhyQbTqImB2vmoj0o+tA2VBaLoOQagitYt18puc4 oTWPeUF58bNKx0SITFtT2EyPJqVWK4cwVYCe5EAGiTg8PdYDu/5f2MS1h0xvz2sA6VgU XOLFehcMiTNLL8vIqQg0SvGox56GMO1qqrF7CWlBQ+lr4agedmQ4g8QMm7s/Fd24b1ZG DV4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=tmhBzVk04OxjQU7+mvQb9QjdfMiM2IPBAE5pRAjvCBI=; b=vKgf4x4tBvDUUAtKU+cHn2ME7/D7qRuU0ZqFhwFiPuWmH2vBXhsR11CWuvmmvvzJTz wyMHASqdYj4S4xXGO/o04sm6+Kljs3YuwEZJDfnaMwedpB7NqfBYIvp4vYZ1JLqQqX7i w1p91IGuDX8cb3xbG/CweKdHyP/VoU7NWWV995H2X9/RoKlX8HkEAa9JxTuIe8bVgyvP R/I2qvbPE2cVagBT6WbOEr4ATMAxz2W/1SKLqAZNz/Pt3ZZzf0N7gBw9RV2PnC9Oq9Pz bX0DqyzZR1zdJu/KHQSeyC248nEXTFBZ8QgfMN3GAum5Tab9ZhfvadpfQa/fQC/zwAja x8Bg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Iy1fh8dX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f30-20020aa79d9e000000b0063b60063f55si19556913pfq.382.2023.06.19.07.12.57; Mon, 19 Jun 2023 07:13:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Iy1fh8dX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232034AbjFSNnK (ORCPT + 99 others); Mon, 19 Jun 2023 09:43:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42754 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232010AbjFSNnF (ORCPT ); Mon, 19 Jun 2023 09:43:05 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F1C3AE63 for ; Mon, 19 Jun 2023 06:42:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687182137; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=tmhBzVk04OxjQU7+mvQb9QjdfMiM2IPBAE5pRAjvCBI=; b=Iy1fh8dXS/0t22BInAub8YC+oI8WenROAbdPlINjeDlFdJ3fCp8u4++aoAxHBgs4vKcpZ/ +7ao7h4eiITrlBQYJoQZCBqBmJ+l4jddGbdH+kJfeZOR7zhtVWG9yo03dNY0t+wMXZlm+T iII+J4w32SjEmnTO3hthdh926oqJZIs= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-401-cY5mjncINvWwWGUMnL5--g-1; Mon, 19 Jun 2023 09:42:11 -0400 X-MC-Unique: cY5mjncINvWwWGUMnL5--g-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6D65685A58C; Mon, 19 Jun 2023 13:42:11 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id 906D8C1603B; Mon, 19 Jun 2023 13:42:10 +0000 (UTC) From: David Howells To: Linus Torvalds Cc: David Howells , Marc Dionne , linux-afs@lists.infradead.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, "Vishal Moola (Oracle)" Subject: [PATCH 2/2] afs: Fix waiting for writeback then skipping folio Date: Mon, 19 Jun 2023 14:42:04 +0100 Message-ID: <20230619134204.922713-3-dhowells@redhat.com> In-Reply-To: <20230619134204.922713-1-dhowells@redhat.com> References: <20230619134204.922713-1-dhowells@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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-kernel@vger.kernel.org From: "Vishal Moola (Oracle)" Commit acc8d8588cb7 converted afs_writepages_region() to write back a folio batch. The function waits for writeback to a folio, but then proceeds to the rest of the batch without trying to write that folio again. This patch fixes has it attempt to write the folio again. [DH: Also remove an 'else' that adding a goto makes redundant] Fixes: acc8d8588cb7 ("afs: convert afs_writepages_region() to use filemap_get_folios_tag()") Signed-off-by: Vishal Moola (Oracle) Signed-off-by: David Howells cc: Marc Dionne cc: linux-afs@lists.infradead.org Link: https://lore.kernel.org/r/20230607204120.89416-2-vishal.moola@gmail.com/ --- fs/afs/write.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fs/afs/write.c b/fs/afs/write.c index fd433024070e..8750b99c3f56 100644 --- a/fs/afs/write.c +++ b/fs/afs/write.c @@ -731,6 +731,7 @@ static int afs_writepages_region(struct address_space *mapping, * (changing page->mapping to NULL), or even swizzled * back from swapper_space to tmpfs file mapping */ +try_again: if (wbc->sync_mode != WB_SYNC_NONE) { ret = folio_lock_killable(folio); if (ret < 0) { @@ -757,9 +758,10 @@ static int afs_writepages_region(struct address_space *mapping, #ifdef CONFIG_AFS_FSCACHE folio_wait_fscache(folio); #endif - } else { - start += folio_size(folio); + goto try_again; } + + start += folio_size(folio); if (wbc->sync_mode == WB_SYNC_NONE) { if (skips >= 5 || need_resched()) { *_next = start;