ksmbd: Add check in cifs_mkdir() for SMB2/3
Subsystems (2)
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.
Signed-off-by Aaditya Kansal <[email protected]>
--- fs/smb/client/inode.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
fs/smb/client/inode.c +3 -3
@@ -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
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 tocifs_mkdir_qinfo()for SMB 2/3.Signed-off-by Aaditya Kansal <[email protected]>--- fs/smb/client/inode.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)fs/smb/client/inode.c +3
-4@@ -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