From: Christoph Hellwig <hch@lst.de> To: Andrew Morton <akpm@linux-foundation.org>, Mark Fasheh <mark@fasheh.com>, Joel Becker <jlbec@evilplan.org>, Joseph Qi <joseph.qi@linux.alibaba.com>, Evgeniy Dushistov <dushistov@mail.ru>, "Matthew Wilcox (Oracle)" <willy@infradead.org> 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 [thread overview] Message-ID: <20230116085523.2343176-2-hch@lst.de> (raw) In-Reply-To: <20230116085523.2343176-1-hch@lst.de> 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 <hch@lst.de> --- 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; } -- 2.39.0
WARNING: multiple messages have this Message-ID (diff)
From: Christoph Hellwig via Ocfs2-devel <ocfs2-devel@oss.oracle.com> To: Andrew Morton <akpm@linux-foundation.org>, Mark Fasheh <mark@fasheh.com>, Joel Becker <jlbec@evilplan.org>, Joseph Qi <joseph.qi@linux.alibaba.com>, Evgeniy Dushistov <dushistov@mail.ru>, "Matthew Wilcox (Oracle)" <willy@infradead.org> Cc: linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, ocfs2-devel@oss.oracle.com Subject: [Ocfs2-devel] [PATCH 1/6] minix: fix error handling in minix_delete_entry Date: Mon, 16 Jan 2023 09:55:18 +0100 [thread overview] Message-ID: <20230116085523.2343176-2-hch@lst.de> (raw) In-Reply-To: <20230116085523.2343176-1-hch@lst.de> 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 <hch@lst.de> --- 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; } -- 2.39.0 _______________________________________________ Ocfs2-devel mailing list Ocfs2-devel@oss.oracle.com https://oss.oracle.com/mailman/listinfo/ocfs2-devel
next prev parent reply other threads:[~2023-01-16 8:56 UTC|newest] Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-01-16 8:55 remove most callers of write_one_page Christoph Hellwig 2023-01-16 8:55 ` [Ocfs2-devel] " Christoph Hellwig via Ocfs2-devel 2023-01-16 8:55 ` Christoph Hellwig [this message] 2023-01-16 8:55 ` [Ocfs2-devel] [PATCH 1/6] minix: fix error handling in minix_delete_entry Christoph Hellwig via Ocfs2-devel 2023-01-16 8:55 ` [PATCH 2/6] minix: fix error handling in minix_set_link Christoph Hellwig 2023-01-16 8:55 ` [Ocfs2-devel] " Christoph Hellwig via Ocfs2-devel 2023-01-16 8:55 ` [PATCH 3/6] minix: don't flush page immediately for DIRSYNC directories Christoph Hellwig 2023-01-16 8:55 ` [Ocfs2-devel] " Christoph Hellwig via Ocfs2-devel 2023-01-16 8:55 ` [PATCH 4/6] sysv: " Christoph Hellwig 2023-01-16 8:55 ` [Ocfs2-devel] " Christoph Hellwig via Ocfs2-devel 2023-01-16 8:55 ` [PATCH 5/6] ufs: " Christoph Hellwig 2023-01-16 8:55 ` [Ocfs2-devel] " Christoph Hellwig via Ocfs2-devel 2023-01-16 8:55 ` [PATCH 6/6] ocfs2: don't use write_one_page in ocfs2_duplicate_clusters_by_page Christoph Hellwig 2023-01-16 8:55 ` [Ocfs2-devel] " Christoph Hellwig via Ocfs2-devel 2023-01-16 21:02 ` remove most callers of write_one_page Al Viro 2023-01-16 21:02 ` [Ocfs2-devel] " Al Viro via Ocfs2-devel 2023-01-16 21:30 ` Andrew Morton 2023-01-16 21:30 ` [Ocfs2-devel] " Andrew Morton via Ocfs2-devel 2023-01-17 5:55 ` Christoph Hellwig 2023-01-17 5:55 ` [Ocfs2-devel] " Christoph Hellwig via Ocfs2-devel
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20230116085523.2343176-2-hch@lst.de \ --to=hch@lst.de \ --cc=akpm@linux-foundation.org \ --cc=dushistov@mail.ru \ --cc=jlbec@evilplan.org \ --cc=joseph.qi@linux.alibaba.com \ --cc=linux-fsdevel@vger.kernel.org \ --cc=linux-mm@kvack.org \ --cc=mark@fasheh.com \ --cc=ocfs2-devel@oss.oracle.com \ --cc=willy@infradead.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.