Linux Kernel FCFS fcntl/flock Locks

Download the Patch

I wrote this patch (it's actually very short) with a lot of help from Matthew Wilcox, who is the current maintainer of the filesystem locks logic in the Linux Kernel. It is made against linux-2.5.30 but should work with more recent or later versions.

Without this patch, the Linux kernel discriminates against writers, and accepts readers into a lock in readers state even if there are pending writers. The following test program can demonstrate the two behaviours (try running it as test_flock 20 2).

AddThis Social Bookmark Button