Fix: Make sure we release the Write-Lock
This was suggested by Marcel Müller, who also debugged this issue and found that this snippet was the error. The problem was, that we had the write-lock when starting the hooks. If the hook runs into an Err() mapping part where the Entry could already be drop()ed, Rust tries to be smart and drops the object. As we are still in the creation code of the entry, this paniced as we still hold the W-Lock and the drop() tryies to call _update() on the entry, which also tries to W-lock it. With the new additional scope, the W-lock gets dropped early and we do not have this problem anymore. Signed-off-by: Matthias Beyer <mail@beyermatthias.de> Suggested-by: Marcel Müller <neikos@neikos.email> Reported-by: Matthias Beyer <mail@beyermatthias.de>
This commit is contained in:
parent
6e988782da
commit
7b5d37a039
1 changed files with 13 additions and 11 deletions
|
@ -390,6 +390,7 @@ impl Store {
|
|||
.map_err_into(SEK::CreateCallError)
|
||||
}
|
||||
|
||||
{
|
||||
let mut hsmap = match self.entries.write() {
|
||||
Err(_) => return Err(SEK::LockPoisoned.into_error()).map_err_into(SEK::CreateCallError),
|
||||
Ok(s) => s,
|
||||
|
@ -403,6 +404,7 @@ impl Store {
|
|||
se.status = StoreEntryStatus::Borrowed;
|
||||
se
|
||||
});
|
||||
}
|
||||
|
||||
let mut fle = FileLockEntry::new(self, Entry::new(id));
|
||||
self.execute_hooks_for_mut_file(self.post_create_aspects.clone(), &mut fle)
|
||||
|
|
Loading…
Reference in a new issue