Commit 444d3f0b authored by Mike Snitzer's avatar Mike Snitzer

dm vdo indexer-volume: fix missing mutex_lock in process_entry

Must mutex_lock after dm_bufio_read, before dm_bufio_read error
handling, otherwise process_entry error path will return without
volume->read_threads_mutex held. This fixes potential double
mutex_unlock.
Reported-by: default avatarDan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: default avatarMike Snitzer <snitzer@kernel.org>
Signed-off-by: default avatarSusan LeGendre-McGhee <slegendr@redhat.com>
Signed-off-by: default avatarMatthew Sakai <msakai@redhat.com>
parent b259c1a6
......@@ -556,6 +556,7 @@ static int process_entry(struct volume *volume, struct queued_read *entry)
mutex_unlock(&volume->read_threads_mutex);
page_data = dm_bufio_read(volume->client, page_number, &page->buffer);
mutex_lock(&volume->read_threads_mutex);
if (IS_ERR(page_data)) {
result = -PTR_ERR(page_data);
uds_log_warning_strerror(result,
......@@ -564,7 +565,6 @@ static int process_entry(struct volume *volume, struct queued_read *entry)
cancel_page_in_cache(&volume->page_cache, page_number, page);
return result;
}
mutex_lock(&volume->read_threads_mutex);
if (entry->invalid) {
uds_log_warning("Page %u invalidated after read", page_number);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment