summaryrefslogtreecommitdiff
path: root/fs/nilfs2
diff options
context:
space:
mode:
authorRyusuke Konishi <konishi.ryusuke@gmail.com>2023-11-27 23:30:21 +0900
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-03-13 12:51:11 +0100
commite5606b783307b76b2d76feb8719a3ca7f036438b (patch)
treed025063b9e955256fc3e6398e242c42d8ee077ed /fs/nilfs2
parent1fa500f494f1a84e52c749ec36d5960df3eacc68 (diff)
downloadlinux-e5606b783307b76b2d76feb8719a3ca7f036438b.tar.gz
linux-e5606b783307b76b2d76feb8719a3ca7f036438b.tar.bz2
linux-e5606b783307b76b2d76feb8719a3ca7f036438b.zip
nilfs2: eliminate staggered calls to kunmap in nilfs_rename
commit 8cf57c6df818f58fdad16a909506be213623a88e upstream. In nilfs_rename(), calls to nilfs_put_page() to release pages obtained with nilfs_find_entry() or nilfs_dotdot() are alternated in the normal path. When replacing the kernel memory mapping method from kmap to kmap_local_{page,folio}, this violates the constraint on the calling order of kunmap_local(). Swap the order of nilfs_put_page calls where the kmap sections of multiple pages overlap so that they are nested, allowing direct replacement of nilfs_put_page() -> unmap_and_put_page(). Without this reordering, that replacement will cause a kernel WARNING in kunmap_local_indexed() on architectures with high memory mapping. Link: https://lkml.kernel.org/r/20231127143036.2425-3-konishi.ryusuke@gmail.com Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com> Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Stable-dep-of: ee70999a988b ("nilfs2: handle errors that nilfs_prepare_chunk() may return") Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/nilfs2')
-rw-r--r--fs/nilfs2/namei.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/nilfs2/namei.c b/fs/nilfs2/namei.c
index cadf8914ad95..9dd4527d8f69 100644
--- a/fs/nilfs2/namei.c
+++ b/fs/nilfs2/namei.c
@@ -431,13 +431,14 @@ static int nilfs_rename(struct user_namespace *mnt_userns,
old_inode->i_ctime = current_time(old_inode);
nilfs_delete_entry(old_de, old_page);
- nilfs_put_page(old_page);
if (dir_de) {
nilfs_set_link(old_inode, dir_de, dir_page, new_dir);
nilfs_put_page(dir_page);
drop_nlink(old_dir);
}
+ nilfs_put_page(old_page);
+
nilfs_mark_inode_dirty(old_dir);
nilfs_mark_inode_dirty(old_inode);