Skip to content

Commit 2ba0d89

Browse files
palismfrench
authored andcommitted
cifs: Recognize SFU socket type
SFU since its (first) version 3.0 supports AF_LOCAL sockets and stores them on filesytem as system file with one zero byte. Add support for detecting this SFU socket type into cifs_sfu_type() function. With this change cifs_sfu_type() would correctly detect all special file types created by SFU: fifo, socket, symlink, block and char. Signed-off-by: Pali Rohár <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent 25f6bd0 commit 2ba0d89

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

fs/smb/client/inode.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,7 @@ cifs_sfu_type(struct cifs_fattr *fattr, const char *path,
545545
fattr->cf_mode |= S_IFIFO;
546546
fattr->cf_dtype = DT_FIFO;
547547
return 0;
548-
} else if (fattr->cf_eof < 8) {
548+
} else if (fattr->cf_eof > 1 && fattr->cf_eof < 8) {
549549
fattr->cf_mode |= S_IFREG;
550550
fattr->cf_dtype = DT_REG;
551551
return -EINVAL; /* EOPNOTSUPP? */
@@ -655,6 +655,10 @@ cifs_sfu_type(struct cifs_fattr *fattr, const char *path,
655655
fattr->cf_dtype = DT_REG;
656656
rc = -EOPNOTSUPP;
657657
}
658+
} else if ((rc == 0) && (bytes_read == 1) && (pbuf[0] == '\0')) {
659+
cifs_dbg(FYI, "Socket\n");
660+
fattr->cf_mode |= S_IFSOCK;
661+
fattr->cf_dtype = DT_SOCK;
658662
} else {
659663
fattr->cf_mode |= S_IFREG; /* then it is a file */
660664
fattr->cf_dtype = DT_REG;

0 commit comments

Comments
 (0)