Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp761975rdb; Mon, 29 Jan 2024 18:47:59 -0800 (PST) X-Google-Smtp-Source: AGHT+IEE30dh3a3YAk4PsBXKJOC0tAQKWG/ir1M617+G7jxt19zYJ5fAlE7Kot9uzXhsQ62/kEwB X-Received: by 2002:aa7:c394:0:b0:55f:335:8b77 with SMTP id k20-20020aa7c394000000b0055f03358b77mr2753784edq.39.1706582879123; Mon, 29 Jan 2024 18:47:59 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706582879; cv=pass; d=google.com; s=arc-20160816; b=Jd0XZ9CB0ZmgSsGx2H+unreZaN3s0QFLjSvvoECrTPPd2vl2lhh+3y1zAwukQgKxOv SdxJSmWe7sWEbSl1HiMMkiIjQbnzJex0+2XXbCz/YBACk3HzgnjKhXnnE0/Gqgd5Bp+q qx7rIfdlImgwPFaV6IlW/1rsQ9kJrCGUbEHB6AGAO31rZsW99jLWSAQYYQ91pGxVocas HRwFeE2CRiVOHBCZt9E4kfMUO5Wd4swk1zS6zunzmeIKqArDZC5BxyIfzVDnqAYLz7uO ljbngvIU8Z3tIIzyD1tGS1AWbIIU9ZuKHsAne78yx38EL5lIkDSBjs9+wSLKfivju4tG 8U/Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:date :subject:cc:to:from:message-id:dkim-signature; bh=Wk/cAVcnz+aRbH5hyvDU84O9l59UFe/4YXlZOoNacsA=; fh=wzsnDibVg0IdSOrFghAlafOikx+rTH+My02szoy7Pec=; b=vYbgtdq9OUxdfgpYI3On4TrmIoNSXYf7AIsGCqFlCpEyyyJhiG5v+XS2IBOBoyBcv2 7nHQEINK2nxySLYy9sx3ijAFIbQafOUWC+uh8zq2OyXUUNbUGH4eY2EACbYU3Me//xUS 9k5awWQKeXRlv90uKrYjtbm/DW5LO7r55ZYuGASdFwIAfBeFcTDWztk4lNlFy23KQ/5P R7+rxOChZT/sRcdwWLi11XvVRjmtL8d6bLA/DH/6QmHhSar7PHBXD2JvrP2BpjapFeVF hKxXdLwQ00+LGPvlxwf7MVGSXNxrNUaXjrsJP6WcWiXfKACwNhmGdiSaJZJVGk5PK67D FiMg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@qq.com header.s=s201512 header.b=BLNHwKIy; arc=pass (i=1 spf=pass spfdomain=qq.com dkim=pass dkdomain=qq.com dmarc=pass fromdomain=qq.com); spf=pass (google.com: domain of linux-kernel+bounces-43821-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-43821-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=qq.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id ez6-20020a056402450600b0055d37233e12si3886317edb.308.2024.01.29.18.47.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jan 2024 18:47:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-43821-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@qq.com header.s=s201512 header.b=BLNHwKIy; arc=pass (i=1 spf=pass spfdomain=qq.com dkim=pass dkdomain=qq.com dmarc=pass fromdomain=qq.com); spf=pass (google.com: domain of linux-kernel+bounces-43821-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-43821-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=qq.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 0DAFE1F281E9 for ; Tue, 30 Jan 2024 02:28:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 91D103717B; Tue, 30 Jan 2024 02:24:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=qq.com header.i=@qq.com header.b="BLNHwKIy" Received: from out162-62-57-252.mail.qq.com (out162-62-57-252.mail.qq.com [162.62.57.252]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C16A237163 for ; Tue, 30 Jan 2024 02:24:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=162.62.57.252 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706581463; cv=none; b=G1+wUjebMjA7uNMNeGpnoWu/O6rNUi6fjEAuWAop7bnOkYC2KYUkECVHRhMJUyQDPM6D4g5JtcSXCf8ODP+9KfyDyjGyu6Xxfs7OLvFHx5J35neFk1Kcp6NIfSce93BlwXv0DrszkY85OI+xwBdZbsAHOkKUqylZmTB8PeT1lyI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706581463; c=relaxed/simple; bh=IvdKvPT2p+UhTS7EYPWp0W952pSiLq+NXqaH8eQW6fg=; h=Message-ID:From:To:Cc:Subject:Date:In-Reply-To:References: MIME-Version; b=MoqYzWYs6UDREhSWSsTqbIh3QpwF8jMrcIGpQKz8zennAwr7t0Qj2wFVS8aQj9n1mb8ovOAbdWMM5gXZ2EP9AWP7Yck6yO1Y3VltqvHjeSXpFuGWD8fVLo673AasiD03brT2D7FCiCuP18YGrzoPpxaYlWKVWvj+idZWYyP3Rus= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=qq.com; spf=pass smtp.mailfrom=qq.com; dkim=pass (1024-bit key) header.d=qq.com header.i=@qq.com header.b=BLNHwKIy; arc=none smtp.client-ip=162.62.57.252 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=qq.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=qq.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qq.com; s=s201512; t=1706581450; bh=Wk/cAVcnz+aRbH5hyvDU84O9l59UFe/4YXlZOoNacsA=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=BLNHwKIyA3dzsANGvvFJvDmDAi5a0giMvE7djh7HAhqPhi74egrtUP9d5GbsSqaKz mV51jIrRMcpLbjrxzieLH3qltwbH4tTH9ijGn03MZjgNKMlTFNWAH+ZYVW8CjVaxAD yjBEBW/KbfVdeL1s4pFycMl9ODovhCiJTHrNe7vQ= Received: from pek-lxu-l1.wrs.com ([111.198.225.215]) by newxmesmtplogicsvrszc5-2.qq.com (NewEsmtp) with SMTP id 3F58EEAA; Tue, 30 Jan 2024 10:15:53 +0800 X-QQ-mid: xmsmtpt1706580953tjn6gbu0b Message-ID: X-QQ-XMAILINFO: MIAHdi1iQo+zF/zgUJiJLT0u0hWVkTlOx4MfxCxhJYzvzeOBBgSxOlRKU1tm4C 7vwWjZbJ4Uz+cedSc9IC43uHqaX2pnw3Utm+xbwbZAHFFf3mVIakoophYbr21oydfkGxv5d8gDLe qL7+G+N5x3R8m8q2PKfUreaLIEpkt7FNa6DK7xxSm5I/nEMa/Wfrfa5RoqBcgvS/jR6Hxm53PGKQ PdJzwCu1lCmXYrdYuw2QWlF52NIVoQZ0eXfY/EENugdeN7TU1hCScIioYW8mX1uE1OoyNFKLFz1Q m5AZtVSfmmUKm59zRooC8Vg3boI+t59GZX2zlmhtULTUEkTA/G48KgLkZ3GA6zIEHJm0acbesKS5 n+53ZPAv5Sw0a3VlQvNq1Z/yzErJQPg0MgF9SCdRColPTBwMqZ2RgY7SQW/TF9WYgyXbkbkaMBNs l7ptyNN4yiqECiDBTe2/DQvcD0IPaBqWw/QJdxbP1yWd818qf/j1df2HCxy1iw3TOW/dF8w2lD/j nvCiD7ab2ZcZGYNAv8UZ/U1deJkxldFr0JngWGiVVuCZ1f8YxoshpYw/7p3xLVYvmZs+m62x9UAj P5Vzn3C5O5nDWz5Erp9Z36jQzpaECAomliB/SGDGYEY5baJefexmB6YkD0vVn9CPvJOkkt7FOq/s wf067A4A5Mv2kysKqUiM2dIDaHpKfJYj3hdltI7p2nAWg20jkG7y60BmiicZYGaFXSJmyrYitL9K of8BVhVjC+4FFOr7E8ZYN1WvGJK73/2RrOmPAPyF3q4IQj0OJVrUhJvRA13OTMVJOm1jJEI1v8OQ 8ihXVdAJsdR+VKV3dVolSbAwg65hoLs/gJgy+vDhcpxg0YHxdIIidKPC84EVxJRHuVrovzbAAGwE n/9VY/pLF/j8z8zh0V75+XnwlZY2ZbQ3DlifIdyWV5+tMLVs783a6sH9eXfNe/jQ== X-QQ-XMRINFO: M/715EihBoGSf6IYSX1iLFg= From: Edward Adam Davis To: syzbot+2373f6be3e6de4f92562@syzkaller.appspotmail.com Cc: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com Subject: Re: [syzbot] [block?] [trace?] INFO: task hung in blk_trace_remove (2) Date: Tue, 30 Jan 2024 10:15:54 +0800 X-OQ-MSGID: <20240130021553.3254750-2-eadavis@qq.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <0000000000002b1fc7060fca3adf@google.com> References: <0000000000002b1fc7060fca3adf@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit please test task hung in blk_trace_remove #syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c index d5d94510afd3..ce5a1ed01d64 100644 --- a/kernel/trace/blktrace.c +++ b/kernel/trace/blktrace.c @@ -320,14 +320,16 @@ static void blk_trace_free(struct request_queue *q, struct blk_trace *bt) * under 'q->debugfs_dir', thus lookup and remove them. */ if (!bt->dir) { - debugfs_lookup_and_remove("dropped", q->debugfs_dir); - debugfs_lookup_and_remove("msg", q->debugfs_dir); + struct dentry *debugfs_dir = q ? q->debugfs_dir : bt->debugfs_dir; + + debugfs_lookup_and_remove("dropped", debugfs_dir); + debugfs_lookup_and_remove("msg", debugfs_dir); } else { debugfs_remove(bt->dir); } free_percpu(bt->sequence); free_percpu(bt->msg_data); - kfree(bt); + kfree_rcu(bt); } static void get_probe_ref(void) @@ -377,12 +379,25 @@ static int blk_trace_stop(struct blk_trace *bt) return 0; } +static void blk_trace_rcu_free(struct rcu_head *rcu) +{ + struct blk_trace *bt; + + bt = container_of(rcu, struct blk_trace, rcu); + if (bt) { + blk_trace_free(NULL, bt); + put_probe_ref(); + } +} + static void blk_trace_cleanup(struct request_queue *q, struct blk_trace *bt) { blk_trace_stop(bt); - synchronize_rcu(); - blk_trace_free(q, bt); - put_probe_ref(); + if (!bt->dir) + bt->debugfs_dir = q->debugfs_dir; + mutex_unlock(&q->debugfs_mutex); + call_rcu(&bt->rcu, blk_trace_rcu_free); + mutex_lock(&q->debugfs_mutex); } static int __blk_trace_remove(struct request_queue *q) diff --git a/include/linux/blktrace_api.h b/include/linux/blktrace_api.h index 122c62e561fc..4920c201bd12 100644 --- a/include/linux/blktrace_api.h +++ b/include/linux/blktrace_api.h @@ -26,6 +26,8 @@ struct blk_trace { struct dentry *dir; struct list_head running_list; atomic_t dropped; + struct dentry *debugfs_dir; + struct rcu_head rcu; }; extern int blk_trace_ioctl(struct block_device *, unsigned, char __user *);