Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp182689rbb; Fri, 23 Feb 2024 17:09:06 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVhPa8PWOBhXMOQ66wSVae0abM1q/vdsL2Z1M/on0zxO7VAcMlvd8wzFRIKCBeDZgF1jLqxNHL8VSygz9yza0YA91OAkJm9NmIaWeBFkw== X-Google-Smtp-Source: AGHT+IHJevc9WULC5d8FqVTpPxxlbxisj6EJ5MBAITLqzMmrAeiFUzJhJWYaTZc6o+wXK+ZmPYc0 X-Received: by 2002:a05:6a20:c791:b0:1a0:9ab5:1e83 with SMTP id hk17-20020a056a20c79100b001a09ab51e83mr2095903pzb.24.1708736946699; Fri, 23 Feb 2024 17:09:06 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708736946; cv=pass; d=google.com; s=arc-20160816; b=Ve+pxebcsc6AXG6AKZKt0LqBma+1j0dWbzoh1v7t+0cG9FR9G1n9y4Nbo6rPy9Vvip N7NxZN0UAGROCYooOSN3rAjGNXjyZmO2vLH7EsPCiB2+Fuz2GVrWzP3HrnvRggZSfyhs sT47Vzeq/gQuZWXCMqlI/QJa6LbZUocMa9N5rIflIjQ3aSJO/yqvECYFMUApM4UoTT8p p0dwNtR78ZpSi+T6zHBL8ze1zulKoa3W0xdFsy1qPcwl6Ws0PVX48cZOWg0vOqDn3R/m dRAPpwaM54rTX+Z3MGCakWDGUaCmDQYC/0XhNV8Q8IgyI/34JM/AhW3vTBjQsvBc4MyF RoTA== 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=KMO923Ecs24qU8mTNyamQGhTMXYOXDJ1m5gKepQHYuw=; fh=eGotrG2wUAPCtJbO4MhMKF1jcndrbQy7pSZLLDRnPjs=; b=Gu/ycOZjbvNnKNZSqMcWZiXkNdQlRzan6WVmoDCwwEwgevWmvz8C7T9R/6EonDDKrT UmwlIQogYF/ECfUfOyPB7ox4nFUKyjKD6jsmGdMHO8jvUKIOyvbt3ircdyPzLf9eEBhk ybGJD46qUZyiowH9imHRCOibkhy6lKq+W5VLMXi6D1E1Jqsy9wjHCK6m74SGpM+MlFUj 8vjc4uaUT0hkIjMMqzM0ahXc1cnA58RuP/J+GqHgYN3fr1/yyJmKe35+entnchnhuYgY DNyFMx9xxFHJlpEi0ZqslVIk4Xm09WarnPQljrFbzVTWEykXDfzpQh/R3lBmdU+V2pHe nlGQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="IsU/NJjR"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-79386-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-79386-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id a32-20020a056a001d2000b006e3f39ecbf6si142000pfx.54.2024.02.23.17.09.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 17:09:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-79386-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="IsU/NJjR"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-79386-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-79386-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 5BC3B2862DB for ; Sat, 24 Feb 2024 01:09:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 82AFD4C6B; Sat, 24 Feb 2024 01:08:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="IsU/NJjR" 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 8F20417FE; Sat, 24 Feb 2024 01:08:48 +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=1708736928; cv=none; b=pUfI28oQNAUYgB5ydEh/bYc1wsmOXSLPuMEPIDHPEH99klcliugZOHgXYLuwuluSx1fRj/vX3/gZBVNugtocoyuQjP2Ns6FY3fCGYzVqUp5SHjHDAp/yNkhEtwYRgXnfKL5fWXlJggfFBUdeRtwUkW/Tj1wfizwBrQHY7/U97Yo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708736928; c=relaxed/simple; bh=t9V5kxYGwm3sv9nKxOBv3qZ/E3QJVhqTaxQJMIIzN5E=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Wd+YMNtVoAK/gorG6gfMenJJRIIFsM8AOAJAzWTwiqclzHL5S0vrj4MQX3r2IwsVR7IbaT1CZeqh/dodpwZZ+OAm58xHwBkbAFpFH+QIc+e6MFGK+S1HWsTwxcrlIxFDLx5YFpY/oeE2xRuHDzxKLz5hBXpupwRa0w/KAkRIAdU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=IsU/NJjR; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 02CA5C433C7; Sat, 24 Feb 2024 01:08:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708736928; bh=t9V5kxYGwm3sv9nKxOBv3qZ/E3QJVhqTaxQJMIIzN5E=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=IsU/NJjRd9GLzt/RghDW/HlovoMRwVjWQztgQTA2xmUvUE0922OXjcKOyOcQRqc+S 7oA5ypFQBQbY+yK0KRuFdoMFMpoN08DJ8X61GTBG9yMn0sFGEFS+oNYufmOyrmH7M3 UgNmfbD5wcQD8p+DXN+JJvv+IzfvT+rHDOYkZaSc5SysA4Y1RD/9OqyI9LMSVO0EwJ DJzOL/T1TZZh6ZyycX4FNea6PC8yeBZ7jgMfrfTb6h2RiDE5DI/QPGwImVvj+w2+tk mztu+zCN5g5EIFpaD+a/Ir/dNpGcX9LwlREOQy0H7lYFpx7k2plZwa7v/qTcRs3JXH o44+8uZLRGstA== Date: Fri, 23 Feb 2024 17:08:47 -0800 Subject: [PATCHSET 5/6] thread_with_file: cleanups and fixes 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: <170873669390.1861696.14195299906744951144.stgit@frogsfrogsfrogs> In-Reply-To: <20240224010017.GM6226@frogsfrogsfrogs> References: <20240224010017.GM6226@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 Hi all, This series fixes some problems with the thread_with_file code -- namely that blocking stdout writes attempt a non-atomic memory allocation while holding a spinlock. It also cleans up the ops handling so that we can support ioctls on the thread_with_file itself. If you're going to start using this code, I strongly recommend pulling from my git trees, which are linked below. This has been running on the djcloud for months with no problems. Enjoy! Comments and questions are, as always, welcome. --D kernel git tree: https://git.kernel.org/cgit/linux/kernel/git/djwong/xfs-linux.git/log/?h=twf-cleanups --- Commits in this patchset: * thread_with_file: allow creation of readonly files * thread_with_file: fix various printf problems * thread_with_file: create ops structure for thread_with_stdio * thread_with_file: allow ioctls against these files * thread_with_file: Fix missing va_end() --- fs/bcachefs/chardev.c | 18 ++++-- include/linux/thread_with_file.h | 20 +++++-- lib/thread_with_file.c | 113 ++++++++++++++++++++++++++++++-------- 3 files changed, 115 insertions(+), 36 deletions(-)