Return-Path: linux-nfs-owner@vger.kernel.org Received: from mx2.netapp.com ([216.240.18.37]:28423 "EHLO mx2.netapp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752313Ab2ECR1u (ORCPT ); Thu, 3 May 2012 13:27:50 -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: Thu, 3 May 2012 17:26:52 +0000 Message-ID: <1336066014.5385.41.camel@lade.trondhjem.org> References: <4FA2A56B.1030208@redhat.com> <1336059797.5385.22.camel@lade.trondhjem.org> <4FA2BB68.7070304@redhat.com> In-Reply-To: <4FA2BB68.7070304@redhat.com> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Sender: linux-nfs-owner@vger.kernel.org List-ID: T24gVGh1LCAyMDEyLTA1LTAzIGF0IDE5OjA3ICswMjAwLCBOaWVscyBkZSBWb3Mgd3JvdGU6DQo+ IE9uIDA1LzAzLzIwMTIgMDU6NDMgUE0sIE15a2xlYnVzdCwgVHJvbmQgd3JvdGU6DQo+ICA+IE9u IFRodSwgMjAxMi0wNS0wMyBhdCAxNzozNCArMDIwMCwgTmllbHMgZGUgVm9zIHdyb3RlOg0KPiAg Pj4gV2hlbiBhbiBhcHBsaWNhdGlvbiBvbiBhbiBORlMtY2xpZW50ICh0ZXN0ZWQgd2l0aCBORlN2 MykgZXhlY3V0ZXMgdGhlDQo+ICA+PiBmb2xsb3dpbmcgc3RlcHMsIGRhdGEgd3JpdHRlbiBhZnRl ciB0aGUgY2xvc2UoKSBpcyBuZXZlciBmbHVzaGVkIHRvIHRoZQ0KPiAgPj4gc2VydmVyOg0KPiAg Pj4NCj4gID4+IDEuIG9wZW4oKQ0KPiAgPj4gMi4gbW1hcCgpDQo+ICA+PiAzLiBjbG9zZSgpDQo+ ICA+PiA0Ljxtb2RpZnkgZ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