Here is an updated version of my original patch to fix OFD locking. The difference between this and the my original version is that I added extra parenthesis to make it easier to read as per Jeff's suggestion and I added a check if the files were the same from Pavel's review. This is based on my original submission and not Paulo's patch. I think Paulo's patch is primising since it will also refactor the code to be easier to understand, but that is for a later patch. This patch is smaller in the changes it does to the difficult parts and I think less risky for changing behavior. Something like Paulos patch is probably worthwile to refactor and simplify the code at a later stage. I tested this on-top of the current sfrench/for-next using xfstest. No new regressions as far as I can tell.