From mboxrd@z Thu Jan 1 00:00:00 1970 From: Chris Mason Subject: [RFC PATCH 0 of 8] O_DIRECT locking rework Date: Tue, 06 Feb 2007 20:32:45 -0400 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: akpm@linux-foundation.org To: linux-fsdevel@vger.kernel.org Return-path: Received: from rgminet01.oracle.com ([148.87.113.118]:11157 "EHLO rgminet01.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030487AbXBGP0o (ORCPT ); Wed, 7 Feb 2007 10:26:44 -0500 Sender: linux-fsdevel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org Hello everyone, Here's a respin of the O_DIRECT locking changes. There are some minor updates, mostly cleanups based on suggestions from Zach Brown and Dave Chinner. Linus found a deadlock between the placeholders and the page fault handler when userland uses an mmap of the file as the O_DIRECT buffer. I'm getting around that by capping placeholder extents at DIO_PAGES (64) intervals when the file has mappings. This matches the interval used by get_user_pages and makes sure get_user_pages has been called on a given range in the address space before placeholders are added. I also hit a stale data exposure when get_block returns data past the end of the placeholder extent. A concurrent readpage could come in and find metadata before the data had gotten to disk. The fix is to only ask get_block for data up to the end of the placeholder. Generally, this isn't a problem because the common case is for a single placeholder to cover the entire DIO. So the suboptimal allocation result wouldn't happen very often. -chris