The deeper you go…the more you find!

Hey everyone!

I’m sorry for being away for a while. But now that school is almost done, I can write more blog posts 🙂

So I have been working on my release for the Open Source class this past week. I decided to revisit an old bug that I had discovered and began fixing in Filer but never got around to completing it after running into a roadblock.

The bug I was working on dealt with not being able to rename a directory. I found this while trying to use this feature in MakeDrive. At first, I thought that this bug would be fairly simple to solve since all it effectively did was a delete/create procedure. Turns out it was not as simple as that. I changed the way the create/delete occurred to account for the difference between a file and a directory. But that created one of the most bizarre problems I have seen. Somehow, the node that was created magically disappeared in between steps and so when I tried to access that node, it would fail badly. I dug around a bit at that time but had not luck figuring out what was wrong.

Problem was, I associated the “missing” problem with the “deletion” part of the rename. This did not seem like a big logical leap for me and I went with it. But when I re-visited this problem a week ago, after looking into how the node was being deleted, I realized that it would probably make sense to check out how the creation happened. I dug around a lot and an obvious problem presented to me a few days in.

The creation was happening by creating a “hard” link (basically a copy of the metadata) to the old node. This had one major implication that I did not account for. The IDs of the link and the old node would be the same. So, when we attempt to delete the old node, as deletion happens by ID, it deletes both nodes. This is why the new node vanished. I had finally figured it out.

But that was not all! While going through how hard links were generated, I noticed during my research online that directories were not really encouraged to have hard links. Well, our code did not deal with that and hence came bug #2.

Since I took the effort to dig deep into the code, in true keener fashion I decided to continue the rename patch as close to the IEEE specs as possible (which basically means a lot of extra functions). At the same time I fixed the link on directories problem.

It took me a while (and I had to go over the deadline a bit) but I ended up with more than I had set out to fix.

P.S. Stay tuned for a blog post soon on how I learnt Redis! / December 6, 2014 / Open Source / 0 Comments