Robbie Ko
3fe6b9aa5c
Btrfs: fix cur_offset in the error case for nocow
...
commit 506481b20e818db40b6198815904ecd2d6daee64 upstream.
When the cow_file_range fails, the related resources are unlocked
according to the range [start..end), so the unlock cannot be repeated in
run_delalloc_nocow.
In some cases (e.g. cur_offset <= end && cow_start != -1), cur_offset is
not updated correctly, so move the cur_offset update before
cow_file_range.
kernel BUG at mm/page-writeback.c:2663!
Internal error: Oops - BUG: 0 [#1 ] SMP
CPU: 3 PID: 31525 Comm: kworker/u8:7 Tainted: P O
Hardware name: Realtek_RTD1296 (DT)
Workqueue: writeback wb_workfn (flush-btrfs-1)
task: ffffffc076db3380 ti: ffffffc02e9ac000 task.ti: ffffffc02e9ac000
PC is at clear_page_dirty_for_io+0x1bc/0x1e8
LR is at clear_page_dirty_for_io+0x14/0x1e8
pc : [<ffffffc00033c91c>] lr : [<ffffffc00033c774>] pstate: 40000145
sp : ffffffc02e9af4f0
Process kworker/u8:7 (pid: 31525, stack limit = 0xffffffc02e9ac020)
Call trace:
[<ffffffc00033c91c>] clear_page_dirty_for_io+0x1bc/0x1e8
[<ffffffbffc514674>] extent_clear_unlock_delalloc+0x1e4/0x210 [btrfs]
[<ffffffbffc4fb168>] run_delalloc_nocow+0x3b8/0x948 [btrfs]
[<ffffffbffc4fb948>] run_delalloc_range+0x250/0x3a8 [btrfs]
[<ffffffbffc514c0c>] writepage_delalloc.isra.21+0xbc/0x1d8 [btrfs]
[<ffffffbffc516048>] __extent_writepage+0xe8/0x248 [btrfs]
[<ffffffbffc51630c>] extent_write_cache_pages.isra.17+0x164/0x378 [btrfs]
[<ffffffbffc5185a8>] extent_writepages+0x48/0x68 [btrfs]
[<ffffffbffc4f5828>] btrfs_writepages+0x20/0x30 [btrfs]
[<ffffffc00033d758>] do_writepages+0x30/0x88
[<ffffffc0003ba0f4>] __writeback_single_inode+0x34/0x198
[<ffffffc0003ba6c4>] writeback_sb_inodes+0x184/0x3c0
[<ffffffc0003ba96c>] __writeback_inodes_wb+0x6c/0xc0
[<ffffffc0003bac20>] wb_writeback+0x1b8/0x1c0
[<ffffffc0003bb0f0>] wb_workfn+0x150/0x250
[<ffffffc0002b0014>] process_one_work+0x1dc/0x388
[<ffffffc0002b02f0>] worker_thread+0x130/0x500
[<ffffffc0002b6344>] kthread+0x10c/0x110
[<ffffffc000284590>] ret_from_fork+0x10/0x40
Code: d503201f a9025bb5 a90363b7 f90023b9 (d4210000)
CC: stable@vger.kernel.org # 4.4+
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Robbie Ko <robbieko@synology.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-11-21 09:26:01 +01:00
..
2018-11-21 09:25:57 +01:00
2016-10-10 20:16:43 -07:00
2018-05-30 07:50:16 +02:00
2017-12-20 10:07:25 +01:00
2018-09-19 22:47:16 +02:00
2016-10-15 12:09:13 -07:00
2016-10-10 23:02:51 -04:00
2018-11-21 09:26:01 +01:00
2018-11-10 07:43:00 -08:00
2018-11-21 09:25:59 +01:00
2018-11-13 11:17:01 -08:00
2017-11-24 08:33:42 +01:00
2018-09-26 08:36:38 +02:00
2018-11-13 11:17:03 -08:00
2018-08-03 07:55:20 +02:00
2017-08-06 18:59:43 -07:00
2016-10-10 20:16:43 -07:00
2017-09-09 17:39:40 +02:00
2018-05-30 07:50:16 +02:00
2016-10-10 20:16:43 -07:00
2016-10-27 18:43:43 -07:00
2016-10-06 09:07:44 -04:00
2018-05-30 07:50:16 +02:00
2018-11-13 11:16:56 -08:00
2018-11-10 07:42:45 -08:00
2018-11-10 07:42:56 -08:00
2018-09-05 09:20:02 +02:00
2018-11-21 09:25:58 +01:00
2018-11-13 11:16:56 -08:00
2018-09-15 09:42:57 +02:00
2018-09-15 09:42:57 +02:00
2016-10-10 20:16:43 -07:00
2016-10-10 20:16:43 -07:00
2017-10-08 10:26:09 +02:00
2017-11-30 08:39:04 +00:00
2018-11-13 11:16:55 -08:00
2018-11-13 11:16:46 -08:00
2018-08-09 12:18:00 +02:00
2018-02-17 13:21:15 +01:00
2018-11-13 11:17:02 -08:00
2016-10-10 20:16:43 -07:00
2016-10-10 20:16:43 -07:00
2018-03-28 18:39:23 +02:00
2018-11-13 11:17:01 -08:00
2018-02-03 17:05:38 +01:00
2018-10-03 17:01:48 -07:00
2018-05-30 07:50:16 +02:00
2018-04-24 09:34:18 +02:00
2016-10-30 13:09:42 -04:00
2018-11-21 09:26:00 +01:00
2016-10-10 20:16:43 -07:00
2016-09-27 21:06:21 -04:00
2018-11-10 07:42:46 -08:00
2018-04-13 19:48:12 +02:00
2018-10-20 09:51:32 +02:00
2018-09-26 08:36:35 +02:00
2018-09-09 20:01:26 +02:00
2016-10-10 20:16:43 -07:00
2018-09-15 09:42:57 +02:00
2017-06-17 06:41:56 +02:00
2018-09-05 09:20:03 +02:00
2018-09-05 09:20:10 +02:00
2016-10-10 20:16:43 -07:00
2016-09-27 21:06:21 -04:00
2018-10-13 09:18:58 +02:00
2018-07-03 11:23:17 +02:00
2018-11-10 07:42:49 -08:00
2018-11-10 07:43:00 -08:00
2018-06-06 16:44:38 +02:00
2016-10-10 20:16:43 -07:00
2017-01-09 08:32:24 +01:00
2018-09-26 08:36:37 +02:00
2016-08-02 19:35:15 -04:00
2018-06-26 08:08:09 +08:00
2017-10-18 09:35:39 +02:00
2017-06-14 15:06:00 +02:00
2016-08-23 22:58:51 -07:00
2018-02-25 11:05:55 +01:00
2018-04-08 12:12:44 +02:00
2016-09-27 21:20:53 -04:00
2017-07-05 14:40:26 +02:00
2018-02-28 10:18:33 +01:00
2018-09-15 09:42:58 +02:00
2017-10-18 09:35:41 +02:00
2017-09-07 08:35:41 +02:00
2018-07-28 07:49:14 +02:00
2018-01-31 12:55:52 +01:00
2016-09-27 18:47:38 -04:00
2018-05-16 10:08:42 +02:00
2018-07-17 11:37:53 +02:00
2017-09-20 08:20:01 +02:00
2016-09-15 13:29:52 -07:00
2017-09-20 08:19:59 +02:00
2016-10-07 18:46:29 -07:00
2016-08-12 16:47:05 +01:00
2017-12-09 22:01:51 +01:00
2016-10-18 12:21:28 +02:00
2018-02-22 15:43:48 +01:00
2017-07-21 07:42:22 +02:00
2017-10-18 09:35:39 +02:00
2018-04-20 08:21:07 +02:00
2018-08-15 18:14:43 +02:00
2018-02-17 13:21:15 +01:00
2017-07-12 15:01:02 +02:00
2018-02-17 13:21:18 +01:00
2017-07-21 07:42:22 +02:00
2017-03-15 10:02:43 +08:00
2017-01-26 08:24:37 +01:00
2017-10-12 11:51:26 +02:00
2016-10-11 15:06:30 -07:00
2016-10-07 18:46:30 -07:00
2017-02-23 17:44:35 +01:00
2017-06-14 15:06:01 +02:00
2018-03-03 10:23:21 +01:00
2017-05-08 07:47:54 +02:00
2017-12-20 10:07:18 +01:00
2016-10-08 11:06:08 -04:00
2018-10-10 08:53:22 +02:00