Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3528985yba; Mon, 8 Apr 2019 22:28:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqyE5MVnYNJakV+AXUP2yk9wfWSwCg1omPEAtST7gvpvy3Yn8jcyT886V6o7bMAmlvkr0Pj5 X-Received: by 2002:a65:4083:: with SMTP id t3mr6474957pgp.332.1554787699494; Mon, 08 Apr 2019 22:28:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554787699; cv=none; d=google.com; s=arc-20160816; b=NCgHpMOXVxc8qvfcG1H2gzP1m28e+ScN+ENtoTSaX1C8X4Lw1rJ08yI3A+wiLUqAcD kvu4iowETeuvTKUwvdJ2/zGcstFNLF7d8amFFVqr0lAWKVL6sExdt2AeFBEfTA5TLAzy /ag2g5GQXJ57C8r/DxlWTL1tx+zPjJiIme8NY3aHAP6A+lEx94CCApipzwB9XVc+WaE6 fFitB9JfIK14j6SEfOyRFjfG8dUrU17rHqeqn6KRD5uLOPQL682Xude+E6cTbUt0Z53z KexqLSevg0ZXdBreDDsFaeSbgKF3QxsyhNAbmby/LxoXLRYvViLLAlfp7tZ9c+s7xuYZ cWVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:message-id :in-reply-to:date:references:subject:cc:to:from; bh=usbxZ6NBKyg/1S41xba59/XhvjjhiYGuCDyBz9+j5Jc=; b=s1Hu3Kjs/4p8DYzAn570fCUdcmrCSKsqB9+qg4sZQdtIqLh8eUAURHH5ke+1XLSz1d mhCdqD/EXjtARdcS58ZqF1h7wk4u6MVkpMEmYlvEgrafJ4sc0PSFUeaZJ5zZDjYSy8zb zDhkqkkU6jaQ4XKQHunYTBnSSHzafmGiOstOindjVE41t0biCILSOBjLsuflAQXzg5RC eZa5BVgMjoRKUxUnsF6LhBP/bfvwuAoDh97kEhMc+RpqTALWSKN33wAKSeDzt9AiDjJt YrTM0Ai8gNcflbIhslLnyOpHsGzzVR7BUYqGqg7o+Qyt22T3ypOMBNC5/IABBmfD7h7v L7JQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c141si29200201pfc.169.2019.04.08.22.28.04; Mon, 08 Apr 2019 22:28:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727331AbfDIF0r (ORCPT + 99 others); Tue, 9 Apr 2019 01:26:47 -0400 Received: from mail.parknet.co.jp ([210.171.160.6]:50542 "EHLO mail.parknet.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726091AbfDIF0r (ORCPT ); Tue, 9 Apr 2019 01:26:47 -0400 Received: from ibmpc.myhome.or.jp (server.parknet.ne.jp [210.171.168.39]) by mail.parknet.co.jp (Postfix) with ESMTPSA id 7EED415CBF6; Tue, 9 Apr 2019 14:16:47 +0900 (JST) Received: from devron.myhome.or.jp (foobar@devron.myhome.or.jp [192.168.0.3]) by ibmpc.myhome.or.jp (8.15.2/8.15.2/Debian-12) with ESMTPS id x395GkAY012463 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Tue, 9 Apr 2019 14:16:47 +0900 Received: from devron.myhome.or.jp (foobar@localhost [127.0.0.1]) by devron.myhome.or.jp (8.15.2/8.15.2/Debian-12) with ESMTPS id x395GkP9008269 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Tue, 9 Apr 2019 14:16:46 +0900 Received: (from hirofumi@localhost) by devron.myhome.or.jp (8.15.2/8.15.2/Submit) id x395GiS2008268; Tue, 9 Apr 2019 14:16:44 +0900 From: OGAWA Hirofumi To: Hou Tao Cc: , , , , Andrew Morton Subject: Re: [PATCH] fat: issue flush after the writeback of FAT References: <20190409030158.136316-1-houtao1@huawei.com> Date: Tue, 09 Apr 2019 14:16:44 +0900 In-Reply-To: <20190409030158.136316-1-houtao1@huawei.com> (Hou Tao's message of "Tue, 9 Apr 2019 11:01:58 +0800") Message-ID: <87ef6bbvwj.fsf@mail.parknet.co.jp> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hou Tao writes: > fsync() needs to make sure the data & meta-data of file are persistent > after the return of fsync(), even when a power-failure occurs later. > In the case of fat-fs, the FAT belongs to the meta-data of file, > so we need to issue a flush after the writeback of FAT instead before. > > Also bail out early when any stage of fsync fails. > > Signed-off-by: Hou Tao Looks good. Acked-by: OGAWA Hirofumi > --- > fs/fat/file.c | 11 ++++++++--- > 1 file changed, 8 insertions(+), 3 deletions(-) > > diff --git a/fs/fat/file.c b/fs/fat/file.c > index b3bed32946b1..0e3ed79fcc3f 100644 > --- a/fs/fat/file.c > +++ b/fs/fat/file.c > @@ -193,12 +193,17 @@ static int fat_file_release(struct inode *inode, struct file *filp) > int fat_file_fsync(struct file *filp, loff_t start, loff_t end, int datasync) > { > struct inode *inode = filp->f_mapping->host; > - int res, err; > + int err; > + > + err = __generic_file_fsync(filp, start, end, datasync); > + if (err) > + return err; > > - res = generic_file_fsync(filp, start, end, datasync); > err = sync_mapping_buffers(MSDOS_SB(inode->i_sb)->fat_inode->i_mapping); > + if (err) > + return err; > > - return res ? res : err; > + return blkdev_issue_flush(inode->i_sb->s_bdev, GFP_KERNEL, NULL); > } -- OGAWA Hirofumi