diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index e418fc5b3fed9..8ec080550a37a 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -1713,6 +1713,8 @@ static int f2fs_ioc_commit_atomic_write(struct file *filp) inode_lock(inode); + down_write(&F2FS_I(inode)->dio_rwsem[WRITE]); + if (f2fs_is_volatile_file(inode)) goto err_out; @@ -1731,6 +1733,7 @@ static int f2fs_ioc_commit_atomic_write(struct file *filp) ret = f2fs_do_sync_file(filp, 0, LLONG_MAX, 1, false); } err_out: + up_write(&F2FS_I(inode)->dio_rwsem[WRITE]); inode_unlock(inode); mnt_drop_write_file(filp); return ret;