crimson/osd: make sure the read lock is acquired when trying to get recovery read

Signed-off-by: Xuehan Xu <xxhdx1985126@gmail.com>
This commit is contained in:
Xuehan Xu 2020-12-19 18:21:21 +08:00
parent 98d8d25b39
commit 0b8ac4ccc3
2 changed files with 10 additions and 0 deletions

View File

@ -93,6 +93,9 @@ public:
void unlock_for_read();
void promote_from_read();
void demote_to_read();
unsigned get_readers() const {
return readers;
}
// for shared writers
seastar::future<> lock_for_write(bool greedy);
@ -100,11 +103,17 @@ public:
void unlock_for_write();
void promote_from_write();
void demote_to_write();
unsigned get_writers() const {
return writers;
}
// for exclusive users
seastar::future<> lock_for_excl();
bool try_lock_for_excl() noexcept;
void unlock_for_excl();
bool is_excl_acquired() const {
return exclusively_used;
}
bool is_acquired() const;

View File

@ -155,6 +155,7 @@ public:
}
}
void wait_recovery_read() {
assert(lock.get_readers() > 0);
recovery_read_marker = true;
}
void drop_recovery_read() {