From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751337AbdKMJd4 (ORCPT ); Mon, 13 Nov 2017 04:33:56 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:10527 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751134AbdKMJdy (ORCPT ); Mon, 13 Nov 2017 04:33:54 -0500 From: Chao Yu To: CC: , , , Chao Yu Subject: [PATCH 1/2] f2fs: fix to clear FI_NO_PREALLOC Date: Mon, 13 Nov 2017 17:32:39 +0800 Message-ID: <20171113093240.47560-1-yuchao0@huawei.com> X-Mailer: git-send-email 2.15.0.55.gc2ece9dc4de6 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.120.216.130] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020203.5A0966EA.0061,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 1f003e72c342a9f2da461697aea623f3 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We need to clear FI_NO_PREALLOC flag in error path of f2fs_file_write_iter, otherwise we will lose the chance to preallocate blocks in latter write() at one time. Fixes: dc91de78e5e1 ("f2fs: do not preallocate blocks which has wrong buffer") Signed-off-by: Chao Yu --- fs/f2fs/file.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 8742c028acc6..41a6f1f70416 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -2750,6 +2750,7 @@ static ssize_t f2fs_file_write_iter(struct kiocb *iocb, struct iov_iter *from) err = f2fs_preallocate_blocks(iocb, from); if (err) { + clear_inode_flag(inode, FI_NO_PREALLOC); inode_unlock(inode); return err; } -- 2.15.0.55.gc2ece9dc4de6