Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp6445635rwd; Mon, 19 Jun 2023 07:24:52 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ67vsHQS+G26zSi9z38kFuoOu9rsk9PRCVvNgP8boXl2rEY9V/JwjzD7Q52ucVieuBiivXo X-Received: by 2002:a17:902:efca:b0:1b5:1573:7d96 with SMTP id ja10-20020a170902efca00b001b515737d96mr9489129plb.59.1687184692109; Mon, 19 Jun 2023 07:24:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687184692; cv=none; d=google.com; s=arc-20160816; b=Z1JImFnJ6WkuYnfCjkEYfpU80wdU+4zJyno8FNKDV/6BApVWUU08+mVYuyfpsmKBkl nd/8aBNOr2ulX0R3O7Ku16wJFe0Cn3mSWHv8VqIJeuqUUaA1rP9qxGmueWRztN3+pEwG l/DVqNcK6SMV0ggbTeTrCGeAIy4GLks1UFh8RZEiLgdxAKTldGdZWh8O6LkvKYOaxW5q 8BcZwro+ngcWH0xGAOP8OMvjbFuJnDcIqPjQIARYmQW30UurTW9nCeynTpNzZmBvBoTa rjcix7mwJGKL1gbQZZKxOOOCqjLNNfXShP09ebGus1SghpWW4ZLZpgwCDK3ybn1O0F2G +ERA== 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=D31vA8JX9DN+/zyM3aRK1TEDXyUSGbv3rJjPwoSWc28=; b=kXRZ7msRndBDdoPi11ztorlkEjLbKRfcXDNVnXQRVJogGcl40fHgAd3yvMw7gRPSBr HQjPP29eCY1UksvrIsYdynjSv0jg9JsPweupNf1Lq3Dvvpjfaw9PRlWw6soOBzSh/wfm 2GDa3pgmgUe+lBnGuMlOuIKm+CX1kL70dgv2UJsR5CzV+a5Z7CVA/2/9svJmoOnNgHMx hnAug7DVAy+YuMvePLMWm63UY2YuKW9kxIUPA3mf5XDiMEPHZzapQ0EoVvqKmDH+yIt1 wxLFP0tIQdA1gm10bgOuKSRiCYUvYOfAD4UoZSHUl/e2LbZJ51dWyeXzc2rsNMcZghKm qnNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=SFmz8hgr; 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 i17-20020a170902c95100b001b3b250fd1csi1332677pla.301.2023.06.19.07.24.36; Mon, 19 Jun 2023 07:24:52 -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=SFmz8hgr; 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 S232024AbjFSNnG (ORCPT + 99 others); Mon, 19 Jun 2023 09:43:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232006AbjFSNnF (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.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B89D4E78 for ; Mon, 19 Jun 2023 06:42:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687182136; 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=D31vA8JX9DN+/zyM3aRK1TEDXyUSGbv3rJjPwoSWc28=; b=SFmz8hgrAcfjQSm1FuOqHfFArCiF8CiefNdqRuzWGo9o0gYNzR4pLd+7IGOkUJeIWTXj+9 EvCBaj/lCCkmmr2bhPRYcFnKAYpsy5w89BW2a8v6yzHgk9Zs2gYXznZTjyOaIw7BXQNbBa p4y9oUtYO9NBHV1vBnrRMnN09oZXkNY= 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-292-Lf93kQWeN1uQcqW1Z8TCFA-1; Mon, 19 Jun 2023 09:42:10 -0400 X-MC-Unique: Lf93kQWeN1uQcqW1Z8TCFA-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 080D785A59D; Mon, 19 Jun 2023 13:42:10 +0000 (UTC) Received: from warthog.procyon.org.com (unknown [10.42.28.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id 272D040C6E8E; Mon, 19 Jun 2023 13:42:09 +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 1/2] afs: Fix dangling folio ref counts in writeback Date: Mon, 19 Jun 2023 14:42:03 +0100 Message-ID: <20230619134204.922713-2-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.2 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, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,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. If writeback needs rescheduling, the function exits without dropping the references to the folios in fbatch. This patch fixes that. [DH: Moved the added line before the _leave()] 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-1-vishal.moola@gmail.com/ --- fs/afs/write.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/afs/write.c b/fs/afs/write.c index c822d6006033..fd433024070e 100644 --- a/fs/afs/write.c +++ b/fs/afs/write.c @@ -763,6 +763,7 @@ static int afs_writepages_region(struct address_space *mapping, if (wbc->sync_mode == WB_SYNC_NONE) { if (skips >= 5 || need_resched()) { *_next = start; + folio_batch_release(&fbatch); _leave(" = 0 [%llx]", *_next); return 0; }