Skip to content

Commit 9823193

Browse files
konisgregkh
authored andcommitted
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/[email protected] Signed-off-by: Ryusuke Konishi <[email protected]> Reviewed-by: Matthew Wilcox (Oracle) <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Stable-dep-of: ee70999a988b ("nilfs2: handle errors that nilfs_prepare_chunk() may return") Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent c38a305 commit 9823193

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

fs/nilfs2/namei.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,13 +431,14 @@ static int nilfs_rename(struct user_namespace *mnt_userns,
431431
old_inode->i_ctime = current_time(old_inode);
432432

433433
nilfs_delete_entry(old_de, old_page);
434-
nilfs_put_page(old_page);
435434

436435
if (dir_de) {
437436
nilfs_set_link(old_inode, dir_de, dir_page, new_dir);
438437
nilfs_put_page(dir_page);
439438
drop_nlink(old_dir);
440439
}
440+
nilfs_put_page(old_page);
441+
441442
nilfs_mark_inode_dirty(old_dir);
442443
nilfs_mark_inode_dirty(old_inode);
443444

0 commit comments

Comments
 (0)