_user_initialize_partition(): After performing the operation don't set the new
disk system, if the partition already has a disk system set. This can happen when the disk system's initialization function is lazy and just lets the DDM rescan the partition. In bad cases the previous disk system has a higher priority than the new one and, if its on-disk structures have not been destroyed, it will win the rescan. Not setting the disk system in such cases at least leaves the partition object in a consistent state. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42139 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
ec623acad8
commit
f84387d6c4
@ -1197,7 +1197,16 @@ _user_initialize_partition(partition_id partitionID, int32* _changeCounter,
|
||||
if (error != B_OK)
|
||||
return error;
|
||||
|
||||
partition->SetDiskSystem(diskSystem);
|
||||
// Set the disk system. Re-check whether a disk system is already set on the
|
||||
// partition. Some disk systems just write the on-disk structures and let
|
||||
// the DDM rescan the partition, in which case the disk system will already
|
||||
// be set. In very unfortunate cases the on-disk structure of the previous
|
||||
// disk system has not been destroyed and the previous disk system has a
|
||||
// higher priority than the new one. The old disk system will thus prevail.
|
||||
// Not setting the new disk system will at least prevent that the partition
|
||||
// object gets into an inconsistent state.
|
||||
if (partition->DiskSystem() == NULL)
|
||||
partition->SetDiskSystem(diskSystem);
|
||||
|
||||
// return change counter
|
||||
error = copy_to_user_value(_changeCounter, partition->ChangeCounter());
|
||||
|
Loading…
Reference in New Issue
Block a user