Luis Henriques
941c7ede13
ceph: fix buffer free while holding i_ceph_lock in fill_inode()
...
[ Upstream commit af8a85a41734f37b67ba8ce69d56b685bee4ac48 ]
Calling ceph_buffer_put() in fill_inode() may result in freeing the
i_xattrs.blob buffer while holding the i_ceph_lock. This can be fixed by
postponing the call until later, when the lock is released.
The following backtrace was triggered by fstests generic/070.
BUG: sleeping function called from invalid context at mm/vmalloc.c:2283
in_atomic(): 1, irqs_disabled(): 0, pid: 3852, name: kworker/0:4
6 locks held by kworker/0:4/3852:
#0 : 000000004270f6bb ((wq_completion)ceph-msgr){+.+.}, at: process_one_work+0x1b8/0x5f0
#1 : 00000000eb420803 ((work_completion)(&(&con->work)->work)){+.+.}, at: process_one_work+0x1b8/0x5f0
#2 : 00000000be1c53a4 (&s->s_mutex){+.+.}, at: dispatch+0x288/0x1476
#3 : 00000000559cb958 (&mdsc->snap_rwsem){++++}, at: dispatch+0x2eb/0x1476
#4 : 000000000d5ebbae (&req->r_fill_mutex){+.+.}, at: dispatch+0x2fc/0x1476
#5 : 00000000a83d0514 (&(&ci->i_ceph_lock)->rlock){+.+.}, at: fill_inode.isra.0+0xf8/0xf70
CPU: 0 PID: 3852 Comm: kworker/0:4 Not tainted 5.2.0+ #441
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.12.1-0-ga5cab58-prebuilt.qemu.org 04/01/2014
Workqueue: ceph-msgr ceph_con_workfn
Call Trace:
dump_stack+0x67/0x90
___might_sleep.cold+0x9f/0xb1
vfree+0x4b/0x60
ceph_buffer_release+0x1b/0x60
fill_inode.isra.0+0xa9b/0xf70
ceph_fill_trace+0x13b/0xc70
? dispatch+0x2eb/0x1476
dispatch+0x320/0x1476
? __mutex_unlock_slowpath+0x4d/0x2a0
ceph_con_workfn+0xc97/0x2ec0
? process_one_work+0x1b8/0x5f0
process_one_work+0x244/0x5f0
worker_thread+0x4d/0x3e0
kthread+0x105/0x140
? process_one_work+0x5f0/0x5f0
? kthread_park+0x90/0x90
ret_from_fork+0x3a/0x50
Signed-off-by: Luis Henriques <lhenriques@suse.com>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-09-10 10:31:02 +01:00
..
2019-08-04 09:33:42 +02:00
2019-08-06 18:29:35 +02:00
2018-05-30 07:50:16 +02:00
2017-12-20 10:07:25 +01:00
2019-03-13 14:04:58 -07:00
2016-10-15 12:09:13 -07:00
2018-12-01 09:44:19 +01:00
2019-08-06 18:29:40 +02:00
2018-12-17 09:38:34 +01:00
2019-09-10 10:31:02 +01:00
2019-08-25 10:51:39 +02:00
2019-08-06 18:29:38 +02:00
2019-06-22 08:17:23 +02:00
2018-11-13 11:17:03 -08:00
2019-07-21 09:05:59 +02:00
2019-05-08 07:19:10 +02:00
2019-03-23 13:19:47 +01:00
2019-02-12 19:44:51 +01:00
2019-08-04 09:33:31 +02:00
2016-10-10 20:16:43 -07:00
2018-11-27 16:09:38 +01:00
2018-12-17 09:38:33 +01:00
2019-03-23 13:19:48 +01:00
2019-08-04 09:33:32 +02:00
2019-08-04 09:33:41 +02:00
2019-06-22 08:17:11 +02:00
2018-12-17 09:38:34 +01:00
2019-06-22 08:17:15 +02:00
2019-05-31 06:48:13 -07:00
2018-12-17 09:38:35 +01:00
2018-12-17 09:38:35 +01:00
2016-10-10 20:16:43 -07:00
2016-10-10 20:16:43 -07:00
2019-05-31 06:48:12 -07:00
2017-11-30 08:39:04 +00:00
2019-05-21 18:48:59 +02:00
2019-05-08 07:19:09 +02:00
2018-08-09 12:18:00 +02:00
2018-12-08 13:05:05 +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
2019-03-13 14:04:52 -07:00
2019-09-06 10:19:33 +02:00
2018-02-03 17:05:38 +01:00
2019-08-04 09:33:36 +02:00
2018-05-30 07:50:16 +02:00
2019-02-06 17:33:30 +01:00
2016-10-30 13:09:42 -04:00
2019-08-25 10:51:48 +02: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
2019-08-06 18:29:41 +02:00
2019-01-26 09:38:33 +01:00
2018-09-09 20:01:26 +02:00
2016-10-10 20:16:43 -07:00
2018-11-27 16:09:38 +01: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
2018-12-17 09:38:32 +01:00
2016-09-27 21:06:21 -04:00
2018-12-29 13:40:16 +01:00
2019-07-21 09:05:57 +02:00
2019-05-25 18:26:56 +02:00
2019-09-06 10:19:40 +02:00
2018-12-21 14:11:31 +01: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
2019-07-10 09:55:38 +02:00
2018-06-26 08:08:09 +08:00
2019-02-15 09:07:33 +01:00
2019-01-23 08:10:56 +01:00
2019-04-05 22:29:08 +02:00
2019-05-31 06:48:29 -07:00
2018-02-25 11:05:55 +01:00
2019-08-11 12:22:17 +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
2019-03-27 14:13:04 +09:00
2019-03-05 17:57:05 +01:00
2019-03-13 14:04:58 -07:00
2019-02-12 19:44:59 +01:00
2019-08-04 09:33:45 +02:00
2018-01-31 12:55:52 +01:00
2019-04-05 22:29:07 +02:00
2019-08-04 09:33:20 +02:00
2019-06-22 08:17:24 +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
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-12-01 09:44:25 +01:00
2018-11-21 09:26:02 +01:00
2018-02-17 13:21:15 +01:00
2019-08-04 09:33:43 +02:00
2019-06-11 12:22:45 +02: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
2019-06-11 12:22:49 +02:00
2016-10-11 15:06:30 -07:00
2016-10-07 18:46:30 -07:00
2019-06-11 12:22:45 +02:00
2017-06-14 15:06:01 +02:00
2019-02-06 17:33:29 +01:00
2017-05-08 07:47:54 +02:00
2019-09-06 10:19:37 +02:00
2016-10-08 11:06:08 -04:00
2018-10-10 08:53:22 +02:00