From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Piggin Subject: [rfc] changing commit_write to commit less than was prepared Date: Sun, 15 Oct 2006 16:45:28 +0200 Message-ID: <20061015144528.GD25243@wotan.suse.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from mx2.suse.de ([195.135.220.15]:16295 "EHLO mx2.suse.de") by vger.kernel.org with ESMTP id S1750835AbWJOOp3 (ORCPT ); Sun, 15 Oct 2006 10:45:29 -0400 Received: from Relay1.suse.de (mail2.suse.de [195.135.221.8]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id 897AA1FCCD for ; Sun, 15 Oct 2006 16:45:28 +0200 (CEST) To: linux-fsdevel@vger.kernel.org Content-Disposition: inline Sender: linux-fsdevel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org 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 20061013143516.15438.8802.sendpatchset@linux.site and please cc me. Thanks, Nick