Page MenuHomeFreeBSD

g_part: access leak causes process to hang
Needs ReviewPublic

Authored by imp on Mon, Aug 24, 3:15 AM.
Tags
None
Referenced Files
F168429368: D59138.id184863.diff
Fri, Aug 28, 7:04 AM
Unknown Object (File)
Thu, Aug 27, 2:04 PM
Unknown Object (File)
Thu, Aug 27, 4:57 AM
Unknown Object (File)
Wed, Aug 26, 11:05 PM
Unknown Object (File)
Wed, Aug 26, 11:25 AM
Unknown Object (File)
Tue, Aug 25, 11:12 AM
Unknown Object (File)
Tue, Aug 25, 10:29 AM
Unknown Object (File)
Tue, Aug 25, 9:05 AM
Subscribers
None
This revision needs review, but there are no reviewers specified.

Details

Reviewers
None
Summary

So if one inserts a USB drive with a GPT that doesn't match the media
size, a resize is initiated, so gpart takes g_access(cp, 1, 1, 1) on the
disk and holds it until the resize is accepted or rejected. The orphan
path releases it, but the spoil path does not. So if the drive is
ejected while the resize is in flight, we call spoil directly, and don't
release the access. Since gpt_opened is not cleared for the spoil path,
this causes several different process to hang in the open path waiting
for the leaked access.

Move the release into the wither function when gpt_opened is set, and
remove the release elsewhere. Since all paths to destroy the geom pass
through wither, this ensure that access is always released when we've
taken the access for resize.

PR: 297777
Reported by: Rick Richard
MFC After: 1 week

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 76041
Build 72924: arc lint + arc unit

Event Timeline

imp requested review of this revision.Mon, Aug 24, 3:15 AM
imp created this revision.