dCache / dcache

dCache - a system for storing and retrieving huge amounts of data, distributed among a large number of heterogenous server nodes, under a single virtual filesystem tree with a variety of standard access methods
https://dcache.org
291 stars 136 forks source link

pool: fix double decrement of hsm requests #7674

Closed kofemann closed 1 month ago

kofemann commented 1 month ago

Motivation: If hsm requests completed twice due to a bug or a race condition, then AbstractRequest#removeFromQueue can be called twice. As removeFromQueue uses state#get then two competing requests might get the same value and introduce double decrement.

Modification: Add new state 'REMOVED' that with get-and-set semantic avoids double decrement situation.

Result: Fix double decrement on active hsm requests

Fixes: #7511 Acked-by: Dmitry Litvintsev Target: master, 10.1, 10.0, 9.2 Require-book: no Require-notes: yes (cherry picked from commit daad2ab76fad534a63cc1c4be1033636a9ec3c96)