|
@@ -4140,6 +4140,12 @@ static int tracing_set_tracer(struct trace_array *tr, const char *buf)
|
|
goto out;
|
|
goto out;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /* If trace pipe files are being read, we can't change the tracer */
|
|
|
|
+ if (tr->current_trace->ref) {
|
|
|
|
+ ret = -EBUSY;
|
|
|
|
+ goto out;
|
|
|
|
+ }
|
|
|
|
+
|
|
trace_branch_disable();
|
|
trace_branch_disable();
|
|
|
|
|
|
tr->current_trace->enabled--;
|
|
tr->current_trace->enabled--;
|
|
@@ -4363,6 +4369,8 @@ static int tracing_open_pipe(struct inode *inode, struct file *filp)
|
|
iter->trace->pipe_open(iter);
|
|
iter->trace->pipe_open(iter);
|
|
|
|
|
|
nonseekable_open(inode, filp);
|
|
nonseekable_open(inode, filp);
|
|
|
|
+
|
|
|
|
+ tr->current_trace->ref++;
|
|
out:
|
|
out:
|
|
mutex_unlock(&trace_types_lock);
|
|
mutex_unlock(&trace_types_lock);
|
|
return ret;
|
|
return ret;
|
|
@@ -4382,6 +4390,8 @@ static int tracing_release_pipe(struct inode *inode, struct file *file)
|
|
|
|
|
|
mutex_lock(&trace_types_lock);
|
|
mutex_lock(&trace_types_lock);
|
|
|
|
|
|
|
|
+ tr->current_trace->ref--;
|
|
|
|
+
|
|
if (iter->trace->pipe_close)
|
|
if (iter->trace->pipe_close)
|
|
iter->trace->pipe_close(iter);
|
|
iter->trace->pipe_close(iter);
|
|
|
|
|
|
@@ -5331,6 +5341,8 @@ static int tracing_buffers_open(struct inode *inode, struct file *filp)
|
|
|
|
|
|
filp->private_data = info;
|
|
filp->private_data = info;
|
|
|
|
|
|
|
|
+ tr->current_trace->ref++;
|
|
|
|
+
|
|
mutex_unlock(&trace_types_lock);
|
|
mutex_unlock(&trace_types_lock);
|
|
|
|
|
|
ret = nonseekable_open(inode, filp);
|
|
ret = nonseekable_open(inode, filp);
|
|
@@ -5437,6 +5449,8 @@ static int tracing_buffers_release(struct inode *inode, struct file *file)
|
|
|
|
|
|
mutex_lock(&trace_types_lock);
|
|
mutex_lock(&trace_types_lock);
|
|
|
|
|
|
|
|
+ iter->tr->current_trace->ref--;
|
|
|
|
+
|
|
__trace_array_put(iter->tr);
|
|
__trace_array_put(iter->tr);
|
|
|
|
|
|
if (info->spare)
|
|
if (info->spare)
|
|
@@ -6416,7 +6430,7 @@ static int instance_delete(const char *name)
|
|
goto out_unlock;
|
|
goto out_unlock;
|
|
|
|
|
|
ret = -EBUSY;
|
|
ret = -EBUSY;
|
|
- if (tr->ref)
|
|
|
|
|
|
+ if (tr->ref || (tr->current_trace && tr->current_trace->ref))
|
|
goto out_unlock;
|
|
goto out_unlock;
|
|
|
|
|
|
list_del(&tr->list);
|
|
list_del(&tr->list);
|