There are quite a few lock order reversals in the file server, and my patch does not attempt to address them. I haven't completely figured out how locking is supposed to work. If deadlock prevention depends entirely on lock order, we're in big trouble. I'll post what I have tomorrow but I don't think it will fix this deadlock.