summaryrefslogtreecommitdiff
path: root/libpager/priv.h
diff options
context:
space:
mode:
authorJustus Winter <4winter@informatik.uni-hamburg.de>2013-12-05 19:40:31 +0100
committerJustus Winter <4winter@informatik.uni-hamburg.de>2013-12-09 15:07:59 +0100
commitb770147356376ddb0602358a0252c4f68a9c80c6 (patch)
tree077e69afbe115eaa67ca73cdbb83fbc306093906 /libpager/priv.h
parent54ee5b628f8d4a1447670f65cc441fc32a9e96ef (diff)
trans: fix reference counting and destruction of fake nodes
Previously, fakeroot tried to do too much in netfs_node_norefs. This function is meant to deallocate nodes. Fakeroot however also tries to remove the node from the hash table and to prolong the lifetime of the node object by re-referencing it. Removing the object from the hash table is highly problematic, because at this point we already have the node locked. With proper locking in netfs_S_dir_lookup, acquiring the hash table lock while we hold the node locked results in dead-locks, releasing the node lock before acquiring the hash table lock results in a race condition. Prolonging the lifetime of the node by re-acquiring a reference is clearly a hack that surprisingly works to some degree. The nodes transbox, however, is already gone at this point. This code was never actually run because of a reference-counting bug in fakeroot. Fix this by installing our own clean routine in the netfs_protid_class. This function is called without the associated node being locked, allowing us to acquire the locks in the proper order and to keep the hash table locked while the node is being destroyed. * trans/fakeroot.c (netfs_node_norefs): Just free the associated resources. (fakeroot_netfs_release_protid): New function doing cleanly what netfs_node_norefs did before. (netfs_S_dir_lookup): Reuse the fake reference. (main): Install fakeroot_netfs_release_protid as clean routine. fixup_fix_refc_destruction
Diffstat (limited to 'libpager/priv.h')
0 files changed, 0 insertions, 0 deletions