author: Al Viro <viro@zeniv.linux.org.uk> 2021-02-10 22:13:03 -0500
committer: Al Viro <viro@zeniv.linux.org.uk> 2021-03-12 22:15:20 -0500
commit: 3bcb39b086bf8d7c3cff013564f86162ec497d90
parent: 4ab5260dab28109979a1b47a8996c9922219927f
Commit Summary:
Diffstat:
1 file changed, 11 insertions, 1 deletion
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index d46b36d52211..80c487fcf10e 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -1739,6 +1739,16 @@ cifs_mkdir_qinfo(struct inode *parent, struct dentry *dentry, umode_t mode,
if (rc)
return rc;
+ if (!S_ISDIR(inode->i_mode)) {
+ /*
+ * mkdir succeeded, but another client has managed to remove the
+ * sucker and replace it with non-directory. Return success,
+ * but don't leave the child in dcache.
+ */
+ iput(inode);
+ d_drop(dentry);
+ return 0;
+ }
/*
* setting nlink not necessary except in cases where we failed to get it
* from the server or was set bogus. Also, since this is a brand new
@@ -1790,7 +1800,7 @@ cifs_mkdir_qinfo(struct inode *parent, struct dentry *dentry, umode_t mode,
}
}
d_instantiate(dentry, inode);
- return rc;
+ return 0;
}
static int