Skip to content

Commit

Permalink
cifs: Recognize SFU socket type
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
pali authored and Steve French committed Sep 15, 2024
1 parent 25f6bd0 commit 2ba0d89
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion fs/smb/client/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ cifs_sfu_type(struct cifs_fattr *fattr, const char *path,
fattr->cf_mode |= S_IFIFO;
fattr->cf_dtype = DT_FIFO;
return 0;
} else if (fattr->cf_eof < 8) {
} else if (fattr->cf_eof > 1 && fattr->cf_eof < 8) {
fattr->cf_mode |= S_IFREG;
fattr->cf_dtype = DT_REG;
return -EINVAL; /* EOPNOTSUPP? */
Expand Down Expand Up @@ -655,6 +655,10 @@ cifs_sfu_type(struct cifs_fattr *fattr, const char *path,
fattr->cf_dtype = DT_REG;
rc = -EOPNOTSUPP;
}
} else if ((rc == 0) && (bytes_read == 1) && (pbuf[0] == '\0')) {
cifs_dbg(FYI, "Socket\n");
fattr->cf_mode |= S_IFSOCK;
fattr->cf_dtype = DT_SOCK;
} else {
fattr->cf_mode |= S_IFREG; /* then it is a file */
fattr->cf_dtype = DT_REG;
Expand Down

0 comments on commit 2ba0d89

Please sign in to comment.