Return-Path: linux-nfs-owner@vger.kernel.org Received: from mx2.netapp.com ([216.240.18.37]:58509 "EHLO mx2.netapp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759328Ab2EDS3h (ORCPT ); Fri, 4 May 2012 14:29:37 -0400 From: "Myklebust, Trond" To: Niels de Vos CC: "linux-nfs@vger.kernel.org" , "linux-fsdevel@vger.kernel.org" , "David Howells" , Jeffrey Layton Subject: Re: [RFC] Dataloss on NFS-clients who modify an mmap()'d area after closing the file-descriptor Date: Fri, 4 May 2012 18:29:34 +0000 Message-ID: <1336156178.2582.15.camel@lade.trondhjem.org> References: <4FA2A56B.1030208@redhat.com> <1336059797.5385.22.camel@lade.trondhjem.org> <4FA2BB68.7070304@redhat.com> <1336066014.5385.41.camel@lade.trondhjem.org> <4FA3FDDB.6070600@redhat.com> In-Reply-To: <4FA3FDDB.6070600@redhat.com> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Sender: linux-nfs-owner@vger.kernel.org List-ID: T24gRnJpLCAyMDEyLTA1LTA0IGF0IDE4OjAzICswMjAwLCBOaWVscyBkZSBWb3Mgd3JvdGU6DQo+ IE9uIDA1LzAzLzIwMTIgMDc6MjYgUE0sIE15a2xlYnVzdCwgVHJvbmQgd3JvdGU6DQo+ICA+IE9u IFRodSwgMjAxMi0wNS0wMyBhdCAxOTowNyArMDIwMCwgTmllbHMgZGUgVm9zIHdyb3RlOg0KPiAg Pj4gT24gMDUvMDMvMjAxMiAwNTo0MyBQTSwgTXlrbGVidXN0LCBUcm9uZCB3cm90ZToNCj4gID4+ ICAgPiAgT24gVGh1LCAyMDEyLTA1LTAzIGF0IDE3OjM0ICswMjAwLCBOaWVscyBkZSBWb3Mgd3Jv dGU6DQo+ICA+PiAgID4+ICBXaGVuIGFuIGFwcGxpY2F0aW9uIG9uIGFuIE5GUy1jbGllbnQgKHRl c3RlZCB3aXRoIE5GU3YzKSBleGVjdXRlcyB0aGUNCj4gID4+ICAgPj4gIGZvbG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