Commit 1bc0af60 authored by Eric Biggers's avatar Eric Biggers Committed by Theodore Ts'o

ext4: trim return value and 'dir' argument from ext4_insert_dentry()

In the initial implementation of ext4 encryption, the filename was
encrypted in ext4_insert_dentry(), which could fail and also required
access to the 'dir' inode.  Since then ext4 filename encryption has been
changed to encrypt the filename earlier, so we can revert the additions
to ext4_insert_dentry().
Signed-off-by: default avatarEric Biggers <ebiggers@google.com>
Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
parent 5052b069
...@@ -2356,11 +2356,10 @@ extern int ext4_find_dest_de(struct inode *dir, struct inode *inode, ...@@ -2356,11 +2356,10 @@ extern int ext4_find_dest_de(struct inode *dir, struct inode *inode,
void *buf, int buf_size, void *buf, int buf_size,
struct ext4_filename *fname, struct ext4_filename *fname,
struct ext4_dir_entry_2 **dest_de); struct ext4_dir_entry_2 **dest_de);
int ext4_insert_dentry(struct inode *dir, void ext4_insert_dentry(struct inode *inode,
struct inode *inode, struct ext4_dir_entry_2 *de,
struct ext4_dir_entry_2 *de, int buf_size,
int buf_size, struct ext4_filename *fname);
struct ext4_filename *fname);
static inline void ext4_update_dx_flag(struct inode *inode) static inline void ext4_update_dx_flag(struct inode *inode)
{ {
if (!ext4_has_feature_dir_index(inode->i_sb)) if (!ext4_has_feature_dir_index(inode->i_sb))
......
...@@ -1034,7 +1034,7 @@ static int ext4_add_dirent_to_inline(handle_t *handle, ...@@ -1034,7 +1034,7 @@ static int ext4_add_dirent_to_inline(handle_t *handle,
err = ext4_journal_get_write_access(handle, iloc->bh); err = ext4_journal_get_write_access(handle, iloc->bh);
if (err) if (err)
return err; return err;
ext4_insert_dentry(dir, inode, de, inline_size, fname); ext4_insert_dentry(inode, de, inline_size, fname);
ext4_show_inline_dir(dir, iloc->bh, inline_start, inline_size); ext4_show_inline_dir(dir, iloc->bh, inline_start, inline_size);
......
...@@ -1869,11 +1869,10 @@ int ext4_find_dest_de(struct inode *dir, struct inode *inode, ...@@ -1869,11 +1869,10 @@ int ext4_find_dest_de(struct inode *dir, struct inode *inode,
return res; return res;
} }
int ext4_insert_dentry(struct inode *dir, void ext4_insert_dentry(struct inode *inode,
struct inode *inode, struct ext4_dir_entry_2 *de,
struct ext4_dir_entry_2 *de, int buf_size,
int buf_size, struct ext4_filename *fname)
struct ext4_filename *fname)
{ {
int nlen, rlen; int nlen, rlen;
...@@ -1892,7 +1891,6 @@ int ext4_insert_dentry(struct inode *dir, ...@@ -1892,7 +1891,6 @@ int ext4_insert_dentry(struct inode *dir,
ext4_set_de_type(inode->i_sb, de, inode->i_mode); ext4_set_de_type(inode->i_sb, de, inode->i_mode);
de->name_len = fname_len(fname); de->name_len = fname_len(fname);
memcpy(de->name, fname_name(fname), fname_len(fname)); memcpy(de->name, fname_name(fname), fname_len(fname));
return 0;
} }
/* /*
...@@ -1928,11 +1926,8 @@ static int add_dirent_to_buf(handle_t *handle, struct ext4_filename *fname, ...@@ -1928,11 +1926,8 @@ static int add_dirent_to_buf(handle_t *handle, struct ext4_filename *fname,
return err; return err;
} }
/* By now the buffer is marked for journaling. Due to crypto operations, /* By now the buffer is marked for journaling */
* the following function call may fail */ ext4_insert_dentry(inode, de, blocksize, fname);
err = ext4_insert_dentry(dir, inode, de, blocksize, fname);
if (err < 0)
return err;
/* /*
* XXX shouldn't update any times until successful * XXX shouldn't update any times until successful
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment