From patchwork Mon Jan 16 08:47:43 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zheng Liu X-Patchwork-Id: 136258 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 0BE79B6F13 for ; Mon, 16 Jan 2012 19:44:09 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753566Ab2APIoH (ORCPT ); Mon, 16 Jan 2012 03:44:07 -0500 Received: from mail-iy0-f174.google.com ([209.85.210.174]:47643 "EHLO mail-iy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753522Ab2APIoF (ORCPT ); Mon, 16 Jan 2012 03:44:05 -0500 Received: by iagf6 with SMTP id f6so2240032iag.19 for ; Mon, 16 Jan 2012 00:44:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; bh=n/PKAnOXAANFlDcX4340aeO65vyRuYawc0SkJGF6QZI=; b=xsFpT534Y1a91U3MiYs9/qqhKcfhmXRuUcgWTlGi85QyjXYrcY5InmRx4b5jEDBOpE GEWcp7V9InXUzfuzGnm35lGn0v3/rKZ8dhgGMyhA6RCR6E0YFvqbc5Fjo0AGS1n3+2hd DGhx8rw+2iOGx+Zg2SjDHDVbs0GQRR6OgnazI= Received: by 10.50.168.100 with SMTP id zv4mr12060705igb.17.1326703445348; Mon, 16 Jan 2012 00:44:05 -0800 (PST) Received: from localhost.localdomain ([182.92.247.2]) by mx.google.com with ESMTPS id r18sm63289953ibh.4.2012.01.16.00.44.02 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 16 Jan 2012 00:44:04 -0800 (PST) From: Zheng Liu To: linux-ext4@vger.kernel.org Cc: Zheng Liu , "Theodore Ts'o" Subject: [PATCH RESEND] ext4: make sure O_(D)SYNC semantic in ext4_fallocate() Date: Mon, 16 Jan 2012 16:47:43 +0800 Message-Id: <1326703663-4801-1-git-send-email-wenqing.lz@taobao.com> X-Mailer: git-send-email 1.7.4.1 Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org Ext4 must make sure the transaction to be commited to the disk when user opens a file with O_(D)SYNC flag and do a fallocate(2) call. This problem had been reported by Christoph Hellwig in this thread: http://www.spinics.net/lists/linux-btrfs/msg13621.html CC: "Theodore Ts'o" Reported-by: Christoph Hellwig Signed-off-by: Zheng Liu --- fs/ext4/extents.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c index 74f23c2..00e32d9 100644 --- a/fs/ext4/extents.c +++ b/fs/ext4/extents.c @@ -4356,6 +4356,8 @@ retry: ret = PTR_ERR(handle); break; } + if (file->f_flags & O_SYNC) + ext4_handle_sync(handle); ret = ext4_map_blocks(handle, inode, &map, flags); if (ret <= 0) { #ifdef EXT4FS_DEBUG