From patchwork Thu Feb 15 06:36:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13557435 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id A40DCC4829E for ; Thu, 15 Feb 2024 06:37:09 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B5C346B00AB; Thu, 15 Feb 2024 01:37:08 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id AE20B6B00AC; Thu, 15 Feb 2024 01:37:08 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7D4FA6B00AC; Thu, 15 Feb 2024 01:37:08 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 65AF56B00A9 for ; Thu, 15 Feb 2024 01:37:08 -0500 (EST) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 0612C1402E5 for ; Thu, 15 Feb 2024 06:37:08 +0000 (UTC) X-FDA: 81793080936.10.926F1C7 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf09.hostedemail.com (Postfix) with ESMTP id 30FB6140005 for ; Thu, 15 Feb 2024 06:37:02 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=Rp1jtgBv; dmarc=none; spf=none (imf09.hostedemail.com: domain of BATV+a252b21bd4a653ddb6e6+7480+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+a252b21bd4a653ddb6e6+7480+infradead.org+hch@bombadil.srs.infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1707979024; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=5GhhuDyIOonlmDg/Vr+y+ffKK6l+9T3rNZ2pDiaN6Ho=; b=YEicOUuVZA1InwGTefRbpAqpeJ/HjN06uM+0U9tXGyK7YqkTiHvd0iIqPCbgWozOPdSR7c q6Mppvwd0DiNNrPYU8+5+gQLFAFChJIsBaSVhPyZSawvGGHWEUcmLfjN1wRmbrBY4g5gIY SNz75BDYqRj46q/1174ZAiPN9UqSmCc= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=Rp1jtgBv; dmarc=none; spf=none (imf09.hostedemail.com: domain of BATV+a252b21bd4a653ddb6e6+7480+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+a252b21bd4a653ddb6e6+7480+infradead.org+hch@bombadil.srs.infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1707979024; a=rsa-sha256; cv=none; b=QRNJItqllDVHEYeDRBgoFQchU7OykEtnI/Gdp+e1D/ySQln8bK5X0j4PWQr37VPyXeme4L nRLIThWLfOkBN4Z0leyfuwmxruFvsFKW+v8koBsBvWTk1HIH5wMMLjbh0iSyIVWwo9s0Ei c8NFkkU2YZ7X6XNFyZQb3bkrh96Fjhk= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=5GhhuDyIOonlmDg/Vr+y+ffKK6l+9T3rNZ2pDiaN6Ho=; b=Rp1jtgBvUtxVvNXp1sP56Ko4Aa gktEnrNCtkAvu7DLUea8tY8oFyjpctbtKJQBqAp/Y3F+AZE9f2WmupbVNkGAO/jVSuRg5osa1TJDa 5HXAMzm+rMKBxQw9f7g4YK38K2o2ZFM+2H8bJ08bAzZkL1d+WINW1Y+Pyn5UTq5dBzEnZ+yjgvrFc sTCCoQbU4LXqQbKUy6a6VISm3ggtoKihCXjmjG39/Ss9iIJFzecFVDLrIGrRf0JkdJcMjIRDWvDvB W0RXMYe1UBA0Vz6LnvyBO7Kbu6iVlmtQLIc/rbe6hSdf+UvEL+qMgQSU3ERH/uI3ylw1dPHiRL5cL kWnYLxfQ==; Received: from 2a02-8389-2341-5b80-39d3-4735-9a3c-88d8.cable.dynamic.v6.surfer.at ([2a02:8389:2341:5b80:39d3:4735:9a3c:88d8] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1raVMj-0000000F6rJ-3g8h; Thu, 15 Feb 2024 06:37:02 +0000 From: Christoph Hellwig To: linux-mm@kvack.org Cc: Matthew Wilcox , Jan Kara , David Howells , Brian Foster , Christian Brauner , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 01/14] writeback: don't call mapping_set_error on AOP_WRITEPAGE_ACTIVATE Date: Thu, 15 Feb 2024 07:36:36 +0100 Message-Id: <20240215063649.2164017-2-hch@lst.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240215063649.2164017-1-hch@lst.de> References: <20240215063649.2164017-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 30FB6140005 X-Stat-Signature: 84dqia3qhmbu3oqcimmr8uey4c7moyg9 X-HE-Tag: 1707979022-828261 X-HE-Meta: U2FsdGVkX19U+dH8ybn/TrgbCL/o/Qn2L6Yq5w0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bs9OtOY+8pbk+fUGmQgMlAWPVq8pxnwel3A4PhHEfGK0/xICW1wYqL22AnDywbFU/iUo0pqt+TX8/98wcw== 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: List-Subscribe: List-Unsubscribe: mapping_set_error should only be called on 0 returns (which it ignores) or a negative error code. writepage_cb ends up being able to call writepage_cb on the magic AOP_WRITEPAGE_ACTIVATE return value from ->writepage which means success but the caller needs to unlock the page. Ignore that and just call mapping_set_error on negative errors. (no fixes tag as this goes back more than 20 years over various renames and refactors so I've given up chasing down the original introduction) Signed-off-by: Christoph Hellwig Reviewed-by: Jan Kara Reviewed-by: Brian Foster --- mm/page-writeback.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mm/page-writeback.c b/mm/page-writeback.c index 3f255534986a2f..703e83c69ffe08 100644 --- a/mm/page-writeback.c +++ b/mm/page-writeback.c @@ -2535,7 +2535,9 @@ static int writepage_cb(struct folio *folio, struct writeback_control *wbc, { struct address_space *mapping = data; int ret = mapping->a_ops->writepage(&folio->page, wbc); - mapping_set_error(mapping, ret); + + if (ret < 0) + mapping_set_error(mapping, ret); return ret; }