From patchwork Mon Jan 16 08:55:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13102753 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 65D10C46467 for ; Mon, 16 Jan 2023 08:55:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3B2DF6B0074; Mon, 16 Jan 2023 03:55:45 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 315A16B0075; Mon, 16 Jan 2023 03:55:45 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 18DCE6B0078; Mon, 16 Jan 2023 03:55:45 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 048D66B0074 for ; Mon, 16 Jan 2023 03:55:45 -0500 (EST) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id C81C8407FD for ; Mon, 16 Jan 2023 08:55:44 +0000 (UTC) X-FDA: 80360054208.26.CDC2517 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf07.hostedemail.com (Postfix) with ESMTP id B335A40012 for ; Mon, 16 Jan 2023 08:55:41 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=Jv+WhniY; spf=none (imf07.hostedemail.com: domain of BATV+12421fe7f975503e585d+7085+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+12421fe7f975503e585d+7085+infradead.org+hch@bombadil.srs.infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1673859342; 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=OG2B/ZSWByZRN4fMNjXk/odq7YMNkG/R7DDN5iMhUtQ=; b=mD3H/nHM1CeApzZpwQdxUA2q3Lfd6yHpqNgKA7oXlVuOtgi//sQS+xJ5Kj3M2XDqvw12aO 5kvSGnGouMOpSIsz6/oZy3OfTVip+xW5AlpP2IuxWzjTTAPucexrX5MMa6nabOykP0pB/S zZhFoxzOgFHtVwP7E9v1Mjo2k9NiMW0= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=Jv+WhniY; spf=none (imf07.hostedemail.com: domain of BATV+12421fe7f975503e585d+7085+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+12421fe7f975503e585d+7085+infradead.org+hch@bombadil.srs.infradead.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1673859342; a=rsa-sha256; cv=none; b=xkUbiCTWmpfqghGQZ0mopZuQDgksmCu/lYXcCoS1JeAjlnyYZZ2CVervg5Ab3AZLJjgMKW fkcqPD5rNrlPQglheZ6GLp55jcILmZNNgjl2saK8kXMySXLvhaytMylwukumTBod6MYGS+ SmyANYQ5YVUvPc3U1rAA0LujMT9Vv68= 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=OG2B/ZSWByZRN4fMNjXk/odq7YMNkG/R7DDN5iMhUtQ=; b=Jv+WhniY9VGch/zC8+PJm+chhT /+rHupK5uBALMlQaZjsepoMcl0mFl8uuNrYuXeGgWwGj280ui4kquded1Op5jmigdG0CjbLd+GpKk XFjxxRaTMGGMYG/Opr2gTEVG87otTdyk3f8TYMf9cI3e7X5AhB4ud2Di9Ptan7y6agqCRO2RhWRsv Hhx+g/gzwuId7dh/3Wc8WfDcAdvNfyWswpDFfQCatswiEOV9LxxHcAHtjbj0lRK9O/lYSyK3ZTARP 3MFPat1picSmsva4N/FL6ON2qSYkYLSo9kJf0HEAU3aCjtxxKnU9sMTH3fcrzJ3qOIfIKQjh4fQoa FeKc/8kQ==; Received: from [2001:4bb8:19a:2039:c63c:c37c:1cda:3fb2] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1pHLH6-009Eea-02; Mon, 16 Jan 2023 08:55:28 +0000 From: Christoph Hellwig To: Andrew Morton , Mark Fasheh , Joel Becker , Joseph Qi , Evgeniy Dushistov , "Matthew Wilcox (Oracle)" Cc: ocfs2-devel@oss.oracle.com, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 1/6] minix: fix error handling in minix_delete_entry Date: Mon, 16 Jan 2023 09:55:18 +0100 Message-Id: <20230116085523.2343176-2-hch@lst.de> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230116085523.2343176-1-hch@lst.de> References: <20230116085523.2343176-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-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: B335A40012 X-Rspam-User: X-Stat-Signature: uo58piegspx919axn9c8oe3587z49aw9 X-HE-Tag: 1673859341-753780 X-HE-Meta: U2FsdGVkX18Lz5aGcxk8AO4zgPXLllPbrHBNAewCwchpUXEG3OaXNxOo73eIulW8H+dUmVzMoR3bnB7jqAii83ZeB4+D7635+khFoA4KTZVjEWCK0Dj3ozZ3i7Ajt374Esrc4VicxhvcOltoaU5eLuF73Dd2wcDSocZi0V4S6B3wTB/NoNM4YkOP49xXbMhoRI44vJXERotL350CyNpsatJzMbs+90v2IGY3yrDU2ZlUEhixIwGGgc0J3uRMWj+SnU9+hiZD7sfuhFvsqYH+BcJ6+Qj2fBdX3346n80SmunycED4DeS18/kjQhkKfVAZz3WF2bNLilpFnzvOoWyXlpqz/mPL7FDi9RBJ/VdaTmjzA51EYVJa5qtEOErHZHKoOzEnX8N8PrXmJvKcIHo4QipjZcp02TspuS6/geMwr9y762dZ1lEXlgmD4jwUUD/ksyrd8KM7E8Vh2qxeIdJs5v7DcKFgnpzo//qi931r6wpV0kTxkq5l9n3aXT4ZKpSRZ3SckDAt8WPpp7X3kFp9r6Kj3uGE3uC66ETA1eQ9+IrN5SRsZMQBoR2V5/UIZceLy2vMG/xEzuz8n++pbxamJcFEIbQFNUVi8gPgbl4gh6DAV0CGT8Qx7WVZ07uqQE9yt9MjBcIWWHBV3cNRbCBsVQR9PVKOrHvvBC8no/86kisOESPYHt7iajCh+F4kaBe1fojHEmD5lUnsVUaY2utF5bFWQc8sMV6eW+MJQFPnhDW6ca7v24bR+VazsYf0SrIUF/6dbW/ULVA7GmPqHI+zhAvJk0wm+TZNFwgOS77RWimahQdGWuum6lGx7AiPT12AJdWTs8XnOFpkm/pDDwri6PIwqON73fwTyekqxZ1pBhB/xtdlq+tz6TM6ewE2tXvHpPogWWoJ3NuWIvTnx+SoSLJQmxuAsffks3wUpUt2VLiLQQUA9pH2cPvv7G0JwOd41LxXkpDoMDhuOKbOViF FLS4GU/D VcEdhCogf8aK83M6fnnhGqcQl6pQKdrb6k8vpS0dVcsm3YWYmd1aLw7HSjGsIYdn/zNC7GFJC/Z0k2itVfhmvDk7h1i7mAdiURhz7FICOoXIIQqOwijBR/kWy9eFTmwT7G+ahiNZMpsP0hkrLCINSvYe+ZCUhTcPDuIgaiN8UnAsfJZYc+QyhUm1erjLdyrgScts4Q5nvboQFHhi2glvECJq2MoQ7Nm6wqBeG 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: If minix_prepare_chunk fails, updating c/mtime and marking the dir inode dirty is wrong, as the inode hasn't been modified. Note that this moves the dir_put_page call later, but that matches other uses of this helper in the directory code. Signed-off-by: Christoph Hellwig --- fs/minix/dir.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/fs/minix/dir.c b/fs/minix/dir.c index dcfe5b25378b54..a8e76284cb71ec 100644 --- a/fs/minix/dir.c +++ b/fs/minix/dir.c @@ -297,18 +297,19 @@ int minix_delete_entry(struct minix_dir_entry *de, struct page *page) lock_page(page); err = minix_prepare_chunk(page, pos, len); - if (err == 0) { - if (sbi->s_version == MINIX_V3) - ((minix3_dirent *) de)->inode = 0; - else - de->inode = 0; - err = dir_commit_chunk(page, pos, len); - } else { + if (err) { unlock_page(page); + goto out_put_page; } - dir_put_page(page); + if (sbi->s_version == MINIX_V3) + ((minix3_dirent *)de)->inode = 0; + else + de->inode = 0; + err = dir_commit_chunk(page, pos, len); inode->i_ctime = inode->i_mtime = current_time(inode); mark_inode_dirty(inode); +out_put_page: + dir_put_page(page); return err; } From patchwork Mon Jan 16 08:55:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13102751 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 61BC2C67871 for ; Mon, 16 Jan 2023 08:55:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7AA626B0072; Mon, 16 Jan 2023 03:55:44 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 733B46B0073; Mon, 16 Jan 2023 03:55:44 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5D3466B0074; Mon, 16 Jan 2023 03:55:44 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 4411B6B0073 for ; Mon, 16 Jan 2023 03:55:44 -0500 (EST) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 1E49D407B4 for ; Mon, 16 Jan 2023 08:55:44 +0000 (UTC) X-FDA: 80360054208.03.9B72705 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf08.hostedemail.com (Postfix) with ESMTP id 4A3D6160011 for ; Mon, 16 Jan 2023 08:55:42 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b="ax/Y5gnT"; dmarc=none; spf=none (imf08.hostedemail.com: domain of BATV+12421fe7f975503e585d+7085+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+12421fe7f975503e585d+7085+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=1673859342; 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=NG71ox6jr7uM23QDAMDsMfdxiN0WqWQj6pY4BZkkyg4=; b=lZst0jCEEn4i2Dae2Veiv/s3dr2BQoXkZ0uHXaUtn01RLSGMqxBfU/tlRM32j6WkmwPahz rcf/3WkbQ9w1A0jQ5gkIZRSNSWgOR7XuASAHmWGvHSS7M7iwgNik6W2v4EnwHiq7nmoZw3 CrWkqTeHj1+VUEmorX+QXH69wQtxuow= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b="ax/Y5gnT"; dmarc=none; spf=none (imf08.hostedemail.com: domain of BATV+12421fe7f975503e585d+7085+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+12421fe7f975503e585d+7085+infradead.org+hch@bombadil.srs.infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1673859342; a=rsa-sha256; cv=none; b=4f2p8goq6k8dWIqmM4uIFG8Gu2PAGvhzTt1GkMeXsT+TIdwFcM9HaI5cmjfzyQq4cKuMHd O6jYzdba4L/QJPwuIkUyQOPpry1pzR64Il4ia7y2uBBSARhqkG86m+Ml2+WF7IIhQ91W9g DXTakXUpBwyd60jbxzxNp5JG9E89TO4= 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=NG71ox6jr7uM23QDAMDsMfdxiN0WqWQj6pY4BZkkyg4=; b=ax/Y5gnTZrhv4w+jf2OeQVm0tO ApYJIKsK4ZXfMVwKWlqPdLSJGP7kZIKwE+8CcUbfwwIAFByrMjNSd07pUOBcF66nJ5xWCREc2zMkU 6mQdASNdx+VRTkGlDR6nv34V1Gyn0I0mgWr5vC6NPNwqutc4UvBh0Fclq2irNimI4eewwgg36uQdO fLLkCZXLsoD2eFF6L1iPPsq0srwwA50/WBOJGtJgd6NxY3jjsggeAISiUmyxXvl/WudhRuyFHtfm1 mUmQWnGtNpkbvWi694jhOU5G5hCEQcsB1/CbOSDSPOS+AuNO46i3WVwUrCXrGG3oKZbpzYuFdcpMd vHS2daEQ==; Received: from [2001:4bb8:19a:2039:c63c:c37c:1cda:3fb2] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1pHLH8-009EfR-M6; Mon, 16 Jan 2023 08:55:31 +0000 From: Christoph Hellwig To: Andrew Morton , Mark Fasheh , Joel Becker , Joseph Qi , Evgeniy Dushistov , "Matthew Wilcox (Oracle)" Cc: ocfs2-devel@oss.oracle.com, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 2/6] minix: fix error handling in minix_set_link Date: Mon, 16 Jan 2023 09:55:19 +0100 Message-Id: <20230116085523.2343176-3-hch@lst.de> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230116085523.2343176-1-hch@lst.de> References: <20230116085523.2343176-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: rspam02 X-Rspamd-Queue-Id: 4A3D6160011 X-Stat-Signature: khze44ns89xshpamtoyxbc7gebpzzd1j X-HE-Tag: 1673859342-197519 X-HE-Meta: U2FsdGVkX1+MyPZhpb2ZqGGFn60nwqOgRqub16Kc7OxegaDJTC6l64XtpBew+gzUKIjxyUWBDyKSycKWDGmQ8eX0XS+wC3J++8GCyKEHXCUnVsuB1w5OdeKP3DmcYdp3rxnpLiMxiBO7pM2GVuEjvqFRt9r0I0yZQWgWWSg5chzcsMmME96fiyzjS2WGDIedPGVF1v9oIB4n4s1YMbwq51GSiPnnrk1A2mi8j41dm5mnWCBUi06jG6WRgILy6hP32IHB+JJEopU5XsNfWzOE2dBDjpxH9wgPun/7T24iF/OC3FdQlnLWKa/gRj4OItRO3k5moxrlLrQrDYs9jR0arYeC1W/U2kfXFpCEgiJpH0cSiddTjqvpbfHHgceNUzisSio/4nbnarVswz/H2Al3e4oqCaHnF65hSLn2Zv4m6g6jkUC4inRVFa/LZQpfpgisEKg+FXp3+TL6dwTuSFLmRSA32t3XNy2M9iBa3O3m1excY+mkcawx4EfYQ/1/t2rSk90BS7vKtc9vBoDdqOPelUj3oZhOgX14pbn3KW8tNHwoKV5C9ZABi+yhXZay9VhacHE32d7IRt9TQb0ZajkWkL8m3zfdnI/3XRZmq+WwlwsAy0nwh0JOngwE9ghVRSnZrfCdWyNO8dPemCBuq6MJO0efKSLWpZcF5Kx4gJGeXTzUMlobEa6PYPUHx4qNttZQArd368dn+hugO2L2sESpFze9jpLvSE52OgUtIIdyizebhF26BWkmLp7gGXrrXHJREcty5t9RTXCk83/2d6dNxN3SeL6vnMDn2leV3CMBVUlntc3xh/OfxhNv4hca1nixibEB4PuQiLyCoyPUUWQ55hhIArhOtY/uiEaimNBCPHnnRYqASsWpMoaw0//N5/Xxk+l1gwR/D0hRPIVXmuH1WlvLw/kCJ2gjidC7BVmiiEGNTFrb8U28lqAL1v9ls9V50qGZMTQFh01/irB2X1S 9TKkyk2e Gk8PTQfCN8Ln58F+15COkH4lC8dgTG4Rrk0GGnfB/RL3UpOqfS+tjsbJy4OFuk2BuB8jXSjPoFCWwn7cAwzROvAjUolO3WtB/IRhTDKlhQCaKF9aQk5U6BJ7XOv6nesa4x6BVDouwFsX7NHuDpu9b3qGUkE3B4Htx4dvGEfmKVTg5ijYUOZceeW8eG8bfwijM2Ae0ZYX80JNpEBFwgSQ30yvFYo8nDgIxzBh4UszQwwmBP7E= 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: If minix_prepare_chunk fails, updating c/mtime and marking the dir inode dirty is wrong, as the inode hasn't been modified. Also propagate the error to the caller. Note that this moves the dir_put_page call later, but that matches other uses of this helper in the directory code. Signed-off-by: Christoph Hellwig --- fs/minix/dir.c | 23 ++++++++++++----------- fs/minix/minix.h | 3 ++- fs/minix/namei.c | 8 +++++--- 3 files changed, 19 insertions(+), 15 deletions(-) diff --git a/fs/minix/dir.c b/fs/minix/dir.c index a8e76284cb71ec..c9a3d520b72671 100644 --- a/fs/minix/dir.c +++ b/fs/minix/dir.c @@ -410,8 +410,8 @@ int minix_empty_dir(struct inode * inode) } /* Releases the page */ -void minix_set_link(struct minix_dir_entry *de, struct page *page, - struct inode *inode) +int minix_set_link(struct minix_dir_entry *de, struct page *page, + struct inode *inode) { struct inode *dir = page->mapping->host; struct minix_sb_info *sbi = minix_sb(dir->i_sb); @@ -420,20 +420,21 @@ void minix_set_link(struct minix_dir_entry *de, struct page *page, int err; lock_page(page); - err = minix_prepare_chunk(page, pos, sbi->s_dirsize); - if (err == 0) { - if (sbi->s_version == MINIX_V3) - ((minix3_dirent *) de)->inode = inode->i_ino; - else - de->inode = inode->i_ino; - err = dir_commit_chunk(page, pos, sbi->s_dirsize); - } else { + if (err) { unlock_page(page); + goto out_put_page; } - dir_put_page(page); + if (sbi->s_version == MINIX_V3) + ((minix3_dirent *)de)->inode = inode->i_ino; + else + de->inode = inode->i_ino; + err = dir_commit_chunk(page, pos, sbi->s_dirsize); dir->i_mtime = dir->i_ctime = current_time(dir); mark_inode_dirty(dir); +out_put_page: + dir_put_page(page); + return err; } struct minix_dir_entry * minix_dotdot (struct inode *dir, struct page **p) diff --git a/fs/minix/minix.h b/fs/minix/minix.h index 20217336802570..8f7a636bd1b241 100644 --- a/fs/minix/minix.h +++ b/fs/minix/minix.h @@ -69,7 +69,8 @@ extern int minix_add_link(struct dentry*, struct inode*); extern int minix_delete_entry(struct minix_dir_entry*, struct page*); extern int minix_make_empty(struct inode*, struct inode*); extern int minix_empty_dir(struct inode*); -extern void minix_set_link(struct minix_dir_entry*, struct page*, struct inode*); +int minix_set_link(struct minix_dir_entry *de, struct page *page, + struct inode *inode); extern struct minix_dir_entry *minix_dotdot(struct inode*, struct page**); extern ino_t minix_inode_by_name(struct dentry*); diff --git a/fs/minix/namei.c b/fs/minix/namei.c index 8afdc408ca4fd5..82d46c28f01b01 100644 --- a/fs/minix/namei.c +++ b/fs/minix/namei.c @@ -223,7 +223,9 @@ static int minix_rename(struct user_namespace *mnt_userns, new_de = minix_find_entry(new_dentry, &new_page); if (!new_de) goto out_dir; - minix_set_link(new_de, new_page, old_inode); + err = minix_set_link(new_de, new_page, old_inode); + if (err) + goto out_dir; new_inode->i_ctime = current_time(new_inode); if (dir_de) drop_nlink(new_inode); @@ -240,10 +242,10 @@ static int minix_rename(struct user_namespace *mnt_userns, mark_inode_dirty(old_inode); if (dir_de) { - minix_set_link(dir_de, dir_page, new_dir); + err = minix_set_link(dir_de, dir_page, new_dir); inode_dec_link_count(old_dir); } - return 0; + return err; out_dir: if (dir_de) { From patchwork Mon Jan 16 08:55:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13102752 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 D5588C678D6 for ; Mon, 16 Jan 2023 08:55:46 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C3F5A6B0073; Mon, 16 Jan 2023 03:55:44 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id BA0406B0074; Mon, 16 Jan 2023 03:55:44 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A043E6B0078; Mon, 16 Jan 2023 03:55:44 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 86B5C6B0074 for ; Mon, 16 Jan 2023 03:55:44 -0500 (EST) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id E9B4116075E for ; Mon, 16 Jan 2023 08:55:43 +0000 (UTC) X-FDA: 80360054166.01.2117F79 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf21.hostedemail.com (Postfix) with ESMTP id 53ECD1C0002 for ; Mon, 16 Jan 2023 08:55:42 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=mRy4maM9; dmarc=none; spf=none (imf21.hostedemail.com: domain of BATV+12421fe7f975503e585d+7085+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+12421fe7f975503e585d+7085+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=1673859342; 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=QCNp0MjEp23ArfIJ213HXzBCfkQxI9y/8H4Y/9jbIO4=; b=JhckcQq1MDFUYwKXYiKJ3TAk3nS/TW2NongI6Nc7gKPWk9lNfutpj67f+Fa0f2BhlIMdIg K7wSC+mHvve+CWcUGTGNJNKfnwtv1dTKkCjx8YHgzugUfMjCtG7oWe6yh46nKl2COQ9PfT d65v7wiQYRwJheCqq/cjj3mDtJC+4qM= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=mRy4maM9; dmarc=none; spf=none (imf21.hostedemail.com: domain of BATV+12421fe7f975503e585d+7085+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+12421fe7f975503e585d+7085+infradead.org+hch@bombadil.srs.infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1673859342; a=rsa-sha256; cv=none; b=36JkwI5rZkaiX/g7xfyYPeR7D6ar+th/ceOPBuEph6fRIC8P7Ag4qOdqdLWMwEaGWAMWMk veDAO+d/j4hZIwjMFEaoYq+tbLLRNnjdoVuxiUEoDeQigk+VTucQ1tJ9W/peKBzKdht4PG W3aHu9uH4CXjUyxgyXzOk3p0xyMZnkc= 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=QCNp0MjEp23ArfIJ213HXzBCfkQxI9y/8H4Y/9jbIO4=; b=mRy4maM935+DV+YcCBIpsd71Lr 7sZO4iblXJf5AMYHhO9W/mCToFpztmdszLYgqR5sKv/vM9fAVUnf8efucn9dFSYbGcXlFHeiTHAf3 0C0h/yd1xVkdjYOBQQHk4u+/ydG55Gjr1yOASZm1MR2zrEQViFDCxXIc0GJEMZNHUtEr3KS1spLKr 2SaJQ5nr+iG1qcoZcGMaZCop5lBypWU0JzxeBIminN4jXsulD9HnMZYB4ZV/fu1AVAnVEoX3fjx/0 TRpSLxdIeo8qB9j6igNDIPhTzcuk/YMJbKfUZnM9nwuogF3O1RN/a//yMYM1fCsddLUO9lVdY4xA8 02hxatDw==; Received: from [2001:4bb8:19a:2039:c63c:c37c:1cda:3fb2] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1pHLHB-009Eg6-Dc; Mon, 16 Jan 2023 08:55:33 +0000 From: Christoph Hellwig To: Andrew Morton , Mark Fasheh , Joel Becker , Joseph Qi , Evgeniy Dushistov , "Matthew Wilcox (Oracle)" Cc: ocfs2-devel@oss.oracle.com, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 3/6] minix: don't flush page immediately for DIRSYNC directories Date: Mon, 16 Jan 2023 09:55:20 +0100 Message-Id: <20230116085523.2343176-4-hch@lst.de> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230116085523.2343176-1-hch@lst.de> References: <20230116085523.2343176-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-Rspamd-Queue-Id: 53ECD1C0002 X-Rspamd-Server: rspam09 X-Rspam-User: X-Stat-Signature: hqi896sg7w9tzgehijns7ixb8mzx4gw9 X-HE-Tag: 1673859342-727392 X-HE-Meta: U2FsdGVkX1/Us8DrWlLEe5GEhMzXMtPlMARp5I3dxJxtbkVAf63pmOk0z5QpqbBXzsVSNvwjRfbNOGecg/PCKGjrOh9GuPVa0OLg0GboTqzIfJLOhVuHWhRMPn7nxRSPuXf5b48YufM0pg5AnmtUIEmhuWDDDJXEbvTErPjJraxfBXTNwzAv7KT+2hFqcQDu5cV/RfzbCxJVASoOFucqXuqoMaC9yUZ5cPesNo6bxHWFXCRdlnTcD7PH14GIEisOXSMy4GuAgaocG9rPEAOAcDEN9DlqwZh81I/+2soOhTFEnOLvunPcGDtJ3PIVEi42BhlTwNWK7DeqtVvmDehd6VuQfcehAKz2aTXxkTx6gY+0q2s8HfOSoPAMuZTdGG4zFuhdlkTjN6FQnIwHHcJe393zgY3elB7ahZzUcrmkWmur42YOLcCi/HbeGQEiOhUqZ5ji2Mi5PriL5QB5E+KIwzIHNO3jJXM9UcUsPjnicOZ7DQ4lnhP1nQrXNDs6rj8ZC5wXgt78utpQ4icvKgbqi08e2B0gE1SpG6Y+48vK3dCYQ1KgkPxEXcTI9us5eyf/ANs91ffstop51+mEjTaYo98oPBhxQVTtAJbku3DhGOun2CtuS61fTHwhLGf7qPwadYpUKJN+xT4a1mCPdzXZyvz5TlmLNHjDR/LHzrckg2QNaDAYgilPywvUl6VpW8UAnob223TEs96sNllgrSc4JydrBj4E1ioaW2jGPxuTCprAtgcNxPWmyafEm3+dyJuDPwmjv1MA64jIOx5nC+Cfz73lSmwsj/trFwfsC3xezOdLHf9Z2krfz/2QV/9FshAYy+SqCPJqOmyneZRQkTYSlXS35sqKbIGAj+x21jNo62WdbmsJV7+HDUP8alDVmdj0YzzZCtcX44RSSQpcWZ3pp4V4PrYeild0hKrzoebTKEiS734AWyS0PY8quWh+21KwM7i4l2ejaBewmH/Ejqr uEjEHJnx H7OawHuXUryW3puGK6KObgIaiY9jgcYxnDBuUBefyMPLJ92hAHAnZ4Pz4KjL+8JrcgUoiMbs86KvYxt0kfvBIQqxswf37Ay6muw2OMFz1y1STE9nrzowOnNkSR817TpSGRKmySNbLxdWORug78vZcoy0GKdHDj+62Eg5/kofvjjmtE+0ys22k4zMkxw== 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: We do not need to writeout modified directory blocks immediately when modifying them while the page is locked. It is enough to do the flush somewhat later which has the added benefit that inode times can be flushed as well. It also allows us to stop depending on write_one_page() function. Ported from an ext2 patch by Jan Kara. Signed-off-by: Christoph Hellwig --- fs/minix/dir.c | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/fs/minix/dir.c b/fs/minix/dir.c index c9a3d520b72671..e9a1dc6bdfb0a1 100644 --- a/fs/minix/dir.c +++ b/fs/minix/dir.c @@ -46,21 +46,27 @@ minix_last_byte(struct inode *inode, unsigned long page_nr) return last_byte; } -static int dir_commit_chunk(struct page *page, loff_t pos, unsigned len) +static void dir_commit_chunk(struct page *page, loff_t pos, unsigned len) { struct address_space *mapping = page->mapping; struct inode *dir = mapping->host; - int err = 0; + block_write_end(NULL, mapping, pos, len, len, page, NULL); if (pos+len > dir->i_size) { i_size_write(dir, pos+len); mark_inode_dirty(dir); } - if (IS_DIRSYNC(dir)) - err = write_one_page(page); - else - unlock_page(page); + unlock_page(page); +} + +static int minix_handle_dirsync(struct inode *dir) +{ + int err; + + err = filemap_write_and_wait(dir->i_mapping); + if (!err) + err = sync_inode_metadata(dir, 1); return err; } @@ -274,9 +280,10 @@ int minix_add_link(struct dentry *dentry, struct inode *inode) memset (namx + namelen, 0, sbi->s_dirsize - namelen - 2); de->inode = inode->i_ino; } - err = dir_commit_chunk(page, pos, sbi->s_dirsize); + dir_commit_chunk(page, pos, sbi->s_dirsize); dir->i_mtime = dir->i_ctime = current_time(dir); mark_inode_dirty(dir); + err = minix_handle_dirsync(dir); out_put: dir_put_page(page); out: @@ -305,9 +312,11 @@ int minix_delete_entry(struct minix_dir_entry *de, struct page *page) ((minix3_dirent *)de)->inode = 0; else de->inode = 0; - err = dir_commit_chunk(page, pos, len); + dir_commit_chunk(page, pos, len); inode->i_ctime = inode->i_mtime = current_time(inode); mark_inode_dirty(inode); + if (!err) + err = minix_handle_dirsync(inode); out_put_page: dir_put_page(page); return err; @@ -350,7 +359,8 @@ int minix_make_empty(struct inode *inode, struct inode *dir) } kunmap_atomic(kaddr); - err = dir_commit_chunk(page, 0, 2 * sbi->s_dirsize); + dir_commit_chunk(page, 0, 2 * sbi->s_dirsize); + err = minix_handle_dirsync(inode); fail: put_page(page); return err; @@ -429,9 +439,10 @@ int minix_set_link(struct minix_dir_entry *de, struct page *page, ((minix3_dirent *)de)->inode = inode->i_ino; else de->inode = inode->i_ino; - err = dir_commit_chunk(page, pos, sbi->s_dirsize); + dir_commit_chunk(page, pos, sbi->s_dirsize); dir->i_mtime = dir->i_ctime = current_time(dir); mark_inode_dirty(dir); + err = minix_handle_dirsync(dir); out_put_page: dir_put_page(page); return err; From patchwork Mon Jan 16 08:55:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13102754 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 EEB84C54EBE for ; Mon, 16 Jan 2023 08:55:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A1AD96B0075; Mon, 16 Jan 2023 03:55:47 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 956256B0078; Mon, 16 Jan 2023 03:55:47 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7D06E6B007B; Mon, 16 Jan 2023 03:55:47 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 5ABCF6B0075 for ; Mon, 16 Jan 2023 03:55:47 -0500 (EST) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id F17E41C6192 for ; Mon, 16 Jan 2023 08:55:46 +0000 (UTC) X-FDA: 80360054292.16.DC3F1CC Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf03.hostedemail.com (Postfix) with ESMTP id 6CAE320009 for ; Mon, 16 Jan 2023 08:55:45 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=45KjjDK9; spf=none (imf03.hostedemail.com: domain of BATV+12421fe7f975503e585d+7085+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+12421fe7f975503e585d+7085+infradead.org+hch@bombadil.srs.infradead.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1673859345; a=rsa-sha256; cv=none; b=m9nDpSiEeXsNDfTbo+tISgZhTnfWARa+tVyUsYoKcA2RwbjrmbMEwp+8TpQmIExLK47yHx LDqtMZOdDtmb+gkCdXsUPF0xMwhz/shu1h1b8EzbCPF2QpOS+lW+afY31gKrcAc3RGPkx9 P9122yxS5RanY2GbDSbdt5WqY6TSk5I= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=45KjjDK9; spf=none (imf03.hostedemail.com: domain of BATV+12421fe7f975503e585d+7085+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+12421fe7f975503e585d+7085+infradead.org+hch@bombadil.srs.infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1673859345; 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=RiDLIEceuZ9xYcAquYO1xUuvp0itrlt5jINwhutKHnw=; b=6X3MxJ3mew70DWz5X1czLDfWyKjYo30EpqdKm2WkGclqSglCDIOf94/w5/j4a60p78rGRt 9TWeBksnTJqrdrqNg0ywz18JBE8BBI1Q4oENAvxzcV3u9FYVkHDloCn+hvJAHTh7Bm5WjW bEdrm5kmAONUZyBcGPeqdX7QzSE5pao= 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=RiDLIEceuZ9xYcAquYO1xUuvp0itrlt5jINwhutKHnw=; b=45KjjDK9HcGMupbHi8/ccd2lsk fppYv0+p3TbWlTYws63J9CCnCl/AjpUsqGf6TmfN1ePwYYudyAtmZ7Unotrxgp2ANUKUK5KL7BHR4 XA4mCttnzQ8oVfaW6fBs2R/evPrQ3GwRokqUv7AfYrw/mu4L2IROYrxoD9Yw7fUYfhtP00HKihi/q Y87KScBT9rsWb3KqrM9iZM2WU0eTnF9eVl8y+AFynnB6puXTb1ojZ3/NatLxoXwNQJ5LMF2tkinht tR4wbttPfOvNRgbB+u/+C0jDHTsi82wKIzzYrY9Nmmejm1QgKrISw+bDPG+QRL4x4PZmRF3knVCA8 Gg+V8y5A==; Received: from [2001:4bb8:19a:2039:c63c:c37c:1cda:3fb2] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1pHLHE-009Ege-4b; Mon, 16 Jan 2023 08:55:36 +0000 From: Christoph Hellwig To: Andrew Morton , Mark Fasheh , Joel Becker , Joseph Qi , Evgeniy Dushistov , "Matthew Wilcox (Oracle)" Cc: ocfs2-devel@oss.oracle.com, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 4/6] sysv: don't flush page immediately for DIRSYNC directories Date: Mon, 16 Jan 2023 09:55:21 +0100 Message-Id: <20230116085523.2343176-5-hch@lst.de> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230116085523.2343176-1-hch@lst.de> References: <20230116085523.2343176-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-Queue-Id: 6CAE320009 X-Rspamd-Server: rspam01 X-Stat-Signature: 9ouykx3pifqcpc1xaep994ck4njszspt X-HE-Tag: 1673859345-206424 X-HE-Meta: U2FsdGVkX18l3QGz7z/BWvY1xh3KSaMyak6G8SvJaYRgFnmPfEKBKICstB1qSovduQnNnhJTmjFxzByaumfZzE8X78X6QOUCWlTyyRv1J8F+2N1StIeHv9DKX4otnQNigGp3fYQdL+JNTS2FaPjBMxi3D+nGCH9J7/oVjiqCsKvDFAyKiBAGIu2Z+pg3VAd27waFivzMlFu78qFKMEFFZWMANa79MF8A7w7cEE/mpgeR2S2XyHFtuLTqesEOe0vY9PMrQMjtNL+T7fRLBB+7l8/s0k1GtvLd/JyFynrizk3rlK5pnBvB1l800x5gZaqdQnRKdOg9g2uQOXSGBp45KGwvXU6D0KV/Z87Cm9VZEHEMqKsnEzNGPdwgLAmfPXDd+8N1Y/up0CQxyj9WRh/V4c98glGJnQgnCCcBQXgUQNywQaM6kBKifOfPvhkelieE2QHqxZ0EKlvzBPtM+S6inJVEozyUEMMtmLxJRjdXY/PTxzEp2o+GVY4PzMoesMxDFQHxKnTq9piGF9smqTFA38WagSdbqv/O6NRC/46nSLeR5u+9QSuiYQh+F/tIdu2jecXrx3zfmJVeRUouUgHaNxKZ2Pm2YVm3uV8RqYDqAeNADbD1KlhEssQJ3n/van1Wmn1LH85wipRisXqhgvpK00VivkHTPDnlMvIOs3xATnIzWS9A3xdvuE9wvVRKcv+U/QQDiPWzXMYQdRGiKVj+PM5wX2Y1nNK62gWqqsiqkHFjbkUUtH7zCjbppmIQka3Whn+Ir0cIl9qjRJPejWwWvdStPq437HnuShvmdlqf1xUuFJwgfG0sYDfNyRgMuuV6eXXaN50BqGCNlKgVPE7nIKA1S36rUFU6iN2bJmxqAfACvc6e41F3a9kyzjjq3uM6U7TS6met0neluL9o50h3IXQuItzCuMSTYhxtM7S7mMpTLxzxBKHb65JVBTrlQjA38gkl/ZtvM/1OXwc/ugK 2Nc/ebF1 DOYm8wxInhFXC6lsUpf4vH2IEw47pI4Um0hVvVY5yzCT9MDXwwcQz+oXfIA0drSJlebrdAgg3OinFHUI1PtXQjMEU45O6Yow/B4APwNO5zl4QDxXcTv4W0AlKdY1wA9ogxhJ9TPjdCVzu/HH7D7ZyWYQojzYydnTAHHzwYyIw4tweUZMtJZD576MGCQ== 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: We do not need to writeout modified directory blocks immediately when modifying them while the page is locked. It is enough to do the flush somewhat later which has the added benefit that inode times can be flushed as well. It also allows us to stop depending on write_one_page() function. Ported from an ext2 patch by Jan Kara. Signed-off-by: Christoph Hellwig --- fs/sysv/dir.c | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/fs/sysv/dir.c b/fs/sysv/dir.c index 88e38cd8f5c9ae..16730795a62161 100644 --- a/fs/sysv/dir.c +++ b/fs/sysv/dir.c @@ -34,21 +34,26 @@ static inline void dir_put_page(struct page *page) put_page(page); } -static int dir_commit_chunk(struct page *page, loff_t pos, unsigned len) +static void dir_commit_chunk(struct page *page, loff_t pos, unsigned len) { struct address_space *mapping = page->mapping; struct inode *dir = mapping->host; - int err = 0; block_write_end(NULL, mapping, pos, len, len, page, NULL); if (pos+len > dir->i_size) { i_size_write(dir, pos+len); mark_inode_dirty(dir); } - if (IS_DIRSYNC(dir)) - err = write_one_page(page); - else - unlock_page(page); + unlock_page(page); +} + +static int sysv_handle_dirsync(struct inode *dir) +{ + int err; + + err = filemap_write_and_wait(dir->i_mapping); + if (!err) + err = sync_inode_metadata(dir, 1); return err; } @@ -215,9 +220,10 @@ int sysv_add_link(struct dentry *dentry, struct inode *inode) memcpy (de->name, name, namelen); memset (de->name + namelen, 0, SYSV_DIRSIZE - namelen - 2); de->inode = cpu_to_fs16(SYSV_SB(inode->i_sb), inode->i_ino); - err = dir_commit_chunk(page, pos, SYSV_DIRSIZE); + dir_commit_chunk(page, pos, SYSV_DIRSIZE); dir->i_mtime = dir->i_ctime = current_time(dir); mark_inode_dirty(dir); + err = sysv_handle_dirsync(dir); out_page: dir_put_page(page); out: @@ -238,11 +244,11 @@ int sysv_delete_entry(struct sysv_dir_entry *de, struct page *page) err = sysv_prepare_chunk(page, pos, SYSV_DIRSIZE); BUG_ON(err); de->inode = 0; - err = dir_commit_chunk(page, pos, SYSV_DIRSIZE); + dir_commit_chunk(page, pos, SYSV_DIRSIZE); dir_put_page(page); inode->i_ctime = inode->i_mtime = current_time(inode); mark_inode_dirty(inode); - return err; + return sysv_handle_dirsync(inode); } int sysv_make_empty(struct inode *inode, struct inode *dir) @@ -272,7 +278,8 @@ int sysv_make_empty(struct inode *inode, struct inode *dir) strcpy(de->name,".."); kunmap(page); - err = dir_commit_chunk(page, 0, 2 * SYSV_DIRSIZE); + dir_commit_chunk(page, 0, 2 * SYSV_DIRSIZE); + err = sysv_handle_dirsync(inode); fail: put_page(page); return err; @@ -336,10 +343,11 @@ void sysv_set_link(struct sysv_dir_entry *de, struct page *page, err = sysv_prepare_chunk(page, pos, SYSV_DIRSIZE); BUG_ON(err); de->inode = cpu_to_fs16(SYSV_SB(inode->i_sb), inode->i_ino); - err = dir_commit_chunk(page, pos, SYSV_DIRSIZE); + dir_commit_chunk(page, pos, SYSV_DIRSIZE); dir_put_page(page); dir->i_mtime = dir->i_ctime = current_time(dir); mark_inode_dirty(dir); + sysv_handle_dirsync(inode); } struct sysv_dir_entry * sysv_dotdot (struct inode *dir, struct page **p) From patchwork Mon Jan 16 08:55:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13102755 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 5DF70C46467 for ; Mon, 16 Jan 2023 08:55:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AB90E6B0078; Mon, 16 Jan 2023 03:55:48 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A42796B007B; Mon, 16 Jan 2023 03:55:48 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 86CEE6B007D; Mon, 16 Jan 2023 03:55:48 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 746F06B0078 for ; Mon, 16 Jan 2023 03:55:48 -0500 (EST) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 3A1CBAAA9A for ; Mon, 16 Jan 2023 08:55:48 +0000 (UTC) X-FDA: 80360054376.12.550BC01 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf14.hostedemail.com (Postfix) with ESMTP id C555710000D for ; Mon, 16 Jan 2023 08:55:46 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=DixsK5MM; spf=none (imf14.hostedemail.com: domain of BATV+12421fe7f975503e585d+7085+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+12421fe7f975503e585d+7085+infradead.org+hch@bombadil.srs.infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1673859346; 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=v3PglRWzIOokZtWskK857KErIsUBx1dUWoEIj+rmors=; b=xbreCkL0BBq8LkiMvjur3qmmfGNv2MWOawPrewKC0L0DuioyBrX8SC1JEC6F1si58hAsms vy9652ScaUFYkBUGxmHfqBRXIte6sH7xl7vnd/1v2K4rugB7L+tswOsNGQh2mEmJXHDC6a fvZuWYJpG/2DGBEHPbWgX7IgZmEiUdM= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=DixsK5MM; spf=none (imf14.hostedemail.com: domain of BATV+12421fe7f975503e585d+7085+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+12421fe7f975503e585d+7085+infradead.org+hch@bombadil.srs.infradead.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1673859346; a=rsa-sha256; cv=none; b=U5cmqcSNIkNEA3r05oc6WXySHYXyVT/Nht49r/KCnB9KIisK1ptDhctKAy2TorVL/HMfnO c3yvU755Itk/Y+zKoFV79c60oDcm1+RDg5lcWZ3Nm/yWdCgFuGrnV693znVsxRUx1CQwJZ 2Dj2QyiEGiwPUWUoH4Pinry8TaCqtQ0= 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=v3PglRWzIOokZtWskK857KErIsUBx1dUWoEIj+rmors=; b=DixsK5MM2bUui4MhH0EvJ72lp2 WhWrahLLw2Q/qCkiyikiq6XfFLKWN9P3q0gTvzEOIuokGykPQDu36/ApNtX+68TdqIpsiIvwbKmBK WChJb99QuBiIiAmdjFhPdecye2p2/hbTlow+e87ry4NaVYuv45yJKbm1BSHtCEMeY9IzsEzuyhHsI cRF5YIYL5sx5LSKyoLnapfmAikJcKAOPzh5nCv/DESlQiHoqGnAZbDOD/SpNLlksyaLknUB1nwSFN tFu76c7m97LBY5Ji5xIZkKBmr+3mJx0/EGuTioAoPwY/iSj9JSHSAP1zp2XtLL4UKxG2kuc2qdJzB MyLorMnw==; Received: from [2001:4bb8:19a:2039:c63c:c37c:1cda:3fb2] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1pHLHG-009EhF-Sk; Mon, 16 Jan 2023 08:55:39 +0000 From: Christoph Hellwig To: Andrew Morton , Mark Fasheh , Joel Becker , Joseph Qi , Evgeniy Dushistov , "Matthew Wilcox (Oracle)" Cc: ocfs2-devel@oss.oracle.com, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 5/6] ufs: don't flush page immediately for DIRSYNC directories Date: Mon, 16 Jan 2023 09:55:22 +0100 Message-Id: <20230116085523.2343176-6-hch@lst.de> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230116085523.2343176-1-hch@lst.de> References: <20230116085523.2343176-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-Stat-Signature: 5667t7xk9bh5gdj1ei411bgba4utds67 X-Rspam-User: X-Rspamd-Queue-Id: C555710000D X-Rspamd-Server: rspam06 X-HE-Tag: 1673859346-662214 X-HE-Meta: U2FsdGVkX189amugnUGVwQWCch2i9Bk5puMcHaamASG/ZUdFDjNZvEvliKOC+Ja/irXW1pDgageGYHYDUuKSGEAFpdijq1p2MHBuRu0+x9MFGS54yiRVEjcApBtapAGDnvMxUdLqNzhONv+T83oniR4teUdCTRT90zzRHR6xNexGqcQMt4hNfLOwXZ+BZXYCuJAqefYk7HvqQ/MvmjfrqQaNaEyvxHHi5G2XjJZZBrp+yMoDRkYSh7rnGyoANLMGp/mY76Rj781DI9UJ6zuEL0iC3RAtbuKNF3/+tdjqgdUrIAg3vqXZpsMCosKiZMovoJB7g2KBRp1bHxAoPVcezfUz2V5MSsBo1ajsiY6asPzoC86AjJvL9HF4G97L+VVSApQSJop0EC8I7dBA+ZPvgdYLHcjptev+FKzL3HKuGMPa4yKuEp0OEPc+sFGJSwroDIrTmJv4hqzAlqWe+NG5qpcq5Yn9GPD7/irkJEcYWT3+MCjnnBne0movg0n2gKQkeFy9M3nqQZsU4EV+729kkJ/nOAZOpC/o2o1rJZRS815bJ02xbFlGU+nzv5Wn1CIdBxJPj2/IKoAAYG5+PsV+c0WPrCMqXiHqN3A4c2ZMqpWdHE0eaukNWqZPgVb5o0lwYzBkYnOiQL5cc7zyViHdwBGKPaelFbHmRk0uRXetBirpItBkiNf57dsw2zjfFZx4xE8my/zc4cxLrKruO67e5Y7fiMmeLKAk07GZsKbl8TJ7ujGRHZf1elu4WHEFC352mDwayoUGf5ehheqyeeBT0yebqPmMdSE0g+jD66ZR+lPdwjTGvMVK050waaTdyaRmiXT66dBxnnY7SlezKmKaPqBBxvO6OKuLP4kWcvF6czXEHdFN3UiUTa/QF/IC4uU98Jgnnm0oT+SiADf3+nmQLI5JG28se0tfSMyAkoq7OD6Q7ce8QaYtTq056fmsQLpeTOmJON6FI+eYT7Hehgz U+ndnlG0 AUPzZzgwF4bn1jqqYb2Y8oahP+lPKgKD08dtsJWSyKzMlzaptavY/zJg3N6js4eN9e39DK6tbFjeoZrmmX4B8ye/OX68jfOLcrYoIdjPQSvimP3Vm8P/50BwrCJaAl5guSwE9QKgEuZdewtgixvnHPyaNOgFVqnW3vdoUil84XVmvaueVGdaOKahlIQ== 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: We do not need to writeout modified directory blocks immediately when modifying them while the page is locked. It is enough to do the flush somewhat later which has the added benefit that inode times can be flushed as well. It also allows us to stop depending on write_one_page() function. Ported from an ext2 patch by Jan Kara. Signed-off-by: Christoph Hellwig --- fs/ufs/dir.c | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/fs/ufs/dir.c b/fs/ufs/dir.c index 391efaf1d52897..379d75796a5ce3 100644 --- a/fs/ufs/dir.c +++ b/fs/ufs/dir.c @@ -42,11 +42,10 @@ static inline int ufs_match(struct super_block *sb, int len, return !memcmp(name, de->d_name, len); } -static int ufs_commit_chunk(struct page *page, loff_t pos, unsigned len) +static void ufs_commit_chunk(struct page *page, loff_t pos, unsigned len) { struct address_space *mapping = page->mapping; struct inode *dir = mapping->host; - int err = 0; inode_inc_iversion(dir); block_write_end(NULL, mapping, pos, len, len, page, NULL); @@ -54,10 +53,16 @@ static int ufs_commit_chunk(struct page *page, loff_t pos, unsigned len) i_size_write(dir, pos+len); mark_inode_dirty(dir); } - if (IS_DIRSYNC(dir)) - err = write_one_page(page); - else - unlock_page(page); + unlock_page(page); +} + +static int ufs_handle_dirsync(struct inode *dir) +{ + int err; + + err = filemap_write_and_wait(dir->i_mapping); + if (!err) + err = sync_inode_metadata(dir, 1); return err; } @@ -99,11 +104,12 @@ void ufs_set_link(struct inode *dir, struct ufs_dir_entry *de, de->d_ino = cpu_to_fs32(dir->i_sb, inode->i_ino); ufs_set_de_type(dir->i_sb, de, inode->i_mode); - err = ufs_commit_chunk(page, pos, len); + ufs_commit_chunk(page, pos, len); ufs_put_page(page); if (update_times) dir->i_mtime = dir->i_ctime = current_time(dir); mark_inode_dirty(dir); + ufs_handle_dirsync(dir); } @@ -390,10 +396,11 @@ int ufs_add_link(struct dentry *dentry, struct inode *inode) de->d_ino = cpu_to_fs32(sb, inode->i_ino); ufs_set_de_type(sb, de, inode->i_mode); - err = ufs_commit_chunk(page, pos, rec_len); + ufs_commit_chunk(page, pos, rec_len); dir->i_mtime = dir->i_ctime = current_time(dir); mark_inode_dirty(dir); + err = ufs_handle_dirsync(dir); /* OFFSET_CACHE */ out_put: ufs_put_page(page); @@ -531,9 +538,10 @@ int ufs_delete_entry(struct inode *inode, struct ufs_dir_entry *dir, if (pde) pde->d_reclen = cpu_to_fs16(sb, to - from); dir->d_ino = 0; - err = ufs_commit_chunk(page, pos, to - from); + ufs_commit_chunk(page, pos, to - from); inode->i_ctime = inode->i_mtime = current_time(inode); mark_inode_dirty(inode); + err = ufs_handle_dirsync(inode); out: ufs_put_page(page); UFSD("EXIT\n"); @@ -579,7 +587,8 @@ int ufs_make_empty(struct inode * inode, struct inode *dir) strcpy (de->d_name, ".."); kunmap(page); - err = ufs_commit_chunk(page, 0, chunk_size); + ufs_commit_chunk(page, 0, chunk_size); + err = ufs_handle_dirsync(inode); fail: put_page(page); return err; From patchwork Mon Jan 16 08:55:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13102756 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 E5F13C54EBE for ; Mon, 16 Jan 2023 08:55:52 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BA2336B007B; Mon, 16 Jan 2023 03:55:51 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id ADF176B007D; Mon, 16 Jan 2023 03:55:51 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9570A6B007E; Mon, 16 Jan 2023 03:55:51 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 7B47F6B007B for ; Mon, 16 Jan 2023 03:55:51 -0500 (EST) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 2F0E5A06C6 for ; Mon, 16 Jan 2023 08:55:51 +0000 (UTC) X-FDA: 80360054502.23.5DFA1EE Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf21.hostedemail.com (Postfix) with ESMTP id B28431C0015 for ; Mon, 16 Jan 2023 08:55:49 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=S1YQa0jo; spf=none (imf21.hostedemail.com: domain of BATV+12421fe7f975503e585d+7085+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+12421fe7f975503e585d+7085+infradead.org+hch@bombadil.srs.infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1673859349; 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=jmbxaw5WGTdQC+qZyQllTG4rSUOzrNtp0wkWOB0SkzU=; b=pFejfuJb5juakqT3tRxdw2nKkhHiebfWm/JywzqLn8kg1L+QbRcaOtpESG8iBRyTATc1VP 5ePXnKvaXoSC7gdGlDHHQCs7MJCmYYp3YiEhq2tITnbQgsH22Pq2S7jb/TT9Cwhz4P5Qo0 jEWDHQEcdJG+NDLylMq7nC1aJTshJzg= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=S1YQa0jo; spf=none (imf21.hostedemail.com: domain of BATV+12421fe7f975503e585d+7085+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+12421fe7f975503e585d+7085+infradead.org+hch@bombadil.srs.infradead.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1673859349; a=rsa-sha256; cv=none; b=mEPqZPa57FQsBIjgvq8qLUXNdTZHiCpEziq+T6UHbkFEPRsYGxCkSIBLVpmAIMk6xXR4fe qcgZ2XcMlHosn/mCBo/H8kxZX2Fm0JYAf8YbZIWyW5mZgC72KWsMUMcApEJXGHAqNeADJA cSMlMJRVoDWsQ5+GdS4BSu6GqUXt1ZQ= 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=jmbxaw5WGTdQC+qZyQllTG4rSUOzrNtp0wkWOB0SkzU=; b=S1YQa0jo9I3cRIkKUvmK7E0LAe gZA9QpBJWq/4q1yWw44YdYIyo5lTBj41So0EskMqctZHNAseMRrJiewDt8OHaWv56VCtYWSDkMM/w w9ki30AiFExrhcC68KG48eFoFc6lR/EH5r3SoH2VIHGXyq2Oux6Ef4eqSFbmDtn/RMWJ3tT9q01W7 1hzO9c3PXTWZ+Jn6jZqG5P/iproorCh01i/UL1Yb4qwCDtNfv7F5qAirB3ZYt8p/CzRfUY29D8sYc UQ8L5Sp2s3JkHGZy4ZoyT7sXuZbUM0oSRzKF17mun/YTTCQV0TkAwQe1al7rQ1YAH2adR+oAfZlCz wb0LDk/g==; Received: from [2001:4bb8:19a:2039:c63c:c37c:1cda:3fb2] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1pHLHJ-009Ei0-KJ; Mon, 16 Jan 2023 08:55:42 +0000 From: Christoph Hellwig To: Andrew Morton , Mark Fasheh , Joel Becker , Joseph Qi , Evgeniy Dushistov , "Matthew Wilcox (Oracle)" Cc: ocfs2-devel@oss.oracle.com, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, Jan Kara Subject: [PATCH 6/6] ocfs2: don't use write_one_page in ocfs2_duplicate_clusters_by_page Date: Mon, 16 Jan 2023 09:55:23 +0100 Message-Id: <20230116085523.2343176-7-hch@lst.de> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230116085523.2343176-1-hch@lst.de> References: <20230116085523.2343176-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: rspam03 X-Stat-Signature: g5x8dzzoger1n7nfogj9oukdsmr4xrgf X-Rspamd-Queue-Id: B28431C0015 X-HE-Tag: 1673859349-32496 X-HE-Meta: U2FsdGVkX19lcnYOqZ5IEsN3BEiwYpqFNhvn2aix2yX80RXuMu2ml5Xk8Kw7Kz7Uladt6avx74W2KU+wf954iBgb6WeUClm6jzr2N8pliMXuKr1Q/dg8csQ4X4231Sb+GIVrjTxthzOHJJW3ztPV+rju4yq7qDRBPoTAEWBFTNNHfo/9gIpoGMhjnhattRUmAXJgmpAl09FtctznUY8HVi0l5u9r7Tq/9gnB+ztK0t4JspWl4fTkuUSIZ4CfGEur01s8Hg9Q4gkLOnWYNxN1tP9XIWq1yNe58aKmnW+DzCmJDXNAnQI0p/8LI7i5ZA3Nvq7cv95uyB0CUP8S6t0GrIM3BMZaYL+T5ZU/C91Xg7VH5pEVk4vJM+nU8Klzal3QLOepeBh3mawJl7O3+Q2IlAQBYd7NsgV4VZar2Y4bNZhVPtfN02OZBLS8IqwSE6eqpSPObSjyuaZvQLtsS0zpHczRI/vPHqHazlULpcp/d/Gj78r9mndACZt882O2Tcuo3kevRN29BoNwaPv7w+g66q4H0M2rnTfgMDkLmTej6na7mmeDFQpcVZtRnFGxd7tFpfzo8hzYJA9hHKEcZ0sinklmwreVaCTHIUWJX+WtbW5iC/OxTWsbVRfR2BFLddNcuZ5X+tDLaNMg89LY1U23qZlRSoJEOkv2ilQuDxGDnuGTDqVEeyUvoX29COT0Do8/lI8QLlQdHrBhhOd8jOD/FE9HcVFhZC6ZJXgbUJI+M8DylnyAD6GZZnGq/ORf14ax9B415mfYbalznAFmxhDjiJcq+mp2YrNNyaTIlTgB34FCoMP7uo/o4x2sjptUiSbTE3gO6Nv0j4dM5Cburu9rkcRL6K5NEoLxCY9ti8bzKOOM+mshH5kR6cv8jelATvhZSaHlP4rFGwgeASb99jnYGhYyyyP3jgphADVS0sBFrdqiX6lprxJxB6IwqpFhHnWeNhPFecnKs0koWvzg9Hb uM7nu6+J 44mFz7w9pv67MEphWyrYapIT+XKJePcX/BjDRDPJNR/WZOkx1LaFEsKkWMfD401DW5SjN9qWOa/knIsmk1lN1BhohSBIT86reDJgC6Q8eNaSq9eOcJQD5+wsJKSPCRnFMmRUQk+zamZy8AWWjrDMJuQaH5i258b6gOsbMopVLsi0Xa3ViwGhz2L4ZpKzapvv0ACmlI2tKr2HnWXha/oJkx80erjj8mk4W8/NwWCgL/R0TDUM= 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: Use filemap_write_and_wait_range to write back the range of the dirty page instead of write_one_page in preparation of removing write_one_page and eventually ->writepage. Signed-off-by: Christoph Hellwig Reviewed-by: Jan Kara Reviewed-by: Joseph Qi --- fs/ocfs2/refcounttree.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/fs/ocfs2/refcounttree.c b/fs/ocfs2/refcounttree.c index 623db358b1efa8..4a73405962ec4f 100644 --- a/fs/ocfs2/refcounttree.c +++ b/fs/ocfs2/refcounttree.c @@ -2952,10 +2952,11 @@ int ocfs2_duplicate_clusters_by_page(handle_t *handle, */ if (PAGE_SIZE <= OCFS2_SB(sb)->s_clustersize) { if (PageDirty(page)) { - /* - * write_on_page will unlock the page on return - */ - ret = write_one_page(page); + unlock_page(page); + put_page(page); + + ret = filemap_write_and_wait_range(mapping, + offset, map_end - 1); goto retry; } }