archiecobbs / s3backer

FUSE/NBD single file backing store via Amazon S3
Other
529 stars 75 forks source link

An improper locking bug(e.g., deadlock) on the priv->mutex #152

Closed ycaibb closed 3 years ago

ycaibb commented 3 years ago

Hi, developers, thank you for your checking. It seems the lock priv->mutex is not released correctly when priv->num_threads == 0 in the function block_cache_read? https://github.com/archiecobbs/s3backer/blob/016c3fe69760b6a0b03193e218b19488fa0862e8/block_cache.c#L617-L624

ycaibb commented 3 years ago

Similarly, the lock &priv->mutex is also not released in the block_cache_do_read, thank you very much for your checking. https://github.com/archiecobbs/s3backer/blob/016c3fe69760b6a0b03193e218b19488fa0862e8/block_cache.c#L753-L771

archiecobbs commented 3 years ago

Your first comment is correct - thanks! Fixed in bee054a.

Your second comment is incorrect: the semantics of this function block_cache_do_read() are that the mutex is assumed to be (already) held at function entry and exit.

ycaibb commented 3 years ago

@archiecobbs Thank you very much.