Skip to contentSkip to conversation

ksmbd: Add check in cifs_mkdir() for SMB2/3

PATCH In review Aaditya Kansal 2 participants 2 messages Nov 27, 2025 – Nov 29, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ksmbd: Add check in cifs_mkdir() for SMB2/3

Add a version check in cifs_mkdir(). The check skips a function call to cifs_mkdir_qinfo() for SMB 2/3.

---
 fs/smb/client/inode.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
fs/smb/client/inode.c +3 -3
index cac355364e43..f6f223a5a97b 100644
@@ -2314,9 +2314,9 @@ struct dentry *cifs_mkdir(struct mnt_idmap *idmap, struct inode *inode,
 		goto mkdir_out;
 	}
 
-	/* TODO: skip this for smb2/smb3 */
-	rc = cifs_mkdir_qinfo(inode, direntry, mode, full_path, cifs_sb, tcon,
-			      xid);
+	if (server->vals->protocol_id == SMB10_PROT_ID)
+		rc = cifs_mkdir_qinfo(inode, direntry, mode, full_path, cifs_sb,
+				tcon, xid);
 mkdir_out:
 	/*
 	 * Force revalidate to get parent dir info when needed since cached
Signature · 1 line
2.52.0
#1 lore raw

Looking at this more carefully it looks like the comment is wrong (it can't be skipped for SMB2 and later currently, there is code in it that is non-SMB1 specific). Looks like this patch is incorrect. There is a general todo to rewrite cifs_mkdir() more cleanly (and partition out the smb1 mkdir code and smb1 posix mkdir code more cleanly via an smb1 specific helper function) but looks like we can't skip cifs_mkdir_qinfo() as your patch would

Quoted 30 lines · Aaditya Kansal

Add a version check in cifs_mkdir(). The check skips a function call to cifs_mkdir_qinfo() for SMB 2/3.

---
 fs/smb/client/inode.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
fs/smb/client/inode.c +3 -4
index cac355364e43..f6f223a5a97b 100644
@@ -2314,9 +2314,9 @@ struct dentry *cifs_mkdir(struct mnt_idmap *idmap, struct inode *inode,
                goto mkdir_out;
        }
 
-       /* TODO: skip this for smb2/smb3 */
-       rc = cifs_mkdir_qinfo(inode, direntry, mode, full_path, cifs_sb, tcon,
-                             xid);
+       if (server->vals->protocol_id == SMB10_PROT_ID)
+               rc = cifs_mkdir_qinfo(inode, direntry, mode, full_path, cifs_sb,
+                               tcon, xid);
 mkdir_out:
        /*
         * Force revalidate to get parent dir info when needed since cached
--

2.52.0

Signature · 3 lines
Thanks,

Steve