mirror of
git://git.yoctoproject.org/linux-yocto.git
synced 2025-10-22 23:13:01 +02:00
f2fs: fix to wait dio completion
commit 96cfeb0389 upstream.
It should wait all existing dio write IOs before block removal,
otherwise, previous direct write IO may overwrite data in the
block which may be reused by other inode.
Cc: stable@vger.kernel.org
Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: Alva Lan <alvalan9@foxmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
234549fb3d
commit
3aa5254d80
|
|
@ -965,6 +965,13 @@ int f2fs_setattr(struct user_namespace *mnt_userns, struct dentry *dentry,
|
|||
return err;
|
||||
}
|
||||
|
||||
/*
|
||||
* wait for inflight dio, blocks should be removed after
|
||||
* IO completion.
|
||||
*/
|
||||
if (attr->ia_size < old_size)
|
||||
inode_dio_wait(inode);
|
||||
|
||||
down_write(&F2FS_I(inode)->i_gc_rwsem[WRITE]);
|
||||
filemap_invalidate_lock(inode->i_mapping);
|
||||
|
||||
|
|
@ -1790,6 +1797,12 @@ static long f2fs_fallocate(struct file *file, int mode,
|
|||
if (ret)
|
||||
goto out;
|
||||
|
||||
/*
|
||||
* wait for inflight dio, blocks should be removed after IO
|
||||
* completion.
|
||||
*/
|
||||
inode_dio_wait(inode);
|
||||
|
||||
if (mode & FALLOC_FL_PUNCH_HOLE) {
|
||||
if (offset >= inode->i_size)
|
||||
goto out;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user