From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934214AbYBHEST (ORCPT ); Thu, 7 Feb 2008 23:18:19 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1760050AbYBHESJ (ORCPT ); Thu, 7 Feb 2008 23:18:09 -0500 Received: from mx2.netapp.com ([216.240.18.37]:31828 "EHLO mx2.netapp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759928AbYBHESH (ORCPT ); Thu, 7 Feb 2008 23:18:07 -0500 X-IronPort-AV: E=Sophos;i="4.25,319,1199692800"; d="scan'208";a="149970665" Subject: Re: [GIT] Please pull 2 NFS client fixes From: Trond Myklebust To: Andrew Morton Cc: Linus Torvalds , linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org, nfsv4@linux-nfs.org In-Reply-To: <20080207184818.e40d5277.akpm@linux-foundation.org> References: <1202432841.18376.50.camel@heimdal.trondhjem.org> <20080207184818.e40d5277.akpm@linux-foundation.org> Content-Type: text/plain Content-Transfer-Encoding: 7bit Organization: Network Appliance Inc Date: Thu, 07 Feb 2008 23:18:03 -0500 Message-Id: <1202444283.18376.63.camel@heimdal.trondhjem.org> Mime-Version: 1.0 X-Mailer: Evolution 2.12.1 X-OriginalArrivalTime: 08 Feb 2008 04:18:04.0573 (UTC) FILETIME=[99AF94D0:01C86A09] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2008-02-07 at 18:48 -0800, Andrew Morton wrote: > On Thu, 07 Feb 2008 20:07:21 -0500 Trond Myklebust wrote: > > > commit 5d47a35600270e7115061cb1320ee60ae9bcb6b8 > > Author: Trond Myklebust > > Date: Thu Feb 7 17:24:07 2008 -0500 > > > > NFS: Fix a potential file corruption issue when writing > > > > If the inode is flagged as having an invalid mapping, then we can't rely on > > the PageUptodate() flag. Ensure that we don't use the "anti-fragmentation" > > write optimisation in nfs_updatepage(), since that will cause NFS to write > > out areas of the page that are no longer guaranteed to be up to date. > > > > A potential corruption could occur in the following scenario: > > > > client 1 client 2 > > =============== =============== > > fd=open("f",O_CREAT|O_WRONLY,0644); > > write(fd,"fubar\n",6); // cache last page > > close(fd); > > fd=open("f",O_WRONLY|O_APPEND); > > write(fd,"foo\n",4); > > close(fd); > > > > fd=open("f",O_WRONLY|O_APPEND); > > write(fd,"bar\n",4); > > close(fd); > > ----- > > The bug may lead to the file "f" reading 'fubar\n\0\0\0\nbar\n' because > > client 2 does not update the cached page after re-opening the file for > > write. Instead it keeps it marked as PageUptodate() until someone calls > > invaldate_inode_pages2() (typically by calling read()). > > Is this one worth feeding back into 2.6.24.x? (for various values of "4"?) Definitely, and probably back into 2.6.23.x, 2.6.22.x,... too. Cheers Trond