From patchwork Thu Jun 16 09:57:36 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Pekka Enberg X-Patchwork-Id: 886662 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p5GA2oZN005066 for ; Thu, 16 Jun 2011 10:02:51 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757561Ab1FPKCr (ORCPT ); Thu, 16 Jun 2011 06:02:47 -0400 Received: from mail-vw0-f46.google.com ([209.85.212.46]:47463 "EHLO mail-vw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756991Ab1FPKCp convert rfc822-to-8bit (ORCPT ); Thu, 16 Jun 2011 06:02:45 -0400 Received: by vws1 with SMTP id 1so1025209vws.19 for ; Thu, 16 Jun 2011 03:02:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=a4yxj4T5C9YRv8fs3rktMVDw6/+D5JXxmKVEVvTW7bU=; b=eUSDGxVvPOKFI4L+tNQJHMjcPF/XgXgJ4xk/dFLluU5lMdMci/KT0B+7qeVathlNdO CqKuKFUE42BmKK7mF5kDb2HU6EmUQo+MCa5OQQhYSqZTiToUojRAquhQY185/0sgIlZN fbw945vR31EDsvMIGQTeb+JHCzWVSQ4j/KLaU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=JA9yMjQnxvVpVITdCGTxqVmM73hu1PJApH9cLaLNjJTmxNdMWr1wTx65+gmSTqchBq hga4eQX2llk30kBSEUiz09D/aPTXPFPGrw1DTEQz32HzwAWVRzKI5yQhhOhuwCH008EZ Uf3XgZbsRpbGmKqOTUj1C1rJ3wobP7fhWM2UY= MIME-Version: 1.0 Received: by 10.52.75.4 with SMTP id y4mr939063vdv.167.1308218256590; Thu, 16 Jun 2011 02:57:36 -0700 (PDT) Received: by 10.52.110.105 with HTTP; Thu, 16 Jun 2011 02:57:36 -0700 (PDT) In-Reply-To: <20110616094810.GA19965@infradead.org> References: <4DF92C80.3030106@codemonkey.ws> <7A30A509-47AA-4E72-ABF3-937005900F9D@suse.de> <4DF93010.1040006@codemonkey.ws> <4DF935C1.4020000@codemonkey.ws> <20110616092429.GA5484@infradead.org> <20110616094810.GA19965@infradead.org> Date: Thu, 16 Jun 2011 12:57:36 +0300 X-Google-Sender-Auth: E9MD6JeMEpR9nmyXqXk3Y7qvElw Message-ID: Subject: Re: [ANNOUNCE] Native Linux KVM tool v2 From: Pekka Enberg To: Christoph Hellwig Cc: Anthony Liguori , Alexander Graf , Prasad Joshi , Avi Kivity , linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Andrew Morton , Linus Torvalds , Ingo Molnar , Sasha Levin , Cyrill Gorcunov , Asias He , Jens Axboe Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Thu, 16 Jun 2011 10:02:51 +0000 (UTC) On Thu, Jun 16, 2011 at 12:48 PM, Christoph Hellwig wrote: > You also missed: > > " This system call does not flush disk write caches and thus does not >  provide any data integrity on systems with volatile disk write >  caches." > > so it's not safe if you either have a cache, or are using btrfs, or > are using a sparse image, or are using an image preallocated using > fallocate/posix_fallocate. Uh-oh. Someone needs to apply this patch to sync_file_range(): goto out; >> What's the right thing to do here? Is fdatasync() sufficient? > > Yes. We'll fix that up. Thanks Christoph! Pekka --- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/fs/sync.c b/fs/sync.c index ba76b96..32078aa 100644 --- a/fs/sync.c +++ b/fs/sync.c @@ -277,6 +277,8 @@ SYSCALL_DEFINE(sync_file_range)(int fd, loff_t offset, loff_t nbytes, int fput_needed; umode_t i_mode; + WARN_ONCE(1, "when this breaks, you get to keep both pieces"); + ret = -EINVAL; if (flags & ~VALID_FLAGS)