Commit e5f78159 authored by Yi Zhuang's avatar Yi Zhuang Committed by Theodore Ts'o

ext4: lost matching-pair of trace in ext4_unlink

If dquot_initialize() return non-zero and trace of ext4_unlink_enter/exit
enabled then the matching-pair of trace_exit will lost in log.
Signed-off-by: default avatarYi Zhuang <zhuangyi1@huawei.com>
Reviewed-by: default avatarAndreas Dilger <adilger@dilger.ca>
Reviewed-by: default avatarRitesh Harjani <riteshh@linux.ibm.com>
Link: https://lore.kernel.org/r/20200629122621.129953-1-zhuangyi1@huawei.comSigned-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
parent 9a5d265f
...@@ -3203,30 +3203,33 @@ static int ext4_unlink(struct inode *dir, struct dentry *dentry) ...@@ -3203,30 +3203,33 @@ static int ext4_unlink(struct inode *dir, struct dentry *dentry)
* in separate transaction */ * in separate transaction */
retval = dquot_initialize(dir); retval = dquot_initialize(dir);
if (retval) if (retval)
return retval; goto out_trace;
retval = dquot_initialize(d_inode(dentry)); retval = dquot_initialize(d_inode(dentry));
if (retval) if (retval)
return retval; goto out_trace;
retval = -ENOENT;
bh = ext4_find_entry(dir, &dentry->d_name, &de, NULL); bh = ext4_find_entry(dir, &dentry->d_name, &de, NULL);
if (IS_ERR(bh)) if (IS_ERR(bh)) {
return PTR_ERR(bh); retval = PTR_ERR(bh);
if (!bh) goto out_trace;
goto end_unlink; }
if (!bh) {
retval = -ENOENT;
goto out_trace;
}
inode = d_inode(dentry); inode = d_inode(dentry);
if (le32_to_cpu(de->inode) != inode->i_ino) {
retval = -EFSCORRUPTED; retval = -EFSCORRUPTED;
if (le32_to_cpu(de->inode) != inode->i_ino) goto out_bh;
goto end_unlink; }
handle = ext4_journal_start(dir, EXT4_HT_DIR, handle = ext4_journal_start(dir, EXT4_HT_DIR,
EXT4_DATA_TRANS_BLOCKS(dir->i_sb)); EXT4_DATA_TRANS_BLOCKS(dir->i_sb));
if (IS_ERR(handle)) { if (IS_ERR(handle)) {
retval = PTR_ERR(handle); retval = PTR_ERR(handle);
handle = NULL; goto out_bh;
goto end_unlink;
} }
if (IS_DIRSYNC(dir)) if (IS_DIRSYNC(dir))
...@@ -3234,12 +3237,12 @@ static int ext4_unlink(struct inode *dir, struct dentry *dentry) ...@@ -3234,12 +3237,12 @@ static int ext4_unlink(struct inode *dir, struct dentry *dentry)
retval = ext4_delete_entry(handle, dir, de, bh); retval = ext4_delete_entry(handle, dir, de, bh);
if (retval) if (retval)
goto end_unlink; goto out_handle;
dir->i_ctime = dir->i_mtime = current_time(dir); dir->i_ctime = dir->i_mtime = current_time(dir);
ext4_update_dx_flag(dir); ext4_update_dx_flag(dir);
retval = ext4_mark_inode_dirty(handle, dir); retval = ext4_mark_inode_dirty(handle, dir);
if (retval) if (retval)
goto end_unlink; goto out_handle;
if (inode->i_nlink == 0) if (inode->i_nlink == 0)
ext4_warning_inode(inode, "Deleting file '%.*s' with no links", ext4_warning_inode(inode, "Deleting file '%.*s' with no links",
dentry->d_name.len, dentry->d_name.name); dentry->d_name.len, dentry->d_name.name);
...@@ -3261,10 +3264,11 @@ static int ext4_unlink(struct inode *dir, struct dentry *dentry) ...@@ -3261,10 +3264,11 @@ static int ext4_unlink(struct inode *dir, struct dentry *dentry)
d_invalidate(dentry); d_invalidate(dentry);
#endif #endif
end_unlink: out_handle:
brelse(bh);
if (handle)
ext4_journal_stop(handle); ext4_journal_stop(handle);
out_bh:
brelse(bh);
out_trace:
trace_ext4_unlink_exit(dentry, retval); trace_ext4_unlink_exit(dentry, retval);
return retval; return retval;
} }
......
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