瀏覽代碼

f2fs: fix to avoid race in between aio and gc

We won't wait DIO synchronously when doing AIO, so there will be potential
IO reorder in between AIO and GC, which will cause data corruption.

This patch adds inode_dio_wait to serialize aio and data GC to avoid this
issue.

Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Chao Yu 8 年之前
父節點
當前提交
73ac2f4e82
共有 1 個文件被更改,包括 3 次插入0 次删除
  1. 3 0
      fs/f2fs/gc.c

+ 3 - 0
fs/f2fs/gc.c

@@ -875,6 +875,9 @@ next_step:
 					continue;
 					continue;
 				}
 				}
 				locked = true;
 				locked = true;
+
+				/* wait for all inflight aio data */
+				inode_dio_wait(inode);
 			}
 			}
 
 
 			start_bidx = start_bidx_of_node(nofs, inode)
 			start_bidx = start_bidx_of_node(nofs, inode)