Ok, so having gone over these, I think 1, 2 and 4 are fine. Let's just drop 3. The upgrade clearly does need to drop the old lock when returning FILE_LOCK_DEFERRED, because otherwise two upgraders will deadlock waiting for each other. Oh, and in #1, you might want to remove the "FIXME: add counters to struct file_lock_context so we don't need to do this?" although that obviously makes it not strictly a 100% revert. I do believe that we should add a "list_count()" function, so that we could write *flock_count = list_count(&ctx->flc_flock); instead of that horribly ugly list_for_each_entry(lock, &ctx->flc_flock, fl_list) ++(*flock_count); thing. But that's a separate cleanup. Can we get that truncated series tested with some flock test suite? I assume there is *some* filesystem tester that tests some basic flock stuff, even if it clearly didn't catch the race due to the unlock in the middle.. Linus -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html