parse_dos_attribute_blob() inconsistent file_id through make_file_id_from_itime()
ganchev at fixity.net
Thu Dec 12 22:26:06 UTC 2019
I have recently experienced some strange behavior while browsing folders with clients that respect SMB fileid e.g. most recent Windows 10, Windows 2019 Server, MacOS Catalina. On folders with multiple image files, on Windows there would be repeated thumbnails among files and on MacOS thumbnails for certain files would not be showed at all. This behavior could not be reproduced with older version of the mentioned OSes without fileid support in the SMB implementation.
Tracking down the issue I noticed that copying files with multiple threads will often produce the same change timestamp for different batches of files even though we have granularity information from the underlying file system (e.g. we have proper nsec information).
This is an issue because parse_dos_attribute_blob() is presented the same fileid for different files through make_file_id_from_itime(). The same method of getting fileid is also used in open_file_ntcreate().
Looking at make_file_id_from_itime() I noticed that when ST_EX_IFLAG_CALCULATED_ITIME flag is unset this will return a fileid based of the invented time only which in the aforementioned case is producing the same fileid for files that have the same change timestamp in the underlying fs.
Based on MS-SMB specification fileid must be unique for a file on a given object store and must persist for the lifetime of the file. It also should not be changed when a file is renamed.
I am about to open a bug report and I would like to suggest a patch, but for the sakes of implementing the patch in a proper way I would like to ask if there is a particular reason why fileid is based only on itime in make_file_id_from_itime() when ST_EX_IFLAG_CALCULATED_ITIME is unset?
More information about the samba-technical