@@ -1406,8 +1406,8 @@ static int subsystem_open(struct inode *inode, struct file *filp)
1406
1406
return - ENODEV ;
1407
1407
1408
1408
/* Make sure the system still exists */
1409
- mutex_lock (& trace_types_lock );
1410
1409
mutex_lock (& event_mutex );
1410
+ mutex_lock (& trace_types_lock );
1411
1411
list_for_each_entry (tr , & ftrace_trace_arrays , list ) {
1412
1412
list_for_each_entry (dir , & tr -> systems , list ) {
1413
1413
if (dir == inode -> i_private ) {
@@ -1421,8 +1421,8 @@ static int subsystem_open(struct inode *inode, struct file *filp)
1421
1421
}
1422
1422
}
1423
1423
exit_loop :
1424
- mutex_unlock (& event_mutex );
1425
1424
mutex_unlock (& trace_types_lock );
1425
+ mutex_unlock (& event_mutex );
1426
1426
1427
1427
if (!system )
1428
1428
return - ENODEV ;
@@ -2294,15 +2294,15 @@ static void __add_event_to_tracers(struct trace_event_call *call);
2294
2294
int trace_add_event_call (struct trace_event_call * call )
2295
2295
{
2296
2296
int ret ;
2297
- mutex_lock (& trace_types_lock );
2298
2297
mutex_lock (& event_mutex );
2298
+ mutex_lock (& trace_types_lock );
2299
2299
2300
2300
ret = __register_event (call , NULL );
2301
2301
if (ret >= 0 )
2302
2302
__add_event_to_tracers (call );
2303
2303
2304
- mutex_unlock (& event_mutex );
2305
2304
mutex_unlock (& trace_types_lock );
2305
+ mutex_unlock (& event_mutex );
2306
2306
return ret ;
2307
2307
}
2308
2308
@@ -2356,13 +2356,13 @@ int trace_remove_event_call(struct trace_event_call *call)
2356
2356
{
2357
2357
int ret ;
2358
2358
2359
- mutex_lock (& trace_types_lock );
2360
2359
mutex_lock (& event_mutex );
2360
+ mutex_lock (& trace_types_lock );
2361
2361
down_write (& trace_event_sem );
2362
2362
ret = probe_remove_event_call (call );
2363
2363
up_write (& trace_event_sem );
2364
- mutex_unlock (& event_mutex );
2365
2364
mutex_unlock (& trace_types_lock );
2365
+ mutex_unlock (& event_mutex );
2366
2366
2367
2367
return ret ;
2368
2368
}
@@ -2424,8 +2424,8 @@ static int trace_module_notify(struct notifier_block *self,
2424
2424
{
2425
2425
struct module * mod = data ;
2426
2426
2427
- mutex_lock (& trace_types_lock );
2428
2427
mutex_lock (& event_mutex );
2428
+ mutex_lock (& trace_types_lock );
2429
2429
switch (val ) {
2430
2430
case MODULE_STATE_COMING :
2431
2431
trace_module_add_events (mod );
@@ -2434,8 +2434,8 @@ static int trace_module_notify(struct notifier_block *self,
2434
2434
trace_module_remove_events (mod );
2435
2435
break ;
2436
2436
}
2437
- mutex_unlock (& event_mutex );
2438
2437
mutex_unlock (& trace_types_lock );
2438
+ mutex_unlock (& event_mutex );
2439
2439
2440
2440
return 0 ;
2441
2441
}
@@ -2950,24 +2950,24 @@ create_event_toplevel_files(struct dentry *parent, struct trace_array *tr)
2950
2950
* creates the event hierachry in the @parent/events directory.
2951
2951
*
2952
2952
* Returns 0 on success.
2953
+ *
2954
+ * Must be called with event_mutex held.
2953
2955
*/
2954
2956
int event_trace_add_tracer (struct dentry * parent , struct trace_array * tr )
2955
2957
{
2956
2958
int ret ;
2957
2959
2958
- mutex_lock (& event_mutex );
2960
+ lockdep_assert_held (& event_mutex );
2959
2961
2960
2962
ret = create_event_toplevel_files (parent , tr );
2961
2963
if (ret )
2962
- goto out_unlock ;
2964
+ goto out ;
2963
2965
2964
2966
down_write (& trace_event_sem );
2965
2967
__trace_add_event_dirs (tr );
2966
2968
up_write (& trace_event_sem );
2967
2969
2968
- out_unlock :
2969
- mutex_unlock (& event_mutex );
2970
-
2970
+ out :
2971
2971
return ret ;
2972
2972
}
2973
2973
@@ -2996,9 +2996,10 @@ early_event_add_tracer(struct dentry *parent, struct trace_array *tr)
2996
2996
return ret ;
2997
2997
}
2998
2998
2999
+ /* Must be called with event_mutex held */
2999
3000
int event_trace_del_tracer (struct trace_array * tr )
3000
3001
{
3001
- mutex_lock (& event_mutex );
3002
+ lockdep_assert_held (& event_mutex );
3002
3003
3003
3004
/* Disable any event triggers and associated soft-disabled events */
3004
3005
clear_event_triggers (tr );
@@ -3019,8 +3020,6 @@ int event_trace_del_tracer(struct trace_array *tr)
3019
3020
3020
3021
tr -> event_dir = NULL ;
3021
3022
3022
- mutex_unlock (& event_mutex );
3023
-
3024
3023
return 0 ;
3025
3024
}
3026
3025
0 commit comments