* fhandler_disk_file.cc (FS_IS_SAMBA): Move out of
path_conv::hasgood_inode. (path_conv::is_samba): New method. (fhandler_base::fstat_by_handle): Don't even try to use FileIdBothDirectoryInformation on Samba. * path.h (class path_conv): Declare is_samba method.
This commit is contained in:
@ -96,6 +96,10 @@ path_conv::ndisk_links (DWORD nNumberOfLinks)
|
||||
return count + saw_dot;
|
||||
}
|
||||
|
||||
#define FS_IS_SAMBA (FILE_CASE_SENSITIVE_SEARCH \
|
||||
| FILE_CASE_PRESERVED_NAMES \
|
||||
| FILE_PERSISTENT_ACLS)
|
||||
|
||||
bool
|
||||
path_conv::hasgood_inode ()
|
||||
{
|
||||
@ -117,10 +121,7 @@ path_conv::hasgood_inode ()
|
||||
An exception is Samba, which seems to return valid inode numbers
|
||||
without having the FILE_SUPPORTS_OBJECT_IDS flag set. So we're
|
||||
testing for the flag values returned by a 3.x Samba explicitely
|
||||
for now. */
|
||||
#define FS_IS_SAMBA (FILE_CASE_SENSITIVE_SEARCH \
|
||||
| FILE_CASE_PRESERVED_NAMES \
|
||||
| FILE_PERSISTENT_ACLS)
|
||||
for now. But note the comment in the below "is_samba" function. */
|
||||
if (!(fs_flags () & FILE_SUPPORTS_OBJECT_IDS)
|
||||
&& fs_flags () != FS_IS_SAMBA)
|
||||
return false;
|
||||
@ -128,6 +129,25 @@ path_conv::hasgood_inode ()
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
path_conv::is_samba ()
|
||||
{
|
||||
/* Something weird happens on Samba. FileIdBothDirectoryInformation
|
||||
seems to work nicely, but only up to the 128th entry in the
|
||||
directory. After reaching this entry, the next call to
|
||||
NtQueryDirectoryFile(FileIdBothDirectoryInformation) returns
|
||||
STATUS_INVAILD_LEVEL. Why should we care, we can just switch to
|
||||
FileBothDirectoryInformation, isn't it? Nope! The next call to
|
||||
NtQueryDirectoryFile(FileBothDirectoryInformation) actually returns
|
||||
STATUS_NO_MORE_FILES, regardless how many files are left unread in
|
||||
the directory. This does not happen when using
|
||||
FileBothDirectoryInformation right from the start. In that case we
|
||||
can read the whole directory unmolested. So we have to excempt
|
||||
Samba from the usage of FileIdBothDirectoryInformation entirely,
|
||||
even though Samba returns valid File IDs. */
|
||||
return drive_type () == DRIVE_REMOTE && fs_flags () == FS_IS_SAMBA;
|
||||
}
|
||||
|
||||
int __stdcall
|
||||
fhandler_base::fstat_by_handle (struct __stat64 *buf)
|
||||
{
|
||||
@ -1461,7 +1481,7 @@ fhandler_disk_file::opendir ()
|
||||
if (pc.hasgood_inode ())
|
||||
{
|
||||
dir->__flags |= dirent_set_d_ino;
|
||||
if (wincap.has_fileid_dirinfo ())
|
||||
if (wincap.has_fileid_dirinfo () && !pc.is_samba ())
|
||||
dir->__flags |= dirent_get_d_ino;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user