Skip to content

Commit 0d6b0d2

Browse files
paliSteve French
authored andcommitted
cifs: Recognize SFU char/block devices created by Windows NFS server on Windows Server <<2012
Windows NFS server versions on Windows Server older than 2012 release use for storing char and block devices modified SFU format, not compatible with the original SFU. Windows NFS server on Windows Server 2012 and new versions use different format (reparse points), not related to SFU-style. SFU / SUA / Interix subsystem stores the major and major numbers as pair of 64-bit integer, but Windows NFS server stores as pair of 32-bit integers. Which makes char and block devices between Windows NFS server <<2012 and Windows SFU/SUA/Interix subsytem incompatible. So improve Linux SMB client. When SFU mode is enabled (mount option -o sfu is specified) then recognize also these kind of char and block devices and its major and minor numbers, which are used by Windows Server versions older than 2012. Signed-off-by: Pali Rohár <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent db363b0 commit 0d6b0d2

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

fs/smb/client/inode.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -598,6 +598,17 @@ cifs_sfu_type(struct cifs_fattr *fattr, const char *path,
598598
mjr = le64_to_cpu(*(__le64 *)(pbuf+8));
599599
mnr = le64_to_cpu(*(__le64 *)(pbuf+16));
600600
fattr->cf_rdev = MKDEV(mjr, mnr);
601+
} else if (bytes_read == 16) {
602+
/*
603+
* Windows NFS server before Windows Server 2012
604+
* stores major and minor number in SFU-modified
605+
* style, just as 32-bit numbers. Recognize it.
606+
*/
607+
__u32 mjr; /* major */
608+
__u32 mnr; /* minor */
609+
mjr = le32_to_cpu(*(__le32 *)(pbuf+8));
610+
mnr = le32_to_cpu(*(__le32 *)(pbuf+12));
611+
fattr->cf_rdev = MKDEV(mjr, mnr);
601612
}
602613
} else if (memcmp("IntxCHR\0", pbuf, 8) == 0) {
603614
cifs_dbg(FYI, "Char device\n");
@@ -610,6 +621,17 @@ cifs_sfu_type(struct cifs_fattr *fattr, const char *path,
610621
mjr = le64_to_cpu(*(__le64 *)(pbuf+8));
611622
mnr = le64_to_cpu(*(__le64 *)(pbuf+16));
612623
fattr->cf_rdev = MKDEV(mjr, mnr);
624+
} else if (bytes_read == 16) {
625+
/*
626+
* Windows NFS server before Windows Server 2012
627+
* stores major and minor number in SFU-modified
628+
* style, just as 32-bit numbers. Recognize it.
629+
*/
630+
__u32 mjr; /* major */
631+
__u32 mnr; /* minor */
632+
mjr = le32_to_cpu(*(__le32 *)(pbuf+8));
633+
mnr = le32_to_cpu(*(__le32 *)(pbuf+12));
634+
fattr->cf_rdev = MKDEV(mjr, mnr);
613635
}
614636
} else if (memcmp("LnxSOCK", pbuf, 8) == 0) {
615637
cifs_dbg(FYI, "Socket\n");

0 commit comments

Comments
 (0)