1
0
Fork 0
remarkable-linux/fs/f2fs
Chao Yu e2b4e2bc88 f2fs: fix incorrect mapping for bmap
The test step is like below:
1. touch file
2. truncate -s $((1024*1024)) file
3. fallocate -o 0 -l $((1024*1024)) file
4. fibmap.f2fs file

Our result of fibmap.f2fs showed below is not correct:

file_pos   start_blk     end_blk        blks
       0    -937166132    -937166132           1
    4096    -937166132    -937166132           1
    8192    -937166132    -937166132           1
   12288    -937166132    -937166132           1
   16384    -937166132    -937166132           1
   20480    -937166132    -937166132           1
...
 1040384    -937166132    -937166132           1
 1044480    -937166132    -937166132           1

This is because f2fs_map_blocks will return with no error when meeting
a hole or preallocated block, the caller __get_data_block will map the
uninitialized variable value to bh->b_blocknr.

Unfortunately generic_block_bmap will neither check the return value of
get_data() nor check mapping info of buffer_head, result in returning
the random block address.

After fixing the issue, our result shows correctly:

file_pos   start_blk     end_blk        blks
       0           0           0         256

Signed-off-by: Chao Yu <chao2.yu@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2015-08-21 22:45:14 -07:00
..
Kconfig f2fs: fix typo 2015-08-21 22:43:32 -07:00
Makefile f2fs: maintain extent cache in separated file 2015-08-04 14:09:58 -07:00
acl.c f2fs: make posix_acl_create() safer and cleaner 2015-05-07 11:38:31 -07:00
acl.h f2fs: avoid deadlock on init_inode_metadata 2014-11-03 16:07:33 -08:00
checkpoint.c f2fs: do not write any node pages related to orphan inodes 2015-08-20 08:59:42 -07:00
crypto.c f2fs crypto: add alloc_bounce_page 2015-06-11 15:04:20 -07:00
crypto_fname.c f2fs crypto: clean up error handling in f2fs_fname_setup_filename 2015-06-01 16:21:08 -07:00
crypto_key.c f2fs crypto: delete an unnecessary check before the function call "key_put" 2015-08-04 14:09:52 -07:00
crypto_policy.c f2fs crypto: do not set encryption policy for non-directory by ioctl 2015-06-01 16:21:07 -07:00
data.c f2fs: fix incorrect mapping for bmap 2015-08-21 22:45:14 -07:00
debug.c f2fs: use atomic_t to record hit ratio info of extent cache 2015-08-05 08:08:06 -07:00
dir.c f2fs: avoid clear valid page 2015-08-20 09:00:06 -07:00
extent_cache.c f2fs: fix to update cached_en of extent tree properly 2015-08-21 22:45:06 -07:00
f2fs.h f2fs: fix incorrect mapping for bmap 2015-08-21 22:45:14 -07:00
f2fs_crypto.h f2fs crypto: remove alloc_page for bounce_page 2015-06-01 16:21:10 -07:00
file.c f2fs: fix to cover lock_op for update_inode_page 2015-08-20 09:00:11 -07:00
gc.c f2fs: retry gc if one section is not successfully reclaimed 2015-08-20 09:00:12 -07:00
gc.h f2fs: add new ioctl F2FS_IOC_GARBAGE_COLLECT 2015-08-04 14:09:58 -07:00
hash.c f2fs: introduce dot and dotdot name check 2015-05-28 15:41:34 -07:00
inline.c f2fs: fix to release inode page correctly 2015-08-05 08:08:23 -07:00
inode.c f2fs: fix inline data/dentry stat number leak 2015-08-05 08:08:14 -07:00
namei.c f2fs: go out for insert_inode_locked failure 2015-08-20 09:00:13 -07:00
node.c f2fs: check the node block address of newly allocated nid 2015-08-20 09:00:14 -07:00
node.h f2fs: move existing definitions into f2fs.h 2015-05-28 15:41:27 -07:00
recovery.c f2fs: do not write any node pages related to orphan inodes 2015-08-20 08:59:42 -07:00
segment.c f2fs: handle failed bio allocation 2015-08-20 09:00:09 -07:00
segment.h f2fs: avoid a build warning 2015-08-14 16:02:15 -07:00
shrinker.c f2fs: shrink free_nids entries 2015-08-20 09:00:06 -07:00
super.c f2fs: do not write any node pages related to orphan inodes 2015-08-20 08:59:42 -07:00
trace.c f2fs: add sbi and page pointer in f2fs_io_info 2015-05-28 15:41:32 -07:00
trace.h f2fs: add sbi and page pointer in f2fs_io_info 2015-05-28 15:41:32 -07:00
xattr.c f2fs: correct return value of ->setxattr 2015-08-04 14:09:59 -07:00
xattr.h f2fs crypto: add encryption xattr support 2015-05-28 15:41:47 -07:00