Skip to content

Commit

Permalink
GFS2: revert "GFS2: d_splice_alias() can't return error"
Browse files Browse the repository at this point in the history
0d0d110 asserts that "d_splice_alias()
can't return error unless it was given an IS_ERR(inode)".

That was true of the implementation of d_splice_alias, but this is
really a problem with d_splice_alias: at a minimum it should be able to
return -ELOOP in the case where inserting the given dentry would cause a
directory loop.

Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
  • Loading branch information
J. Bruce Fields authored and Steven Whitehouse committed Jan 18, 2014
1 parent 8b127d0 commit d57b9c9
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions fs/gfs2/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,9 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry,
error = PTR_ERR(inode);
if (!IS_ERR(inode)) {
d = d_splice_alias(inode, dentry);
error = PTR_ERR(d);
if (IS_ERR(d))
goto fail_gunlock;
error = 0;
if (file) {
if (S_ISREG(inode->i_mode)) {
Expand Down Expand Up @@ -799,6 +802,11 @@ static struct dentry *__gfs2_lookup(struct inode *dir, struct dentry *dentry,
}

d = d_splice_alias(inode, dentry);
if (IS_ERR(d)) {
iput(inode);
gfs2_glock_dq_uninit(&gh);
return d;
}
if (file && S_ISREG(inode->i_mode))
error = finish_open(file, dentry, gfs2_open_common, opened);

Expand Down

0 comments on commit d57b9c9

Please sign in to comment.