mirror of
https://github.com/versity/scoutfs.git
synced 2026-02-07 19:20:44 +00:00
If scoutfs_unlock() sees that it isn't the last task using a lock it just returns. It doesn't unlock the lock and it doesn't drop the lock refcnt and users. This leaks the lock refcnt and users because find_alloc_scoutfs_lock() always increments them when it finds a lock. Inflated counts will stop the shrinker from freeing the locks and eventually the counts will wrap and could cause locks to be freed while they're still in use. We can either always drop the refcnt/users in unlock or we can drop them in lock as we notice that our task already has the lock. I chose to have the task ref hold one refcnt/users which are only dropped as the final task unlocks. Signed-off-by: Zach Brown <zab@versity.com>