Closed Bug 1919556 Opened 2 years ago Closed 2 years ago

FS: Fix handling of directory locks invalidated during database initialization

Categories

(Core :: Storage: Bucket File System, defect, P2)

defect

Tracking

()

RESOLVED FIXED
133 Branch
Tracking Status
firefox133 --- fixed

People

(Reporter: janv, Assigned: janv)

References

Details

Attachments

(8 external files)

No description provided.

mBackgroundRequestHandler->FileSystemManagerChildStrongRef() is currently
expected to return a non-null value when FileSystemManager::BeginRequest gets a
success for mBackgroundRequestHandler->CreateFileSystemManagerChild. It turns
out that's not always true because the child actor can get destroyed in the
mean time (FileSystemBackgroundRequestHandler::ClearActor is called). It would
be safer if FileSystemBackgroundRequestHandler::CreateFileSystemManagerChild
returned a strong reference to the created object.

FileSystemManagerChild::CloseAllWritables is sometimes called from
FileSystemManager::Shutdown which can be called late in application shutdown
when GetCurrentSerialEventTarget returns null. At that point there are no
writable file streams and the problem with GetCurrentSerialEventTarget
returning null can be solved by calling the callback directly without
dispatching a new runnable.

It can happen that FileSystemDataManager::AbortOperationsForLocks is called
during asynchronous CreateFileSystemManagerParent operation when the actor is
not yet registered. FileSystemDataManager::RequestAllowToClose is not able
to propagate the notification to the actor in that case. This patch fixes the
problem by checking directory lock and propagating the notification right after
a new actor has been registered.

getDirectory currently fails with unknown error because the actor refuses to
send the GetRootHandle message. For accuracy, it would be better to explicitly
error out FileSystemBackgroundRequestHandler::CreateFileSystemManagerChild if
the actor already received the CloseAll message.

Pushed by jvarga@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/960767ec059a FS: Add a pref for testing; r=dom-storage-reviewers,jari https://hg.mozilla.org/integration/autoland/rev/79abf728d40a FS: Add a new testing only notification for database work starting; r=dom-storage-reviewers,jari https://hg.mozilla.org/integration/autoland/rev/a01a0de91d72 FS: Add support for pausing QM IO thread after finishing database initialization; r=dom-storage-reviewers,jari https://hg.mozilla.org/integration/autoland/rev/434b26eeb6e9 Add a test for origin clearing requested right after starting database work for FS; r=dom-storage-reviewers,jari https://hg.mozilla.org/integration/autoland/rev/722b054485d6 FS: Convert FileSystemBackgroundRequestHandler::CreateFileSystemManagerChild to return a strong reference to the created object; r=dom-storage-reviewers,jari https://hg.mozilla.org/integration/autoland/rev/b6ed66eee249 FS: Call the callback immediately if there are no promises to settle in FileSystemManagerChild::CloseAllWritables; r=dom-storage-reviewers,jari https://hg.mozilla.org/integration/autoland/rev/5c6d546b3816 FS: Call RequestAllowToClose on newly registered actors if the directory lock has been invalidated in the meantime; r=dom-storage-reviewers,jari https://hg.mozilla.org/integration/autoland/rev/654ca93bea0e FS: Error out FileSystemBackgroundRequestHandler::CreateFileSystemManagerChild if the actor received CloseAll message; r=dom-storage-reviewers,jari
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: