Zach BrownandZach Brown 1398b2316d scoutfs: clean up racey inode index updates
The updating of the inode index items was racey.  It loaded the inode
values, updated the items, loaded the fields again, and then stored the
fields in the inode info.  All without locking.  Concurrent attempts
could get the fields scrambled and racing with other paths that update
the fields could get the items and inode info out of sync.

This fixes up the two races by only reading the inode fields once and
performing the multi-stage update under a mutex.  We add a new lock to
avoid ordering problems with trying to add an existing lock at these
points in the locking heirarchy.  We specifically use a mutex because
the item functions can block.

Now the inode index field update just has to safely race with concurrent
access to the fields.

This was found by generic/037 once getattr started refreshing the inode.
It now passes again.

Signed-off-by: Zach Brown <zab@versity.com>
2017-08-11 10:07:42 -07:00
S
Description
No description provided
7.5 MiB
Languages
C 86.4%
Shell 9.9%
Roff 2.5%
TeX 0.8%
Makefile 0.4%