diff options
author | Mark Brown <broonie@kernel.org> | 2018-06-27 14:26:12 +0100 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2018-06-27 14:26:12 +0100 |
commit | 1ce34dea91ae86bb18f493f72292df1bf6f66df7 (patch) | |
tree | a9655fcdd65c2068cc04ffe3562a9c710dfa2145 /fs/ocfs2/refcounttree.c | |
parent | b0e4376b34cab1cbbd7ed399a1df787890336837 (diff) | |
parent | a26899e0baa4de07caf97f5e4d7298240e98fd0e (diff) |
Merge tag 'v4.14.52' into linux-linaro-lsk-v4.14lsk-v4.14-18.06
This is the 4.14.52 stable release
Diffstat (limited to 'fs/ocfs2/refcounttree.c')
-rw-r--r-- | fs/ocfs2/refcounttree.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/fs/ocfs2/refcounttree.c b/fs/ocfs2/refcounttree.c index ab156e35ec00..1b1283f07941 100644 --- a/fs/ocfs2/refcounttree.c +++ b/fs/ocfs2/refcounttree.c @@ -4250,10 +4250,11 @@ out: static int ocfs2_reflink(struct dentry *old_dentry, struct inode *dir, struct dentry *new_dentry, bool preserve) { - int error; + int error, had_lock; struct inode *inode = d_inode(old_dentry); struct buffer_head *old_bh = NULL; struct inode *new_orphan_inode = NULL; + struct ocfs2_lock_holder oh; if (!ocfs2_refcount_tree(OCFS2_SB(inode->i_sb))) return -EOPNOTSUPP; @@ -4295,6 +4296,14 @@ static int ocfs2_reflink(struct dentry *old_dentry, struct inode *dir, goto out; } + had_lock = ocfs2_inode_lock_tracker(new_orphan_inode, NULL, 1, + &oh); + if (had_lock < 0) { + error = had_lock; + mlog_errno(error); + goto out; + } + /* If the security isn't preserved, we need to re-initialize them. */ if (!preserve) { error = ocfs2_init_security_and_acl(dir, new_orphan_inode, @@ -4302,14 +4311,15 @@ static int ocfs2_reflink(struct dentry *old_dentry, struct inode *dir, if (error) mlog_errno(error); } -out: if (!error) { error = ocfs2_mv_orphaned_inode_to_new(dir, new_orphan_inode, new_dentry); if (error) mlog_errno(error); } + ocfs2_inode_unlock_tracker(new_orphan_inode, 1, &oh, had_lock); +out: if (new_orphan_inode) { /* * We need to open_unlock the inode no matter whether we |