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

Aaditya Kansal posted 1 patch 4 days, 9 hours ago
fs/smb/client/inode.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
[PATCH] ksmbd: Add check in cifs_mkdir() for SMB2/3
Posted by Aaditya Kansal 4 days, 9 hours ago
Add a version check in cifs_mkdir(). The check skips a function call to
cifs_mkdir_qinfo() for SMB 2/3.

Signed-off-by: Aaditya Kansal <aadityakansal390@gmail.com>
---
 fs/smb/client/inode.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/smb/client/inode.c b/fs/smb/client/inode.c
index cac355364e43..f6f223a5a97b 100644
--- a/fs/smb/client/inode.c
+++ b/fs/smb/client/inode.c
@@ -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
Re: [PATCH] ksmbd: Add check in cifs_mkdir() for SMB2/3
Posted by Steve French 2 days, 17 hours ago
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

On Thu, Nov 27, 2025 at 6:27 AM Aaditya Kansal
<aadityakansal390@gmail.com> wrote:
>
> Add a version check in cifs_mkdir(). The check skips a function call to
> cifs_mkdir_qinfo() for SMB 2/3.
>
> Signed-off-by: Aaditya Kansal <aadityakansal390@gmail.com>
> ---
>  fs/smb/client/inode.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/fs/smb/client/inode.c b/fs/smb/client/inode.c
> index cac355364e43..f6f223a5a97b 100644
> --- a/fs/smb/client/inode.c
> +++ b/fs/smb/client/inode.c
> @@ -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
>
>


-- 
Thanks,

Steve