|
@@ -3010,7 +3010,13 @@ ftrace_regex_open(struct ftrace_ops *ops, int flag,
|
|
hash = ops->filter_hash;
|
|
hash = ops->filter_hash;
|
|
|
|
|
|
if (file->f_mode & FMODE_WRITE) {
|
|
if (file->f_mode & FMODE_WRITE) {
|
|
- iter->hash = alloc_and_copy_ftrace_hash(FTRACE_HASH_DEFAULT_BITS, hash);
|
|
|
|
|
|
+ const int size_bits = FTRACE_HASH_DEFAULT_BITS;
|
|
|
|
+
|
|
|
|
+ if (file->f_flags & O_TRUNC)
|
|
|
|
+ iter->hash = alloc_ftrace_hash(size_bits);
|
|
|
|
+ else
|
|
|
|
+ iter->hash = alloc_and_copy_ftrace_hash(size_bits, hash);
|
|
|
|
+
|
|
if (!iter->hash) {
|
|
if (!iter->hash) {
|
|
trace_parser_put(&iter->parser);
|
|
trace_parser_put(&iter->parser);
|
|
kfree(iter);
|
|
kfree(iter);
|
|
@@ -3019,10 +3025,6 @@ ftrace_regex_open(struct ftrace_ops *ops, int flag,
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- if ((file->f_mode & FMODE_WRITE) &&
|
|
|
|
- (file->f_flags & O_TRUNC))
|
|
|
|
- ftrace_filter_reset(iter->hash);
|
|
|
|
-
|
|
|
|
if (file->f_mode & FMODE_READ) {
|
|
if (file->f_mode & FMODE_READ) {
|
|
iter->pg = ftrace_pages_start;
|
|
iter->pg = ftrace_pages_start;
|
|
|
|
|