From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Piggin Subject: [patch 5/9] mm: debug write deadlocks Date: Mon, 29 Jan 2007 11:32:24 +0100 (CET) Message-ID: <20070129081951.23584.52646.sendpatchset@linux.site> References: <20070129081905.23584.97878.sendpatchset@linux.site> Cc: Linux Kernel , Linux Filesystems , Nick Piggin , Linux Memory Management To: Andrew Morton Return-path: Received: from cantor.suse.de ([195.135.220.2]:49434 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932417AbXA2Kcf (ORCPT ); Mon, 29 Jan 2007 05:32:35 -0500 In-Reply-To: <20070129081905.23584.97878.sendpatchset@linux.site> Sender: linux-fsdevel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org Allow CONFIG_DEBUG_VM to switch off the prefaulting logic, to simulate the difficult race where the page may be unmapped before calling copy_from_user. Makes the race much easier to hit. This is useful for demonstration and testing purposes, but is removed in a subsequent patch. Signed-off-by: Nick Piggin Index: linux-2.6/mm/filemap.c =================================================================== --- linux-2.6.orig/mm/filemap.c +++ linux-2.6/mm/filemap.c @@ -1894,6 +1894,7 @@ generic_file_buffered_write(struct kiocb if (maxlen > bytes) maxlen = bytes; +#ifndef CONFIG_DEBUG_VM /* * Bring in the user page that we will copy from _first_. * Otherwise there's a nasty deadlock on copying from the @@ -1901,6 +1902,7 @@ generic_file_buffered_write(struct kiocb * up-to-date. */ fault_in_pages_readable(buf, maxlen); +#endif page = __grab_cache_page(mapping,index,&cached_page,&lru_pvec); if (!page) {