2
0

100-f2fs-WARNING-at-fs-f2fs-segment.c-718-update_sit_ent.patch 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. From 31873d5cdf8a97d5f7921451c54f6d293293c6cc Mon Sep 17 00:00:00 2001
  2. From: Jaegeuk Kim <jaegeuk@kernel.org>
  3. Date: Wed, 23 Aug 2017 13:33:00 -0700
  4. Subject: [PATCH] mkfs.f2fs: fix missing cpu_to_le64 for checkpoint version
  5. The error on mips was reported by Stijn as follow.
  6. Commit 8399a29df92d6867d226df362edbf2e0efa527c1 in f2fs-tools
  7. ("mkfs.f2fs: give random checkpoint version") causes a bug when mounting
  8. a filesystem created with it on a MIPS64 device running a 4.4(.83)
  9. kernel. The following kernel warning appears several times per second,
  10. for 30 seconds:
  11. [ 23.837262] ------------[ cut here ]------------
  12. [ 23.842039] WARNING: CPU: 0 PID: 935 at fs/f2fs/segment.c:718
  13. update_sit_entry+0x1c0/0x2b0()
  14. [ 23.850507] Modules linked in: pppoe ppp_async l2tp_ppp iptable_nat
  15. [ 24.174064] Call Trace:
  16. [ 24.176527] [<ffffffff81126e14>] show_stack+0x68/0xb4
  17. [ 24.181595] [<ffffffff81321fc4>] dump_stack+0x8c/0xc4
  18. [ 24.186660] [<ffffffff8113d004>] warn_slowpath_common+0xa0/0xd0
  19. [ 24.192597] [<ffffffff812e0148>] update_sit_entry+0x1c0/0x2b0
  20. [ 24.198353] [<ffffffff812e0a70>] refresh_sit_entry+0x70/0xf8
  21. [ 24.204022] [<ffffffff812e251c>] allocate_data_block+0x1f0/0x310
  22. [ 24.210038] [<ffffffff812e28d8>] do_write_page+0x29c/0x2bc
  23. [ 24.215532] [<ffffffff812e2a88>] write_data_page+0xa0/0xd8
  24. [ 24.221028] [<ffffffff812d844c>] do_write_data_page+0xe4/0x384
  25. [ 24.226870] [<ffffffff812d88f4>] f2fs_write_data_page+0x208/0x464
  26. [ 24.232972] [<ffffffff812d5184>] __f2fs_writepage+0x1c/0x74
  27. [ 24.238553] [<ffffffff812d54dc>]
  28. f2fs_write_cache_pages.constprop.7+0x250/0x394
  29. [ 24.245869] [<ffffffff812d57f4>] f2fs_write_data_pages+0x130/0x1b0
  30. [ 24.252066] [<ffffffff811a9f80>] __filemap_fdatawrite_range+0xa0/0xd4
  31. [ 24.258515] [<ffffffff812d2338>] sync_dirty_dir_inodes+0x94/0xd8
  32. [ 24.264530] [<ffffffff812d2484>] write_checkpoint+0x108/0xb9c
  33. [ 24.270283] [<ffffffff812cc398>] f2fs_sync_fs+0x68/0xb0
  34. [ 24.275526] [<ffffffff812c641c>] f2fs_sync_file+0x2e8/0x518
  35. [ 24.281107] [<ffffffff81213ff4>] do_fsync+0x38/0x70
  36. [ 24.285992] [<ffffffff812142e8>] SyS_fsync+0x14/0x20
  37. [ 24.290972] [<ffffffff81103950>] syscall_common+0x34/0x58
  38. [ 24.296372]
  39. [ 24.298096] ---[ end trace fd3ac44449b218ab ]---
  40. Fix: 8399a29df92d68 ("mkfs.f2fs: give random checkpoint version")
  41. Reported-And-Tested-by: Stijn Tintel <stijn@linux-ipv6.be>
  42. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
  43. ---
  44. mkfs/f2fs_format.c | 2 +-
  45. 1 file changed, 1 insertion(+), 1 deletion(-)
  46. diff --git a/mkfs/f2fs_format.c b/mkfs/f2fs_format.c
  47. index 92876b8..b379e80 100644
  48. --- a/mkfs/f2fs_format.c
  49. +++ b/mkfs/f2fs_format.c
  50. @@ -546,7 +546,7 @@ static int f2fs_write_check_point_pack(void)
  51. }
  52. /* 1. cp page 1 of checkpoint pack 1 */
  53. - cp->checkpoint_ver = rand() | 0x1;
  54. + cp->checkpoint_ver = cpu_to_le64(rand() | 0x1);
  55. set_cp(cur_node_segno[0], c.cur_seg[CURSEG_HOT_NODE]);
  56. set_cp(cur_node_segno[1], c.cur_seg[CURSEG_WARM_NODE]);
  57. set_cp(cur_node_segno[2], c.cur_seg[CURSEG_COLD_NODE]);
  58. --
  59. 2.13.5