summaryrefslogtreecommitdiffstats
path: root/fs/ext2/namei.c
diff options
context:
space:
mode:
authorIra Weiny <ira.weiny@intel.com>2021-03-29 08:54:01 +0200
committerJan Kara <jack@suse.cz>2021-03-31 13:02:08 +0200
commite2ebb1230455985df6aa45835a451a5404eddd8d (patch)
tree1b1f3112817b44e867a8f4903ade3e1e4adb5e87 /fs/ext2/namei.c
parentfs/ext2/: fix misspellings using codespell tool (diff)
downloadlinux-e2ebb1230455985df6aa45835a451a5404eddd8d.tar.xz
linux-e2ebb1230455985df6aa45835a451a5404eddd8d.zip
ext2: Match up ext2_put_page() with ext2_dotdot() and ext2_find_entry()
ext2_dotdot() and ext2_find_entry() both require ext2_put_page() to be called after successful return. For some of the calls this corresponding put was hidden in ext2_set_link and ext2_delete_entry(). Match up ext2_put_page() with ext2_dotdot() and ext2_find_entry() in the functions which call them. This makes the code easier to follow regarding the get/put of the page. Clean up comments to match new behavior. To: Jan Kara <jack@suse.com> Link: https://lore.kernel.org/r/20210329065402.3297092-2-ira.weiny@intel.com Signed-off-by: Ira Weiny <ira.weiny@intel.com> Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/ext2/namei.c')
-rw-r--r--fs/ext2/namei.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/fs/ext2/namei.c b/fs/ext2/namei.c
index 3367384d344d..7af9ab3f975e 100644
--- a/fs/ext2/namei.c
+++ b/fs/ext2/namei.c
@@ -294,6 +294,7 @@ static int ext2_unlink(struct inode * dir, struct dentry *dentry)
}
err = ext2_delete_entry (de, page);
+ ext2_put_page(page);
if (err)
goto out;
@@ -371,6 +372,7 @@ static int ext2_rename (struct user_namespace * mnt_userns,
goto out_dir;
}
ext2_set_link(new_dir, new_de, new_page, old_inode, 1);
+ ext2_put_page(new_page);
new_inode->i_ctime = current_time(new_inode);
if (dir_de)
drop_nlink(new_inode);
@@ -391,12 +393,13 @@ static int ext2_rename (struct user_namespace * mnt_userns,
mark_inode_dirty(old_inode);
ext2_delete_entry (old_de, old_page);
+ ext2_put_page(old_page);
if (dir_de) {
if (old_dir != new_dir)
ext2_set_link(old_inode, dir_de, dir_page, new_dir, 0);
- else
- ext2_put_page(dir_page);
+
+ ext2_put_page(dir_page);
inode_dec_link_count(old_dir);
}
return 0;