diff options
author | J. Bruce Fields <bfields@fieldses.org> | 2014-01-16 13:51:07 -0500 |
---|---|---|
committer | Jiri Slaby <jslaby@suse.cz> | 2014-06-27 10:25:10 +0200 |
commit | 22d3112ae7f819d3965ede21a79a5b5ad6ff33ed (patch) | |
tree | 427e4cf43a1eae352f1cff7dee04f1755fb1488f /fs | |
parent | 63a97385b3919335ff2a1d502925de4dc3ef4fd4 (diff) |
GFS2: revert "GFS2: d_splice_alias() can't return error"
commit d57b9c9a999a8f4475fe73fba629c964245800ca upstream.
0d0d110720d7960b77c03c9f2597faaff4b484ae 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>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/gfs2/inode.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c index 630db362a2d1..e803e3cafc53 100644 --- a/fs/gfs2/inode.c +++ b/fs/gfs2/inode.c @@ -583,6 +583,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)) { @@ -777,6 +780,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); |