f2fs: fix return value in f2fs_ioc_commit_atomic_write
authorChao Yu <yuchao0@huawei.com>
Wed, 18 Apr 2018 09:45:02 +0000 (17:45 +0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Thu, 31 May 2018 18:31:46 +0000 (11:31 -0700)
In f2fs_ioc_commit_atomic_write, if file is volatile, return -EINVAL to
indicate that commit failure.

Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/file.c

index 58f692b568b247ea8ff7e7e9db9bc2cd8064af50..d2b4145cb34e0a2394b6731008eb37ad3712c2f4 100644 (file)
@@ -1726,8 +1726,10 @@ static int f2fs_ioc_commit_atomic_write(struct file *filp)
 
        down_write(&F2FS_I(inode)->dio_rwsem[WRITE]);
 
-       if (f2fs_is_volatile_file(inode))
+       if (f2fs_is_volatile_file(inode)) {
+               ret = -EINVAL;
                goto err_out;
+       }
 
        if (f2fs_is_atomic_file(inode)) {
                ret = commit_inmem_pages(inode);