From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bob Peterson Date: Wed, 19 Nov 2014 15:33:29 -0500 (EST) Subject: [Cluster-devel] [PATCH 1/3] gfs2: bugger off early if O_CREAT open finds a directory In-Reply-To: <20141119193449.GZ7996@ZenIV.linux.org.uk> References: <20141119193404.GY7996@ZenIV.linux.org.uk> <20141119193449.GZ7996@ZenIV.linux.org.uk> Message-ID: <1173544096.16629343.1416429209461.JavaMail.zimbra@redhat.com> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit ----- Original Message ----- > Signed-off-by: Al Viro > --- > fs/gfs2/inode.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c > index c4ed823..310e248 100644 > --- a/fs/gfs2/inode.c > +++ b/fs/gfs2/inode.c > @@ -624,6 +624,11 @@ 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 (S_ISDIR(inode->i_mode)) { > + iput(inode); > + inode = ERR_PTR(-EISDIR); > + goto fail_gunlock; > + } > d = d_splice_alias(inode, dentry); > error = PTR_ERR(d); > if (IS_ERR(d)) { > -- > 1.7.10.4 > > Hm. Seems wrong that it should return 0 if the dirent exists (mkdir of a directory that already exists) but it looks like it already behaves that way. So I guess so. It may warrant further investigation. Bob Peterson Red Hat File Systems