From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936096AbXFGBrY (ORCPT ); Wed, 6 Jun 2007 21:47:24 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1758710AbXFGBrR (ORCPT ); Wed, 6 Jun 2007 21:47:17 -0400 Received: from cantor2.suse.de ([195.135.220.15]:53156 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758455AbXFGBrQ (ORCPT ); Wed, 6 Jun 2007 21:47:16 -0400 From: NeilBrown To: Andrew Morton Date: Thu, 7 Jun 2007 11:46:47 +1000 X-face: [Gw_3E*Gng}4rRrKRYotwlE?.2|**#s9D Cc: Neil Brown Cc: Nick Piggin Subject: [PATCH 000 of 2] Fix some bugs with 'read' racing with 'truncate' Message-ID: <20070607114043.26967.patches@notabene> Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org The following two patches fix a couple of bugs which trigger when read races with truncate. As there is no locking between read and truncate, we need to be careful about sequencing. In some cases were aren't careful enough. The first patch ensures that we check i_size *after* gaining a reference to an uptodate page, thus ensuring that we don't unknowingly returns NUL characters that are beyond the end of the file. The second ensures that we don't deliver partial reads to more than one sub-buffer in a readv call. These bugs have been around for a while and are quite subtle, so I don't think there is any rush for them to go into 2.6.22. Rather they should sit in -mm at least until .23 opens up. Thanks, NeilBrown [PATCH 001 of 2] Fix read/truncate race. [PATCH 002 of 2] Make sure readv stops reading when it hits end-of-file.