summaryrefslogtreecommitdiff
path: root/fs/f2fs/segment.c
diff options
context:
space:
mode:
authorJaegeuk Kim <jaegeuk.kim@samsung.com>2014-04-02 09:04:42 +0900
committerJaegeuk Kim <jaegeuk.kim@samsung.com>2014-04-02 09:56:27 +0900
commitce23447fe5764391025a67c20c97eaf5c6ac1ec3 (patch)
tree52efc6a6f4a78ed52514b50e0b72c93fc07864b5 /fs/f2fs/segment.c
parentd54c795b495b9bd417e482286c832c9a8eb210ae (diff)
f2fs: fix to cover io->bio with io_rwsem
In the f2fs_wait_on_page_writeback, io->bio should be covered by io_rwsem. Otherwise, the bio pointer can become a dangling pointer due to data races. Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Diffstat (limited to 'fs/f2fs/segment.c')
-rw-r--r--fs/f2fs/segment.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index cb49e6390ffa..f799c6a34c39 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -1049,15 +1049,14 @@ static inline bool is_merged_page(struct f2fs_sb_info *sbi,
{
enum page_type btype = PAGE_TYPE_OF_BIO(type);
struct f2fs_bio_info *io = &sbi->write_io[btype];
- struct bio *bio = io->bio;
struct bio_vec *bvec;
int i;
down_read(&io->io_rwsem);
- if (!bio)
+ if (!io->bio)
goto out;
- bio_for_each_segment_all(bvec, bio, i) {
+ bio_for_each_segment_all(bvec, io->bio, i) {
if (page == bvec->bv_page) {
up_read(&io->io_rwsem);
return true;