summaryrefslogtreecommitdiffstats
path: root/fs/ext2/namei.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ext2/namei.c')
-rw-r--r--fs/ext2/namei.c36
1 files changed, 24 insertions, 12 deletions
diff --git a/fs/ext2/namei.c b/fs/ext2/namei.c
index 765fb389550f..1f69b81655b6 100644
--- a/fs/ext2/namei.c
+++ b/fs/ext2/namei.c
@@ -280,19 +280,21 @@ static int ext2_unlink(struct inode * dir, struct dentry *dentry)
struct inode * inode = d_inode(dentry);
struct ext2_dir_entry_2 * de;
struct page * page;
+ void *page_addr;
int err;
err = dquot_initialize(dir);
if (err)
goto out;
- de = ext2_find_entry(dir, &dentry->d_name, &page);
+ de = ext2_find_entry(dir, &dentry->d_name, &page, &page_addr);
if (IS_ERR(de)) {
err = PTR_ERR(de);
goto out;
}
err = ext2_delete_entry (de, page);
+ ext2_put_page(page, page_addr);
if (err)
goto out;
@@ -327,8 +329,10 @@ static int ext2_rename (struct user_namespace * mnt_userns,
struct inode * old_inode = d_inode(old_dentry);
struct inode * new_inode = d_inode(new_dentry);
struct page * dir_page = NULL;
+ void *dir_page_addr;
struct ext2_dir_entry_2 * dir_de = NULL;
struct page * old_page;
+ void *old_page_addr;
struct ext2_dir_entry_2 * old_de;
int err;
@@ -343,7 +347,8 @@ static int ext2_rename (struct user_namespace * mnt_userns,
if (err)
goto out;
- old_de = ext2_find_entry(old_dir, &old_dentry->d_name, &old_page);
+ old_de = ext2_find_entry(old_dir, &old_dentry->d_name, &old_page,
+ &old_page_addr);
if (IS_ERR(old_de)) {
err = PTR_ERR(old_de);
goto out;
@@ -351,12 +356,13 @@ static int ext2_rename (struct user_namespace * mnt_userns,
if (S_ISDIR(old_inode->i_mode)) {
err = -EIO;
- dir_de = ext2_dotdot(old_inode, &dir_page);
+ dir_de = ext2_dotdot(old_inode, &dir_page, &dir_page_addr);
if (!dir_de)
goto out_old;
}
if (new_inode) {
+ void *page_addr;
struct page *new_page;
struct ext2_dir_entry_2 *new_de;
@@ -364,12 +370,14 @@ static int ext2_rename (struct user_namespace * mnt_userns,
if (dir_de && !ext2_empty_dir (new_inode))
goto out_dir;
- new_de = ext2_find_entry(new_dir, &new_dentry->d_name, &new_page);
+ new_de = ext2_find_entry(new_dir, &new_dentry->d_name,
+ &new_page, &page_addr);
if (IS_ERR(new_de)) {
err = PTR_ERR(new_de);
goto out_dir;
}
- ext2_set_link(new_dir, new_de, new_page, old_inode, 1);
+ ext2_set_link(new_dir, new_de, new_page, page_addr, old_inode, 1);
+ ext2_put_page(new_page, page_addr);
new_inode->i_ctime = current_time(new_inode);
if (dir_de)
drop_nlink(new_inode);
@@ -389,23 +397,25 @@ static int ext2_rename (struct user_namespace * mnt_userns,
old_inode->i_ctime = current_time(old_inode);
mark_inode_dirty(old_inode);
- ext2_delete_entry (old_de, old_page);
+ ext2_delete_entry(old_de, 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_set_link(old_inode, dir_de, dir_page,
+ dir_page_addr, new_dir, 0);
+
+ ext2_put_page(dir_page, dir_page_addr);
inode_dec_link_count(old_dir);
}
- return 0;
+ ext2_put_page(old_page, old_page_addr);
+ return 0;
out_dir:
if (dir_de)
- ext2_put_page(dir_page);
+ ext2_put_page(dir_page, dir_page_addr);
out_old:
- ext2_put_page(old_page);
+ ext2_put_page(old_page, old_page_addr);
out:
return err;
}
@@ -426,6 +436,8 @@ const struct inode_operations ext2_dir_inode_operations = {
.get_acl = ext2_get_acl,
.set_acl = ext2_set_acl,
.tmpfile = ext2_tmpfile,
+ .fileattr_get = ext2_fileattr_get,
+ .fileattr_set = ext2_fileattr_set,
};
const struct inode_operations ext2_special_inode_operations = {