Return-Path: Received: from mail-he1eur01on0118.outbound.protection.outlook.com ([104.47.0.118]:54467 "EHLO EUR01-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750790AbdIUSqJ (ORCPT ); Thu, 21 Sep 2017 14:46:09 -0400 Subject: Re: [fuse-devel] [fuse] getattr() results ignored when writeback cache is active To: Nikolaus Rath References: <87zi9pk2ra.fsf@vostro.rath.org> <87vakdjsjj.fsf@vostro.rath.org> <87y3p8uzpw.fsf@vostro.rath.org> <11acc9f1-12e5-9806-48ff-de261acae979@virtuozzo.com> <87wp4s9bva.fsf@vostro.rath.org> <97fa18f6-84ab-7723-42a8-84e2bc2d92ed@virtuozzo.com> <87o9q3aop8.fsf@vostro.rath.org> Cc: mszeredi@redhat.com, "fuse-devel@lists.sourceforge.net" , linux-fsdevel From: Maxim Patlasov Message-ID: Date: Thu, 21 Sep 2017 11:45:46 -0700 MIME-Version: 1.0 In-Reply-To: <87o9q3aop8.fsf@vostro.rath.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On 09/21/2017 11:31 AM, Nikolaus Rath wrote: > On Sep 21 2017, Maxim Patlasov wrote: >> On 09/21/2017 10:53 AM, Nikolaus Rath wrote: >> >>> On Sep 21 2017, Maxim Patlasov wrote: >>>> On 09/21/2017 03:12 AM, Nikolaus Rath wrote: >>>> >>>>> On Sep 20 2017, Miklos Szeredi wrote: >>>>>> In writeback-cache mode (enabled by the FUSE_WRITEBACK_CACHE flaga) writes go to >>>>>> the cache only, which means that the write(2) syscall can often complete very >>>>>> fast. The dirty pages are later sent to userspace using write requests. This >>>>>> mode assumes that the file is never changed outside the mounted filesystem, so >>>>>> it's not suitable for any network fs. >>>>> .."this mode of operation is not suitable for any network filesystem >>>>> even if no write operations are actually carried out". >>>> Not true. A network filesystem can guarantee that the file is never >>>> changed outside by implementing exclusive write lease semantics: when >>>> someone opens file for writing first time the metadata server grants >>>> exclusive rights for that mount, then declines all subsequent open >>>> requests from other mounts; and similarly while a file is being kept >>>> opened for reading, the metadata server declines all open-for-writing >>>> requests from other mounts. >>> In practice that doesn't seem to work, see the example in my first >>> message. The file is only ever accessed on one mount at a time, yet the >>> changes do not propagate (and would result in data corruption if another >>> mount would attempt to read or modify the file afterwards). >> In your example you modified file bypassing fuse mount: >> >>> echo -e "\nrevision 2" >> /tmp/issue_93/file_1 >> That's like mangling block device while ordinary local fs is running >> on top of it. > Huh? That's exactly what a network filesystem would see when another > host writes to the filesystem. The change doesn't come through the local > FUSE layer. In your example the change didn't come through any FUSE layer. When another host writes to a network filesystem, the filesystem has a choice to process the request intelligently. In your example, you didn't give FUSE a chance because "/tmp/issue_93" was not fuse mount. > > > Best, > -Nikolaus