changing commit_write to commit less than was prepared
Hi,
In recently trying to solve the several (longstanding) deadlocks in write(2), I developed what I believe to be the best solution. This requires that ->commit_write may be called with a length less than that which was passed to the prepare_write. If the length is different, it may be 0, and for !uptodate pages it will only be 0. There is no guarantee that the commit_write will ever be called later to fill the gap.
I have gone through fs/libfs.c and fs/buffer.c, and not found any problems (apart from pre-existing bugs). I will attempt to work my way through other filesystems, but I could easily miss problems.
This problem is now holding up other mm/ race fixes, so it is a question of when, not if. So filesystem maintainers, please check your code and fix it if broken, or come up with a better solution ;)
Apologies for not cc'ing linux-fsdevel in the first place. Please join the thread on lkml and linux-mm: "[rfc] buffered write deadlock fix" message id [email protected]
and please cc me.
Thanks,
Nick