]> www.infradead.org Git - users/hch/misc.git/commitdiff
cifs: Add fallback code path for cifs_mkdir_setinfo()
authorPali Rohár <pali@kernel.org>
Mon, 30 Dec 2024 21:18:53 +0000 (22:18 +0100)
committerSteve French <stfrench@microsoft.com>
Fri, 10 Oct 2025 04:01:24 +0000 (23:01 -0500)
Use SMBSetInformation() as a fallback function (when CIFSSMBSetPathInfo()
fails) which can set attribudes on the directory, including changing
read-only attribute.

Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/smb/client/smb1ops.c

index 7b17668e2a54f239e1b41ad8320e09e773530a2b..ca8f3dd7ff63b8555e36daa881e036615fc987bf 100644 (file)
@@ -876,6 +876,11 @@ cifs_mkdir_setinfo(struct inode *inode, const char *full_path,
        info.Attributes = cpu_to_le32(dosattrs);
        rc = CIFSSMBSetPathInfo(xid, tcon, full_path, &info, cifs_sb->local_nls,
                                cifs_sb);
+       if (rc == -EOPNOTSUPP || rc == -EINVAL)
+               rc = SMBSetInformation(xid, tcon, full_path,
+                                      info.Attributes,
+                                      0 /* do not change write time */,
+                                      cifs_sb->local_nls, cifs_sb);
        if (rc == 0)
                cifsInode->cifsAttrs = dosattrs;
 }