From: NeilBrown gfs2 incorrectly returns -EFTYPE for any non-regular when __O_REGULAR is in force. A symlink might not be an error, and nfsd needs to know if a directory was found. Neither this check, or the following check for a directory is needed. Both cases are handled correctly by instantiating the dentry and passing it to finish_no_open() - the caller will interpret the type. Signed-off-by: NeilBrown --- fs/gfs2/inode.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c index f361876c5583..7aa92bb31cf4 100644 --- a/fs/gfs2/inode.c +++ b/fs/gfs2/inode.c @@ -738,19 +738,10 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry, inode = gfs2_dir_search(dir, &dentry->d_name, !S_ISREG(mode) || excl); error = PTR_ERR(inode); if (!IS_ERR(inode)) { - if (file && (file->f_flags & __O_REGULAR) && - !S_ISREG(inode->i_mode)) { - iput(inode); - inode = NULL; - error = -EFTYPE; - goto fail_gunlock; - } - if (S_ISDIR(inode->i_mode)) { - iput(inode); - inode = NULL; - error = -EISDIR; - goto fail_gunlock; - } + /* + * This can only happen if "S_ISREG(mode) && !excl" so "file" + * cannot be NULL. + */ d_instantiate(dentry, inode); error = 0; if (file) { -- 2.50.0.107.gf914562f5916.dirty