Issue Details (XML | Word | Printable)

Key: CORE-6323
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Dmitry Yemanov
Reporter: Dmitry Yemanov
Votes: 0
Watchers: 2
Operations

If you were logged in you would be able to see more operations.
Firebird Core

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

Created: 03/Jun/20 04:47 PM   Updated: 06/Jun/20 09:32 AM
Component/s: Engine
Affects Version/s: 2.5.0, 2.5.1, 2.5.2, 2.5.2 Update 1, 2.5.3, 2.1.7, 2.5.3 Update 1, 2.5.4, 2.5.5, 4.0 Initial, 3.0.0, 2.5.6, 3.0.1, 2.5.7, 3.0.2, 4.0 Alpha 1, 2.5.8, 3.0.3, 3.0.4, 4.0 Beta 1, 2.5.9, 3.0.5, 4.0 Beta 2
Fix Version/s: 3.0.6, 4.0 RC 1

Environment: Windows only

QA Status: Cannot be tested


 Description  « Hide
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.


 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Dmitry Yemanov made changes - 03/Jun/20 04:47 PM
Field Original Value New Value
Assignee Dmitry Yemanov [ dimitr ]
Sean Leyne added a comment - 03/Jun/20 07:13 PM
What change you are proposing to resolve this issue?

Dmitry Yemanov added a comment - 04/Jun/20 05:21 AM
Use volume GUID (for local drives) or network share name (for remote drives) instead of the VSN. It's already committed.

Dmitry Yemanov made changes - 04/Jun/20 08:34 PM
Status Open [ 1 ] Resolved [ 5 ]
Fix Version/s 3.0.6 [ 10889 ]
Fix Version/s 4.0 RC 1 [ 10930 ]
Resolution Fixed [ 1 ]
Pavel Zotov made changes - 06/Jun/20 09:32 AM
Status Resolved [ 5 ] Resolved [ 5 ]
QA Status No test Cannot be tested