summaryrefslogtreecommitdiff
path: root/fs/minix
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2023-01-18 20:30:22 +0300
committerAl Viro <viro@zeniv.linux.org.uk>2023-01-20 03:26:29 +0300
commitb61d15d5ff67c07907c194d4354ec0c35bc657d1 (patch)
tree18b6d07729994a6c82b3729f55bbfaaa4fa5db78 /fs/minix
parent35bb6a092cfcab895ea7e9c31a2cc6b80b25c134 (diff)
downloadlinux-b61d15d5ff67c07907c194d4354ec0c35bc657d1.tar.xz
minix: fix error handling in minix_delete_entry
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 <hch@lst.de> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/minix')
-rw-r--r--fs/minix/dir.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/fs/minix/dir.c b/fs/minix/dir.c
index ec462330e749..242e179aa1fb 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)