From mboxrd@z Thu Jan 1 00:00:00 1970 From: Anthony Liguori Subject: Re: [PATCH, RFC] virtio_blk: add cache flush command Date: Mon, 11 May 2009 11:38:09 -0500 Message-ID: <4A085471.40809@codemonkey.ws> References: <20090511083908.GB20082@lst.de> <4A083B7C.1000703@codemonkey.ws> <20090511154046.GA4226@lst.de> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Rusty Russell , kvm@vger.kernel.org To: Christoph Hellwig Return-path: Received: from mail-qy0-f129.google.com ([209.85.221.129]:50454 "EHLO mail-qy0-f129.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753667AbZEKQiU (ORCPT ); Mon, 11 May 2009 12:38:20 -0400 Received: by qyk35 with SMTP id 35so2567049qyk.33 for ; Mon, 11 May 2009 09:38:20 -0700 (PDT) In-Reply-To: <20090511154046.GA4226@lst.de> Sender: kvm-owner@vger.kernel.org List-ID: Christoph Hellwig wrote: > On Mon, May 11, 2009 at 09:51:40AM -0500, Anthony Liguori wrote: > >> What typically triggers a flush operation? >> > > fsync. > > >> I would assume an fsync would, but would a flush happen after every >> O_DIRECT write? >> > > Right now it doesn't, but it probably should. > So then with cache=writeback, fsync behaves itself but O_DIRECT writes do not. This seems like a really undesirable combination of behavior from a guest integrity point of view. It makes me wonder if it's really useful. I think that any serious user would have to continue using cache=writethrough. Is there a path that would ever allow someone who cares about their data to use cache=writeback instead of cache=writethrough? >> If the backend implementation of T_FLUSH is fsync, I would think that >> this would result in rather poor performance for O_DIRECT operations in >> the guest. >> > > Right now it's fsync. By the time I'll submit the backend change it > will still be fsync, but at least called from the posix-aio-compat > thread pool. > fsync is pretty crappy on ext3 default configs. I'm concerned that this could be considered a DoS by a malicious guest. If it sat in a T_FLUSH loop, it would potentially bring your system to a crawl, no? Regards, Anthony Liguori