Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp185441rbb; Fri, 23 Feb 2024 17:17:25 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUTAwM50YdgoFtA0IUzqkcMzFasByU3s+5I5amMK5fAljqXiOV5dHiqIy8iFfge0xeXCMlmCU1p1BCz7UCC5iVjfADIbLNM8kPazEFN3g== X-Google-Smtp-Source: AGHT+IHBezI4HkkvOsIghrKZBgldKy4Dwe/ugQv0GjsvZYDrsUiYLMgt9g5Nl3GT45H066HW0HZq X-Received: by 2002:a05:620a:4109:b0:787:3aaa:38d9 with SMTP id j9-20020a05620a410900b007873aaa38d9mr1730310qko.51.1708737445225; Fri, 23 Feb 2024 17:17:25 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708737445; cv=pass; d=google.com; s=arc-20160816; b=rcGma2ptrgrdQ4HpYJS4gFj+o8vLh2yrNaD4Ke1KRyVtsG6ub4k4rrKqgUKVU+DF34 NIMoZvuxe3MqPaL2YE28qFNzJJb2FZGl581jr/gVifgIkZ5fvcAZ0NAFYeWOJ4PKxtir t03h9m+YlzVi4t5jCIRuMI4cZWYbnV693LrkHySUnTuUkRvxigpW0XNclcjfJ01cOBJD Eu8hm+r9QbAWnPsXkvyLhLH8Dj86rZQp60/WHzfOxcZCMN9zlinouQaHXW8u7jUsSmx9 yhaH127jp1CrPmOg2gE/VTkKrWSyD1CXREdyb3lFHoRaBzSRI3Qly/KYbIlN8wPg4pSJ pA0w== 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:user-agent:references:in-reply-to :message-id:cc:to:from:subject:date:dkim-signature; bh=ZxaV1z8VEkl31IN1Kfvmq4if+IFrJXP3OU6KycT61dE=; fh=eGotrG2wUAPCtJbO4MhMKF1jcndrbQy7pSZLLDRnPjs=; b=Xk6NJnwac8sInMxnn1gGj61q0LMi/ZrhzueiCO9eqyMoOngDF3zjRI+Y13Y9J3Wcj6 oS8IWT3Y23GZ7BsGwEpK3G2hAq3TyrUaI/YEBbyfBsVw0wdtt8ylfpgvnPCDI7E0F+sP yAlDDUpYnNreRPJXOIDcAPAECVHLFXBHgp9DiAFAzFZgjQQRr+nXvgcGfndWSOTZHj0V 9ouMCYNwJdzVZr//8Ik6fiPbqCaXYaTqFLVopW27lvITpS+kSasEB/kQ40AIFIJfjcs0 xZ6boKYSsUJ8fLdAOLqzKGsV53pIoYossl4Q1SOprmMkDNqOLglLi5EJJykYg1Jcd9Zl SFkQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=EoRxnbZK; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-79413-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-79413-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id m10-20020a05620a220a00b00785d6b130dbsi122758qkh.318.2024.02.23.17.17.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 17:17:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-79413-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=EoRxnbZK; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-79413-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-79413-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id AE4791C22E0F for ; Sat, 24 Feb 2024 01:17:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5FB70D517; Sat, 24 Feb 2024 01:16:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="EoRxnbZK" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 7C71BC147; Sat, 24 Feb 2024 01:16:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708737381; cv=none; b=F6kqG2XM+wDneoYMxZSa5+7ZXZzHyZ9gW4tpCXj0OzDYgUek6YGb8ZRo+qXzEW5zo4DBJnVVoVeo8oQ6q+wBjoxCkM/xgLVeGNMH63r7DVLGEQazBx3ke0GEiKMwXkaLzNAbDWupchFrBfTCDbC+Erfec1fEsd9BuiNVJEmm+EU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708737381; c=relaxed/simple; bh=t+A4fuSyZmpKgcoiyVGvJurKhFdfR6NSDpq/Eq4fqh8=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=PsZkhfyZDPojUFRDjoLWKReRdRlJcLDdTZiSvhHtmVVQWSmpJU1/b38FPJXX3ixGAjD26ACh6qPNFduRXPfksP3C0EbZWdDS/c7uUyJLQbRg+wghxC6++6JLbH0z+rVZmmRGWB8Zo1VgBP0nsNlBiS3KDvnx/fMHFKBLRCQjvf0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=EoRxnbZK; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4E225C43399; Sat, 24 Feb 2024 01:16:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708737381; bh=t+A4fuSyZmpKgcoiyVGvJurKhFdfR6NSDpq/Eq4fqh8=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=EoRxnbZKmfu1bsYK1Q5UbSC01cBn6XZ1TgE1TnePN5bIcvfPiYfIhyUVnrrduUrPf oK58BvBt+rBr/d2Gob1cyRBJI8gwvlC/zI6Id1SHgT/ttTOL8dqlUlWyNe6yQbB7kW LC0mZxAO4aPVMsCnHpszl4Zq7VULCA5+bbn+jCQJmeQRJgWasv3OnDUIrnw5Q2iI/o LU3KHY+SaISVU8oMKAY0qmgPwceQ1+9mTko/dqFh1y87x0vdJAwscNSEtaX7SFHy87 cdpyVPfNgsGm3xnuvC8CXEm82fdUnqaLaEsmtpizBJiHH4yBnBrwZxfcdBnj640UsT kcAKk1V3LRaBw== Date: Fri, 23 Feb 2024 17:16:20 -0800 Subject: [PATCH 10/10] thread_with_stdio: suppress hung task warning From: "Darrick J. Wong" To: akpm@linux-foundation.org, daniel@gluo.nz, kent.overstreet@linux.dev, djwong@kernel.org Cc: linux-xfs@vger.kernel.org, linux-bcachefs@vger.kernel.org, linux-kernel@vger.kernel.org Message-ID: <170873669050.1861398.1460620236602264758.stgit@frogsfrogsfrogs> In-Reply-To: <170873668859.1861398.2367011381778949840.stgit@frogsfrogsfrogs> References: <170873668859.1861398.2367011381778949840.stgit@frogsfrogsfrogs> User-Agent: StGit/0.19 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit From: Kent Overstreet Signed-off-by: Kent Overstreet Reviewed-by: Darrick J. Wong Signed-off-by: Darrick J. Wong --- lib/thread_with_file.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/lib/thread_with_file.c b/lib/thread_with_file.c index f4946a437332a..b09dc60ba6280 100644 --- a/lib/thread_with_file.c +++ b/lib/thread_with_file.c @@ -9,6 +9,7 @@ #include #include #include +#include #include /* stdio_redirect */ @@ -46,7 +47,15 @@ int stdio_redirect_read(struct stdio_redirect *stdio, char *ubuf, size_t len) { struct stdio_buf *buf = &stdio->input; - wait_event(buf->wait, stdio_redirect_has_input(stdio)); + /* + * we're waiting on user input (or for the file descriptor to be + * closed), don't want a hung task warning: + */ + do { + wait_event_timeout(buf->wait, stdio_redirect_has_input(stdio), + sysctl_hung_task_timeout_secs * HZ / 2); + } while (!stdio_redirect_has_input(stdio)); + if (stdio->done) return -1; @@ -67,7 +76,11 @@ int stdio_redirect_readline(struct stdio_redirect *stdio, char *ubuf, size_t len size_t copied = 0; ssize_t ret = 0; again: - wait_event(buf->wait, stdio_redirect_has_input(stdio)); + do { + wait_event_timeout(buf->wait, stdio_redirect_has_input(stdio), + sysctl_hung_task_timeout_secs * HZ / 2); + } while (!stdio_redirect_has_input(stdio)); + if (stdio->done) { ret = -1; goto out;