diff options
Diffstat (limited to 'kernel/trace/blktrace.c')
| -rw-r--r-- | kernel/trace/blktrace.c | 24 | 
1 files changed, 8 insertions, 16 deletions
diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c index 987d9a9ae283..2868d85f1fb1 100644 --- a/kernel/trace/blktrace.c +++ b/kernel/trace/blktrace.c @@ -1,19 +1,7 @@ +// SPDX-License-Identifier: GPL-2.0  /*   * Copyright (C) 2006 Jens Axboe <[email protected]>   * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA - *   */  #include <linux/kernel.h>  #include <linux/blkdev.h> @@ -494,6 +482,9 @@ static int do_blk_trace_setup(struct request_queue *q, char *name, dev_t dev,  	if (!buts->buf_size || !buts->buf_nr)  		return -EINVAL; +	if (!blk_debugfs_root) +		return -ENOENT; +  	strncpy(buts->name, name, BLKTRACE_BDEV_SIZE);  	buts->name[BLKTRACE_BDEV_SIZE - 1] = '\0'; @@ -518,9 +509,6 @@ static int do_blk_trace_setup(struct request_queue *q, char *name, dev_t dev,  	ret = -ENOENT; -	if (!blk_debugfs_root) -		goto err; -  	dir = debugfs_lookup(buts->name, blk_debugfs_root);  	if (!dir)  		bt->dir = dir = debugfs_create_dir(buts->name, blk_debugfs_root); @@ -1841,6 +1829,10 @@ static ssize_t sysfs_blk_trace_attr_store(struct device *dev,  	mutex_lock(&q->blk_trace_mutex);  	if (attr == &dev_attr_enable) { +		if (!!value == !!q->blk_trace) { +			ret = 0; +			goto out_unlock_bdev; +		}  		if (value)  			ret = blk_trace_setup_queue(q, bdev);  		else  |