Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757728AbbGQKHU (ORCPT ); Fri, 17 Jul 2015 06:07:20 -0400 Received: from mailout3.samsung.com ([203.254.224.33]:40994 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757379AbbGQKHP (ORCPT ); Fri, 17 Jul 2015 06:07:15 -0400 X-AuditID: cbfee61b-f79416d0000014c0-6b-55a8d3d2f252 From: Chao Yu To: Jaegeuk Kim Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org Subject: [PATCH 3/3] f2fs: convert inline data before set atomic/volatile flag Date: Fri, 17 Jul 2015 18:06:35 +0800 Message-id: <01a501d0c078$5b78b430$126a1c90$@samsung.com> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit X-Mailer: Microsoft Outlook 14.0 Thread-index: AdDAd+EpDtRtFDNoQgyLnv97sQtsFQ== Content-language: zh-cn X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrOLMWRmVeSWpSXmKPExsVy+t9jAd1Ll1eEGtz7z23xZP0sZotLi9wt Lu+aw+bA7LFpVSebx+4Fn5k8Pm+SC2CO4rJJSc3JLEst0rdL4Mr4t/Eoc8FvvorlvduZGxh3 83QxcnJICJhInL66gBHCFpO4cG89WxcjF4eQwCJGif+vFjKBJIQEXjFKPLzkBWKzCahILO/4 DxYXAbIPLbrMDmIzC3hINHZ8ZwWxhQX8JBb2XwMbyiKgKrHhy1awGl4BS4k/PyYyQ9iCEj8m 32OB6NWSWL/zOBOELS+xec1bZoiDFCR2nH0NNIcDaJeexIyv0RAl4hIbj9ximcAoMAvJpFlI Js1CMmkWkpYFjCyrGEVTC5ILipPSc430ihNzi0vz0vWS83M3MYKD95n0DsZVDRaHGAU4GJV4 eBtcV4QKsSaWFVfmHmKU4GBWEuGt3AkU4k1JrKxKLcqPLyrNSS0+xCjNwaIkznsy3ydUSCA9 sSQ1OzW1ILUIJsvEwSnVwMi/4+V7rXNu0/O/PNkfyK9paOKvl1QeMU1G1zDp/DmVFwdF8vl2 /nKdK/BkvlfjS5YQRg3XWccf6J7ef/nt8t0TT25enPr4BuuOWckFb2pYd6dVXVL4ULPnfW35 Mob3fjzq19bUBCvY6Nmc+PfylCZ/yqzPDrcEprXHtmls3XN20uuJ5hHsqYeVWIozEg21mIuK EwG+JjyRWgIAAA== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2097 Lines: 68 In f2fs_ioc_start_{atomic,volatile}_write, if we failed in converting inline data, we will report error to user, but still remain atomic/volatile flag in inode, it will impact further writes for this file. Fix it. Signed-off-by: Chao Yu --- fs/f2fs/file.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 1bb1d6e..ee17472 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -1323,6 +1323,7 @@ static int f2fs_ioc_getversion(struct file *filp, unsigned long arg) static int f2fs_ioc_start_atomic_write(struct file *filp) { struct inode *inode = file_inode(filp); + int ret; if (!inode_owner_or_capable(inode)) return -EACCES; @@ -1332,9 +1333,12 @@ static int f2fs_ioc_start_atomic_write(struct file *filp) if (f2fs_is_atomic_file(inode)) return 0; - set_inode_flag(F2FS_I(inode), FI_ATOMIC_FILE); + ret = f2fs_convert_inline_inode(inode); + if (ret) + return ret; - return f2fs_convert_inline_inode(inode); + set_inode_flag(F2FS_I(inode), FI_ATOMIC_FILE); + return 0; } static int f2fs_ioc_commit_atomic_write(struct file *filp) @@ -1364,6 +1368,7 @@ static int f2fs_ioc_commit_atomic_write(struct file *filp) static int f2fs_ioc_start_volatile_write(struct file *filp) { struct inode *inode = file_inode(filp); + int ret; if (!inode_owner_or_capable(inode)) return -EACCES; @@ -1371,9 +1376,12 @@ static int f2fs_ioc_start_volatile_write(struct file *filp) if (f2fs_is_volatile_file(inode)) return 0; - set_inode_flag(F2FS_I(inode), FI_VOLATILE_FILE); + ret = f2fs_convert_inline_inode(inode); + if (ret) + return ret; - return f2fs_convert_inline_inode(inode); + set_inode_flag(F2FS_I(inode), FI_VOLATILE_FILE); + return 0; } static int f2fs_ioc_release_volatile_write(struct file *filp) -- 2.4.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/