diff options
author | Alex Auvolat <alex@adnab.me> | 2021-03-11 19:06:27 +0100 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2021-03-11 19:06:27 +0100 |
commit | 3f7a496355bdbeeeee859912fa6fa7a95cb47f3b (patch) | |
tree | 53284e346d2020de4a9207b6a20bc1b83ae9df6e /src/model | |
parent | f7c2cd1cd7ee15b9c97b9fbdef25c0644b3523bb (diff) | |
download | garage-3f7a496355bdbeeeee859912fa6fa7a95cb47f3b.tar.gz garage-3f7a496355bdbeeeee859912fa6fa7a95cb47f3b.zip |
More security: don't delete stuff too easily
Diffstat (limited to 'src/model')
-rw-r--r-- | src/model/block.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/model/block.rs b/src/model/block.rs index 987ec9e4..a3bbe43d 100644 --- a/src/model/block.rs +++ b/src/model/block.rs @@ -305,6 +305,9 @@ impl BlockManager { let ring = self.system.ring.borrow().clone(); let mut who = self.replication.replication_nodes(&hash, &ring); + if who.len() < self.replication.write_quorum(&self.system) { + return Err(Error::Message(format!("Not trying to offload block because we don't have a quorum of nodes to write to"))); + } who.retain(|id| *id != self.system.id); let msg = Arc::new(Message::NeedBlockQuery(*hash)); |