diff options
Diffstat (limited to 'fs/ext4/file.c')
-rw-r--r-- | fs/ext4/file.c | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/fs/ext4/file.c b/fs/ext4/file.c index 6f4cc567c382..319c9d26279a 100644 --- a/fs/ext4/file.c +++ b/fs/ext4/file.c | |||
@@ -219,7 +219,6 @@ static int ext4_file_open(struct inode * inode, struct file * filp) | |||
219 | { | 219 | { |
220 | struct super_block *sb = inode->i_sb; | 220 | struct super_block *sb = inode->i_sb; |
221 | struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb); | 221 | struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb); |
222 | struct ext4_inode_info *ei = EXT4_I(inode); | ||
223 | struct vfsmount *mnt = filp->f_path.mnt; | 222 | struct vfsmount *mnt = filp->f_path.mnt; |
224 | struct path path; | 223 | struct path path; |
225 | char buf[64], *cp; | 224 | char buf[64], *cp; |
@@ -259,22 +258,10 @@ static int ext4_file_open(struct inode * inode, struct file * filp) | |||
259 | * Set up the jbd2_inode if we are opening the inode for | 258 | * Set up the jbd2_inode if we are opening the inode for |
260 | * writing and the journal is present | 259 | * writing and the journal is present |
261 | */ | 260 | */ |
262 | if (sbi->s_journal && !ei->jinode && (filp->f_mode & FMODE_WRITE)) { | 261 | if (filp->f_mode & FMODE_WRITE) { |
263 | struct jbd2_inode *jinode = jbd2_alloc_inode(GFP_KERNEL); | 262 | int ret = ext4_inode_attach_jinode(inode); |
264 | 263 | if (ret < 0) | |
265 | spin_lock(&inode->i_lock); | 264 | return ret; |
266 | if (!ei->jinode) { | ||
267 | if (!jinode) { | ||
268 | spin_unlock(&inode->i_lock); | ||
269 | return -ENOMEM; | ||
270 | } | ||
271 | ei->jinode = jinode; | ||
272 | jbd2_journal_init_jbd_inode(ei->jinode, inode); | ||
273 | jinode = NULL; | ||
274 | } | ||
275 | spin_unlock(&inode->i_lock); | ||
276 | if (unlikely(jinode != NULL)) | ||
277 | jbd2_free_inode(jinode); | ||
278 | } | 265 | } |
279 | return dquot_file_open(inode, filp); | 266 | return dquot_file_open(inode, filp); |
280 | } | 267 | } |