From patchwork Wed Jan 18 17:30: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: 13106728 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 6CB86C38159 for ; Wed, 18 Jan 2023 17:30:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 61B9A6B0075; Wed, 18 Jan 2023 12:30:48 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 5A3CE6B007B; Wed, 18 Jan 2023 12:30:48 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 444206B007D; Wed, 18 Jan 2023 12:30:48 -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 366AE6B0075 for ; Wed, 18 Jan 2023 12:30:48 -0500 (EST) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 029CA40C0F for ; Wed, 18 Jan 2023 17:30:47 +0000 (UTC) X-FDA: 80368609776.29.F189DCF Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf23.hostedemail.com (Postfix) with ESMTP id 7033014001A for ; Wed, 18 Jan 2023 17:30:46 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=kqj2fnr+; spf=none (imf23.hostedemail.com: domain of BATV+aec3eaf5b774c69d00f8+7087+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+aec3eaf5b774c69d00f8+7087+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=1674063046; 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=MsUsFoYQrTDA+hFUE1VWaBiacxBoUahLt80xRKfGZMs=; b=5EwDqm0et+lyeCUZbe4fAqWD+OBEZixYOOWxlcvyv05MgWsW3XmLhwVvSC4SlRUrjWeKh+ TxVHbRbTGmJ7yLEHGDmyrBLCJLWs+/jBrrxOkj90+s7pRMXWUdAnYKu7BYU80rHKMGuAlR U7m/1Ygj2o+X9rGYD755cBKQtWM2erY= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=kqj2fnr+; spf=none (imf23.hostedemail.com: domain of BATV+aec3eaf5b774c69d00f8+7087+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+aec3eaf5b774c69d00f8+7087+infradead.org+hch@bombadil.srs.infradead.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1674063046; a=rsa-sha256; cv=none; b=OFyOv0tTBvZ5mersEzOG99ht7w1b3lNLOv3DjK2rlP4JJsL3L7cxK5D4D0ovR1cfEulnFS ywjWhwlVoJZ8dMDs7vHslDpoM9LKmwJ6nPvavGSdRhC+YmlmeWEcEwgEFSfqaEAhRbw/Cv 1Ms1wSZzYq24xI/gk7m/MITCnjg0Z9U= 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=MsUsFoYQrTDA+hFUE1VWaBiacxBoUahLt80xRKfGZMs=; b=kqj2fnr+ij0si90SGxbS9qXDce 2JYRKEHhI08O/eeOkZ4fGkif49Gsu87pWSEM4bCYAka8wxoBOy8Zc580p2lB4mZWpTixufgfK4OWL QOavXNp6Asr34uSPGFg/IlFkuGxb7C9Oi725gTlRiHA/LbWnneZBscVJ9VevMC6By9zCafaIYLB2E AAtGIINa79oLsbuf7OKhFM5ul79N4sg8/31bpJaYz/xFON4czyRlrMVFTN7bYi0CwSZkkYVHqz2ja 0k4Y+DBDHOLUeyjVmwWHyPJIbN7Pq7wEVKXlZb0IoaURU0TlddjqfeacFkSNiucvibBPeu9Z+lfuf mpMph1gA==; Received: from [2001:4bb8:19a:2039:cce7:a1cd:f61c:a80d] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1pICGi-00227r-3e; Wed, 18 Jan 2023 17:30: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 2/7] minix: fix error handling in minix_delete_entry Date: Wed, 18 Jan 2023 18:30:22 +0100 Message-Id: <20230118173027.294869-3-hch@lst.de> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230118173027.294869-1-hch@lst.de> References: <20230118173027.294869-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: rspam05 X-Rspamd-Queue-Id: 7033014001A X-Stat-Signature: ot6yn7nxetfqhb9anta3sgsseu75rfaz X-Rspam-User: X-HE-Tag: 1674063046-913565 X-HE-Meta: U2FsdGVkX19fmD523p6bGnWl9zq3xrcHvjaVwlvkn504TgIW/LXjoeo98NIeLHW4iz6D3+8oYtw9q2BFNNp8WawdZbft5KVibA/OXWVVTzff9QdRIw0LZA9tpyOEnq/XOwM3M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zNV8BS 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. Signed-off-by: Christoph Hellwig --- fs/minix/dir.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/fs/minix/dir.c b/fs/minix/dir.c index ec462330e749af..242e179aa1fbeb 100644 --- a/fs/minix/dir.c +++ b/fs/minix/dir.c @@ -297,18 +297,20 @@ 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); + return err; } + if (sbi->s_version == MINIX_V3) + ((minix3_dirent *)de)->inode = 0; + else + de->inode = 0; + err = dir_commit_chunk(page, pos, len); + if (err) + return err; inode->i_ctime = inode->i_mtime = current_time(inode); mark_inode_dirty(inode); - return err; + return 0; } int minix_make_empty(struct inode *inode, struct inode *dir)