Skip to content

Commit

Permalink
Try #1553:
Browse files Browse the repository at this point in the history
  • Loading branch information
mayastor-bors committed Dec 8, 2023
2 parents 033dc9d + 0bd4b3b commit bbee9a9
Showing 1 changed file with 9 additions and 14 deletions.
23 changes: 9 additions & 14 deletions io-engine/src/bdev/nexus/nexus_child.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1103,16 +1103,13 @@ impl<'c> NexusChild<'c> {
info!("{self:?}: unplugging child...");

let state = self.state();
let is_destroying = self.is_destroying();

// Only drop the device and the device descriptor if the child is being
// destroyed. For a hot remove event, keep the device and descriptor.
if is_destroying {
debug!("{self:?}: dropping block device");
self.device = None;
} else {
debug!("{self:?}: hot remove: keeping block device");
}
// Drop the device and the device descriptor if the child is being
// destroyed or hot removed. For hot remove, the DeviceRemoved event
// will send us here and keeping the device/descriptor isn't of
// any use.
debug!("{self:?}: dropping block device");
self.device = None;

if matches!(state, ChildState::Open) {
// Change the state of the child to ensure it is taken out of
Expand All @@ -1137,11 +1134,9 @@ impl<'c> NexusChild<'c> {
});
}

if is_destroying {
// Dropping the last descriptor results in the device being removed.
// This must be performed in this function.
self.device_descriptor.take();
}
// Dropping the last descriptor results in the device being removed.
// This must be performed in this function.
self.device_descriptor.take();

self.unplug_complete();
info!("{self:?}: child successfully unplugged");
Expand Down

0 comments on commit bbee9a9

Please sign in to comment.