File tree Expand file tree Collapse file tree 2 files changed +26
-11
lines changed Expand file tree Collapse file tree 2 files changed +26
-11
lines changed Original file line number Diff line number Diff line change @@ -65,19 +65,12 @@ static bool blkcg_policy_enabled(struct request_queue *q,
65
65
return pol && test_bit (pol -> plid , q -> blkcg_pols );
66
66
}
67
67
68
- /**
69
- * blkg_free - free a blkg
70
- * @blkg: blkg to free
71
- *
72
- * Free @blkg which may be partially allocated.
73
- */
74
- static void blkg_free (struct blkcg_gq * blkg )
68
+ static void blkg_free_workfn (struct work_struct * work )
75
69
{
70
+ struct blkcg_gq * blkg = container_of (work , struct blkcg_gq ,
71
+ free_work );
76
72
int i ;
77
73
78
- if (!blkg )
79
- return ;
80
-
81
74
for (i = 0 ; i < BLKCG_MAX_POLS ; i ++ )
82
75
if (blkg -> pd [i ])
83
76
blkcg_policy [i ]-> pd_free_fn (blkg -> pd [i ]);
@@ -89,6 +82,25 @@ static void blkg_free(struct blkcg_gq *blkg)
89
82
kfree (blkg );
90
83
}
91
84
85
+ /**
86
+ * blkg_free - free a blkg
87
+ * @blkg: blkg to free
88
+ *
89
+ * Free @blkg which may be partially allocated.
90
+ */
91
+ static void blkg_free (struct blkcg_gq * blkg )
92
+ {
93
+ if (!blkg )
94
+ return ;
95
+
96
+ /*
97
+ * Both ->pd_free_fn() and request queue's release handler may
98
+ * sleep, so free us by scheduling one work func
99
+ */
100
+ INIT_WORK (& blkg -> free_work , blkg_free_workfn );
101
+ schedule_work (& blkg -> free_work );
102
+ }
103
+
92
104
static void __blkg_release (struct rcu_head * rcu )
93
105
{
94
106
struct blkcg_gq * blkg = container_of (rcu , struct blkcg_gq , rcu_head );
Original file line number Diff line number Diff line change @@ -95,7 +95,10 @@ struct blkcg_gq {
95
95
96
96
spinlock_t async_bio_lock ;
97
97
struct bio_list async_bios ;
98
- struct work_struct async_bio_work ;
98
+ union {
99
+ struct work_struct async_bio_work ;
100
+ struct work_struct free_work ;
101
+ };
99
102
100
103
atomic_t use_delay ;
101
104
atomic64_t delay_nsec ;
You can’t perform that action at this time.
0 commit comments