>> Recently I've spent some time investigating how lock and unlock are >> implemented in FSFS and can suggest the following simplification. I >> attempted just to make this part clearer and a new code is intended to >> behave exactly the same. > > It's not exactly the same, index files are written/deleted in a > different order. I think that change is OK but can you confirm that > this is expected?
Yes, the behaviour is *not* exactly the same -- the index files is updated in different order. Furthermore, I've realized that current version of algorithm will set some locks even if update of some index files is failed. Let's say we need to lock the following paths: /abc /foo/bar Even if updating of index file for '/foo' will fail, the lock for '/abc' will be set. I don't know if it really matters since this depends on 'implementation details' like sorting order etc. If we really need to follow this 'set as much locks as much as possible' strategy then my patch is not correct. BTW, current version is not following this strategy strictly.