File-system ID may be duplicated among databases located on different volumes
-----------------------------------------------------------------------------

                 Key: CORE-6323
                 URL: http://tracker.firebirdsql.org/browse/CORE-6323
             Project: Firebird Core
          Issue Type: Bug
          Components: Engine
    Affects Versions: 4.0 Beta 2, 3.0.5, 2.5.9, 4.0 Beta 1, 3.0.4, 3.0.3, 
2.5.8, 4.0 Alpha 1, 3.0.2, 2.5.7, 3.0.1, 2.5.6, 3.0.0, 4.0 Initial, 2.5.5, 
2.5.4, 2.5.3 Update 1, 2.1.7, 2.5.3, 2.5.2 Update 1, 2.5.2, 2.5.1, 2.5.0
         Environment: Windows only
            Reporter: Dmitry Yemanov


Firebird uses file-system ID of the open database file to uniquely name its 
dependent shared memory files - lock table, event table, etc. File-system ID is 
retrieved using GetFileInformationByHandle() API and composed from the three 
fields (dwVolumeSerialNumber, nFileIndexHigh, nFileIndexLow) that are 
documented in MSDN as providing a unique combination:

https://docs.microsoft.com/ru-ru/windows/win32/api/fileapi/nf-fileapi-getfileinformationbyhandle

"You can compare the VolumeSerialNumber and FileIndex members returned in the 
BY_HANDLE_FILE_INFORMATION structure to determine if two paths map to the same 
target; for example, you can compare two file paths and determine if they map 
to the same directory." 

The problem, however, is that Volume Serial Number (VSN) is not guaranteed to 
be unique. It's generated when then the volume is formatted and it's stored 
inside the volume's master boot record. But if the volume is cloned at the 
physical block level, or if a virtual (preformatted) drive is used, or if a 
volume snapshot (created by storage system like Dell EMC) is attached as a 
different logical drive, then VSN may duplicate an existing VSN. This may cause 
two different databases (located on different volumes) to share the same 
file-system ID thus sharing the same lock table, causing unexpected freezes and 
other undesired side-effects.


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to