From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4CA5643302F; Tue, 21 Jul 2026 19:49:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784663346; cv=none; b=IRqiFqVjqc0H6NJK/l2uZsn7pN5JS9762K6sHbf+4z6zqZu5cSRCoqF90iuYnyUnlhlVf15+d9j8qggZP0ADmOU4Ef7Lj+RVnGZA7OUX5rSiX/fWNvy2OdrVTQDgvf5ml4ZLob7eC9lpTq7f5QrY8pHIqf/67LHvcS77nuMAbPM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784663346; c=relaxed/simple; bh=ugiHKKb1+MsaroLb+TGUQdaNKtw3DLz9SmZvLOpPJIo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=q+9+Vvzh/qA3zqfYw8EcYMv5VNPn+gdNJRfYpgpmqvNeBdJ/1emOjt2BXWGUvQnY9M6YDj1K3km/esH554VZVTOKBceRU+TXKP4VNzB/WoX4yP8HnV/2jhvgxBWn/PC31rC+66iDXy47yquudvbv2sByiKUB6WIx2ESiQqQY+d4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=yIahByJU; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="yIahByJU" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B880A1F00A3D; Tue, 21 Jul 2026 19:49:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784663345; bh=mW0uG9xbRO/vZ2bhVVbp7rn/u3kd5ZM2t+ghPFX3EkA=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=yIahByJUULEBWYwKuvhBao5upxJ30WlKTFqgvY2ApQd2Vu351KfZ7RegwqhKFwsso jb2Ugks2V4igpcC6r/SGHoPMRfosKpWX45ex84a5b7AUaELO0JbYUt4iOLZ4ECidyJ ce/vpZx3RK6tB4WBq9faXyL2qKQTEmYcWCPZCvEA= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, David Howells , Paulo Alcantara , Matthew Wilcox , netfs@lists.linux.dev, linux-fsdevel@vger.kernel.org, "Christian Brauner (Amutable)" , Sasha Levin Subject: [PATCH 6.12 0745/1276] netfs: Fix writeback error handling Date: Tue, 21 Jul 2026 17:19:48 +0200 Message-ID: <20260721152502.752381051@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260721152446.065700225@linuxfoundation.org> References: <20260721152446.065700225@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: netfs@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: David Howells [ Upstream commit ac5f95ac5d6d0f4c567b8b642825705a2bf0d79e ] Fix the error handling in writeback_iter() loop. If an error occurs, writeback_iter() needs to be called again with *error set to the error so that it can clean up iteration state. Further, the current folio needs unlocking and redirtying. Fixes: 288ace2f57c9 ("netfs: New writeback implementation") Link: https://sashiko.dev/#/patchset/20260619140646.2633762-1-dhowells%40redhat.com Signed-off-by: David Howells Link: https://patch.msgid.link/20260625140640.3116900-14-dhowells@redhat.com cc: Paulo Alcantara cc: Matthew Wilcox cc: netfs@lists.linux.dev cc: linux-fsdevel@vger.kernel.org Signed-off-by: Christian Brauner (Amutable) Signed-off-by: Sasha Levin --- fs/netfs/write_issue.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/fs/netfs/write_issue.c b/fs/netfs/write_issue.c index 2789ac4c80272b..7431c0a4252c4c 100644 --- a/fs/netfs/write_issue.c +++ b/fs/netfs/write_issue.c @@ -574,8 +574,6 @@ int netfs_writepages(struct address_space *mapping, } error = netfs_write_folio(wreq, wbc, folio); - if (error < 0) - break; } while ((folio = writeback_iter(mapping, wbc, folio, &error))); netfs_end_issue_write(wreq); @@ -587,7 +585,14 @@ int netfs_writepages(struct address_space *mapping, return error; couldnt_start: - netfs_kill_dirty_pages(mapping, wbc, folio); + if (error == -ENOMEM) { + folio_redirty_for_writepage(wbc, folio); + folio_unlock(folio); + folio = writeback_iter(mapping, wbc, folio, &error); + WARN_ON_ONCE(folio != NULL); + } else { + netfs_kill_dirty_pages(mapping, wbc, folio); + } out: mutex_unlock(&ictx->wb_lock); _leave(" = %d", error); -- 2.53.0