f2fs: fix to account IO correctly
authorChao Yu <yuchao0@huawei.com>
Mon, 22 Oct 2018 01:12:51 +0000 (09:12 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 13 Nov 2018 19:15:01 +0000 (11:15 -0800)
commit2cc5dcf7a9e074c5bdfdefea1801aa0a657750d6
tree9c07f1361bdbccd1854ddb3ad08dd1a27b777ad0
parenta3ab5e3c80106fa6b131e0ad0959d5a8376ce589
f2fs: fix to account IO correctly

commit 4c58ed076875f36dae0f240da1e25e99e5d4afb8 upstream.

Below race can cause reversed reference on dirty count, fix it by
relocating __submit_bio() and inc_page_count().

Thread A Thread B
- f2fs_inplace_write_data
 - f2fs_submit_page_bio
  - __submit_bio
- f2fs_write_end_io
 - dec_page_count
  - inc_page_count

Cc: <stable@vger.kernel.org>
Fixes: d1b3e72d5490 ("f2fs: submit bio of in-place-update pages")
Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/f2fs/data.c