I have the following problem when trying to implement a command similar to the move command in Linux, for another file system that has to be multithreaded.
When I'm trying to do : '''mv /a /b/a''' the program is locking the root directory for writing and a for writing. Then, since I can't release the locks cuz other thread might acquire them, I get into a deadlock situation when I try to lock the root for reading in the destination of the move command.
I'm trying to get my head around a possible solution for this. With the way my code is right now, when given a path /x/y/z , it locks every directory, for reading or for writing, depending on the command that I want to execute. So, using that, I'm able to identify if I can write /a into /b/a, because it checks if /a exists and if /b/a does not exist, but I still need to get around the deadlock situation.