@@ -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;
}
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(-)