Skip to content

Commit b460249

Browse files
palismfrench
authored andcommitted
cifs: Fix calling CIFSFindFirst() for root path without msearch
To query root path (without msearch wildcard) it is needed to send pattern '\' instead of '' (empty string). This allows to use CIFSFindFirst() to query information about root path which is being used in followup changes. This change fixes the stat() syscall called on the root path on the mount. It is because stat() syscall uses the cifs_query_path_info() function and it can fallback to the CIFSFindFirst() usage with msearch=false. Signed-off-by: Pali Rohár <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent 33cfdd7 commit b460249

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

fs/smb/client/cifssmb.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4020,6 +4020,12 @@ CIFSFindFirst(const unsigned int xid, struct cifs_tcon *tcon,
40204020
pSMB->FileName[name_len] = 0;
40214021
pSMB->FileName[name_len+1] = 0;
40224022
name_len += 2;
4023+
} else if (!searchName[0]) {
4024+
pSMB->FileName[0] = CIFS_DIR_SEP(cifs_sb);
4025+
pSMB->FileName[1] = 0;
4026+
pSMB->FileName[2] = 0;
4027+
pSMB->FileName[3] = 0;
4028+
name_len = 4;
40234029
}
40244030
} else {
40254031
name_len = copy_path_name(pSMB->FileName, searchName);
@@ -4031,6 +4037,10 @@ CIFSFindFirst(const unsigned int xid, struct cifs_tcon *tcon,
40314037
pSMB->FileName[name_len] = '*';
40324038
pSMB->FileName[name_len+1] = 0;
40334039
name_len += 2;
4040+
} else if (!searchName[0]) {
4041+
pSMB->FileName[0] = CIFS_DIR_SEP(cifs_sb);
4042+
pSMB->FileName[1] = 0;
4043+
name_len = 2;
40344044
}
40354045
}
40364046

0 commit comments

Comments
 (0)