Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp3032706rdb; Tue, 13 Feb 2024 05:07:48 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWLDBHJkvoho9jQ4rKzE9uKcs12wmXB5r9cQGDbcIFMoEgZ5IWMcPYnQBbB1YBOtXwKVLU0G+yHPy6E0Lo9Pt4kGc7x4x2HUiq0fuLgNA== X-Google-Smtp-Source: AGHT+IHRIFsZDnGddG2zcheQcQA8u4tJ8s5Etb3TyO2H2Blrz8nsdvsOrGMmbZbo76noC1qZrAys X-Received: by 2002:a05:6214:b6c:b0:68c:cb14:781f with SMTP id ey12-20020a0562140b6c00b0068ccb14781fmr13859925qvb.4.1707829668593; Tue, 13 Feb 2024 05:07:48 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707829668; cv=pass; d=google.com; s=arc-20160816; b=l/vkORodS34fiNdAH8NXu4ZeD0h/1yS5oWGW8Aqb+uaE9OZAOsz2vYo2B1B2drKdDw 6WdM92CRO38Rrxo2Bk9dV+PRuPg5Z7uAB9MQUeD+zb0+G6lWO8Zq6CYkR6Gb79MXOr3m U91gUNy0jEGBxo1ahGlnTslUU9+TsNdRmX4/cbc1V+P3VQUbHz+jgrdC8bLZbRa5ftfu ouSvGumu/NtIvPw7zpOVPPAeYED2fytne5mo8buyG1lqDwOjRwvrKQQuWv6VSnVrE/Bh c4jFLLgX9D5wMY7sYwBBYEPRSvBB7ThOI6iZJk773JNZXMFeD3tnqNZucjj7fsH9Lp9I BuTw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature:dkim-signature:dkim-signature :dkim-signature; bh=Q5FJCSnLqnNyazb+BdbAUm/bf4ECqcxsT2qE0k5mX/c=; fh=UmXjCqgLiH47A7wDk63cjExYixaPoq5tmDDfdgUcdvY=; b=zuzrEAdMZIsLhlwC4FVfwukiO//odwwPdWXeHfw3UV/x7Ed0B+F9PWK2G8oUd1CXkN DxVl1lsSZyki57g/dm2KgR2OkGcEKpjtq5j5qD83NvYdXSomGDt2weBLeJ/9YxY5Apyo SqxPNbc1nm0j6o9kJlpBCWLuzM6+5UhNyaWL6o/G9GMBEumbH42NVVnyrh4w1hq7iEWQ WhSrg6LTrgbY0e83tEUhHRXLsRX4//+CGiivNKQx65zurihvEZl7AcCmf9e54NU7NpJs t+7Gl2QSqDLg/YaiKcFGY/GjRAOVBW13EzQ1FYf+x1qyP5+A97LdOkSn7itgpsfRzMlS M2Vw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=XWMtBOKN; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=ULMXA+zd; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; arc=pass (i=1 spf=pass spfdomain=suse.cz dkim=pass dkdomain=suse.cz dkim=pass dkdomain=suse.cz); spf=pass (google.com: domain of linux-kernel+bounces-63561-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-63561-linux.lists.archive=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=2; AJvYcCX9hrOSDuTkLGS4ARctMGrsEeWmotGSFhUFdqDuemJqy8rkLQU5ha2gVO8c8LReD21q/II7HJo6pXTh3fTZ4uaUCg/N17+KVboKgHNyGA== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id jq12-20020ad45fcc000000b006818957c5f9si2729181qvb.570.2024.02.13.05.07.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Feb 2024 05:07:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-63561-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=XWMtBOKN; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=ULMXA+zd; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; arc=pass (i=1 spf=pass spfdomain=suse.cz dkim=pass dkdomain=suse.cz dkim=pass dkdomain=suse.cz); spf=pass (google.com: domain of linux-kernel+bounces-63561-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-63561-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 4F14C1C22EC0 for ; Tue, 13 Feb 2024 13:07:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A978451C35; Tue, 13 Feb 2024 13:07:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b="XWMtBOKN"; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b="JpVtSt3g"; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b="ULMXA+zd"; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b="0LMl4fxq" Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0B2694F21C; Tue, 13 Feb 2024 13:07:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.130 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707829643; cv=none; b=NPqHoj2fkeF/GyQlpzLUeZvSb1tjHl3csaWNPUki57RpZMgwCuwC3pJ9RuLWgM209mAWvoQgMyu4yM0Ev5imXY7BRwoV1OJwnjgNxDshbNk5iNuTSKFEmbb8oJ0VWZkQzuNvRsWE+9qbDfuxUR/6jUdA4jyd9pQGodGFzSVYdew= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707829643; c=relaxed/simple; bh=xfLzTtWr0zy4eVlJ9PAOvXwQ0pAQaXBAK+VvjTyHsJA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ZYXLUjq3vtZyVigGSNl1rZexDCGRSuCbnkXOMKyrarU6+4HZdbLzuX5EvyMTIW+xIdT0BTROmKtW1Sac1pNEih9IiFP4JURkwQKE8UvWpDYGSRrLy9wCYoWQRn9Pdu8/C3FDpVOGafXJ2bUcQq5eY1RBXjVDzzGB62hm/fyBnk4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz; spf=pass smtp.mailfrom=suse.cz; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b=XWMtBOKN; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b=JpVtSt3g; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b=ULMXA+zd; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b=0LMl4fxq; arc=none smtp.client-ip=195.135.223.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.cz Received: from imap2.dmz-prg2.suse.org (imap2.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:98]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 154C821E35; Tue, 13 Feb 2024 13:07:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1707829640; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Q5FJCSnLqnNyazb+BdbAUm/bf4ECqcxsT2qE0k5mX/c=; b=XWMtBOKNIeNJMb2mgTxA4UoWNskoWJiTfREaiC95jKCr/cb3EIzfhUvNAm/Uo16tvEsIde 4Gs48tOX77u0gyTtHpvWaOBFScI7O6pgYaeQvP76SWg0x/lyHwjSKrI0gQ+wlxWOFaXPDL wj9kSGuLKWcdapctg+1uK6DAx2jmt60= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1707829640; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Q5FJCSnLqnNyazb+BdbAUm/bf4ECqcxsT2qE0k5mX/c=; b=JpVtSt3gbscUGCnQqvcUcRC5D37KNyCtUoZLMczltRHtw4DRPIQxefOOo8kgqgqdQMigLW 097Uf/NP2iJNCECw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1707829638; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Q5FJCSnLqnNyazb+BdbAUm/bf4ECqcxsT2qE0k5mX/c=; b=ULMXA+zdkocVYYu1UI2zhOep75kcTa2IWlj//PfYF2Gjn8XtDFZsB03KOQEETuGHNkGXas dkI0Cf284yNQzN5lggJt9Z5/tkJmJqLi9+1X8nhfJipZQPBMDCMLDcWJ+9iWbA32HmGLTb 4f2SZIDVwStFOtDa7gtuaBvEqZQ7L4g= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1707829638; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Q5FJCSnLqnNyazb+BdbAUm/bf4ECqcxsT2qE0k5mX/c=; b=0LMl4fxqR8Qt/QcZ8GwQUEanxEY6zIgY20z3Z1CqU71N/t1bzNTuqlVX0Ws440/WgkVPtx tmbfr/F3C9Za4yAw== Received: from imap2.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap2.dmz-prg2.suse.org (Postfix) with ESMTPS id 0546E13A0E; Tue, 13 Feb 2024 13:07:18 +0000 (UTC) Received: from dovecot-director2.suse.de ([10.150.64.162]) by imap2.dmz-prg2.suse.org with ESMTPSA id SPX0AIZpy2UoWwAAn2gu4w (envelope-from ); Tue, 13 Feb 2024 13:07:18 +0000 Received: by quack3.suse.cz (Postfix, from userid 1000) id 930DBA0809; Tue, 13 Feb 2024 14:07:13 +0100 (CET) Date: Tue, 13 Feb 2024 14:07:13 +0100 From: Jan Kara To: Christoph Hellwig Cc: linux-mm@kvack.org, Matthew Wilcox , Jan Kara , David Howells , Brian Foster , Christian Brauner , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 01/14] writeback: don't call mapping_set_error in writepage_cb Message-ID: <20240213130713.ysuxaqcwizqwjke2@quack3> References: <20240212071348.1369918-1-hch@lst.de> <20240212071348.1369918-2-hch@lst.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240212071348.1369918-2-hch@lst.de> Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=ULMXA+zd; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=0LMl4fxq X-Spamd-Result: default: False [-1.31 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:98:from]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; RCVD_DKIM_ARC_DNSWL_HI(-1.00)[]; RCVD_COUNT_THREE(0.00)[3]; DKIM_SIGNED(0.00)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519]; DKIM_TRACE(0.00)[suse.cz:+]; MX_GOOD(-0.01)[]; RCPT_COUNT_SEVEN(0.00)[9]; DBL_BLOCKED_OPENRESOLVER(0.00)[lst.de:email,suse.com:email,suse.cz:dkim]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; MID_RHS_NOT_FQDN(0.50)[]; RCVD_IN_DNSWL_HI(-0.50)[2a07:de40:b281:104:10:150:64:98:from]; RCVD_TLS_ALL(0.00)[] X-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-Rspamd-Queue-Id: 154C821E35 X-Spam-Level: X-Spam-Score: -1.31 X-Spam-Flag: NO On Mon 12-02-24 08:13:35, Christoph Hellwig wrote: > writepage_cb is the iterator callback for write_cache_pages, which > already tracks all errors and returns them to the caller. There is > no need to additionally cal mapping_set_error which is intended ^^^ call > for contexts where the error can't be directly returned (e.g. the > I/O completion handlers). > > Remove the mapping_set_error call in writepage_cb which is not only > superfluous but also buggy as it can be called with the error argument > set to AOP_WRITEPAGE_ACTIVATE, which is not actually an error but a > magic return value asking the caller to unlock the page. > > Signed-off-by: Christoph Hellwig Our error handling in writeback has always been ... spotty. E.g. block_write_full_page() and iomap_writepage_map() call mapping_set_error() as well so this seems to be a common way to do things, OTOH ext4 calls mapping_set_error() only on IO completion. I guess the question is how an error in ->writepages from background writeback should propagate to eventual fsync(2) caller? Because currently such error propagates all the way up to writeback_sb_inodes() where it is silently dropped... Honza > --- > mm/page-writeback.c | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) > > diff --git a/mm/page-writeback.c b/mm/page-writeback.c > index 3f255534986a2f..62901fa905f01e 100644 > --- a/mm/page-writeback.c > +++ b/mm/page-writeback.c > @@ -2534,9 +2534,8 @@ static int writepage_cb(struct folio *folio, struct writeback_control *wbc, > void *data) > { > struct address_space *mapping = data; > - int ret = mapping->a_ops->writepage(&folio->page, wbc); > - mapping_set_error(mapping, ret); > - return ret; > + > + return mapping->a_ops->writepage(&folio->page, wbc); > } > > int do_writepages(struct address_space *mapping, struct writeback_control *wbc) > -- > 2.39.2 > -- Jan Kara SUSE Labs, CR