From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f173.google.com (mail-pf1-f173.google.com [209.85.210.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 39F45311964 for ; Wed, 29 Oct 2025 15:58:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761753536; cv=none; b=F3xZAB4WUwinMcic1rKToz0eFlGOG0eeQxEdwawdeIbZIXMhQIL6BGj3vtJeWr8dLPnHMvObKK6POREqu/hB0THfh+G6tS/QNaUFTDd3mTx9yiCJNR23auNbvhlh3sC68XIN1psVGWOpNLEfc8G+LwBn21d4HB7IuG7qRC/r9b8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761753536; c=relaxed/simple; bh=tPzwOV7GvDpR5Xi6HBtXCUHPQBBKe8WKMdp/yKCjpiU=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=mB/Q0W2cUtUMAEKOjuFQnhsqH6z+U4siRgjVPTjgUw4ID4MDuYOgtG1R3bTfZ8m2EWKpW1OpqMq0NDMTIEJIfuAe4Bj+YGa309Xo5GBnnQ4k/Q/es7gzx6ht4tHsdj2hSTmo9Ax/8oUNBEtlZVeZcyBJNYiBE7/sAWV4gtzD8F4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=dqQJSL0c; arc=none smtp.client-ip=209.85.210.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="dqQJSL0c" Received: by mail-pf1-f173.google.com with SMTP id d2e1a72fcca58-7a28c7e3577so76050b3a.1 for ; Wed, 29 Oct 2025 08:58:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1761753534; x=1762358334; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=MwxrExpiKXBKK+ITlQ6foefTYgM8fnPgsDyzvsZJuN8=; b=dqQJSL0cde3zct34IDioKcpml5cSDJiX5DBjAXwMS5+O10h9VSDCTp231V+o50yaHa /pEAmUzsxxh0yxU+NO+wQ3YMejdtnq+unVXWVITg+SnfBTmen5K1jQo1W4MMi4xda/+f U70SeIvuGan9MrlgMezrcsrJm4XJ1mVPtSrP74v4SfvvJi+dBeLA0Df7kNbKD5MHrOYk Tg9f0qZEzUsFJmrzc5WO7JJ9iBqwgRt0+nffaBMkQP2+CPCzyDdzH5d6jf8NY1csfH8z nZOVk1Gy8393qfno8c+cUaa0d+LWBpMMOKnw2PWD+LIlcNz09xwfhvrrpAXrjvqMzsOf nR+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761753534; x=1762358334; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=MwxrExpiKXBKK+ITlQ6foefTYgM8fnPgsDyzvsZJuN8=; b=msVJT10tKlA+USDm8ifPGob2V+K9NTLOyEt4eUcYgMBNaagfmiW++GVqnPVDTSu5J/ kAQvA8tvaamhIq9QV6ONtsAzliVBCljGmcfbdk5ew3Ej3Q7XCIj3YhLzGXWiKIctEgkK 7ukYAe/QAbdXuqS75s+cQXUYQXTt4IIMRPr80RX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mjWuA4/mf+B5T+NZ/lyYpe4qwFN0Q== X-Received: by 2002:a05:6a00:7589:b0:7a5:396d:76af with SMTP id d2e1a72fcca58-7a5396d7d19mr2988818b3a.18.1761753534501; Wed, 29 Oct 2025 08:58:54 -0700 (PDT) Received: from ?IPV6:2a00:79e0:2e7c:8:8b41:6bc3:2074:828c? ([2a00:79e0:2e7c:8:8b41:6bc3:2074:828c]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7a414069164sm15874564b3a.45.2025.10.29.08.58.53 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 29 Oct 2025 08:58:54 -0700 (PDT) Message-ID: Date: Wed, 29 Oct 2025 08:58:52 -0700 Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: fall back from direct to buffered I/O when stable writes are required To: Christoph Hellwig , Carlos Maiolino , Christian Brauner Cc: Jan Kara , "Martin K. Petersen" , linux-kernel@vger.kernel.org, linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-raid@vger.kernel.org, linux-block@vger.kernel.org References: <20251029071537.1127397-1-hch@lst.de> Content-Language: en-US From: Bart Van Assche In-Reply-To: <20251029071537.1127397-1-hch@lst.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 10/29/25 12:15 AM, Christoph Hellwig wrote: > we've had a long standing issue that direct I/O to and from devices that > require stable writes can corrupt data because the user memory can be > modified while in flight. This series tries to address this by falling > back to uncached buffered I/O. Given that this requires an extra copy it > is usually going to be a slow down, especially for very high bandwith > use cases, so I'm not exactly happy about. > > I suspect we need a way to opt out of this for applications that know > what they are doing, and I can think of a few ways to do that: > > 1a) Allow a mount option to override the behavior > > This allows the sysadmin to get back to the previous state. > This is fairly easy to implement, but the scope might be to wide. > > 1b) Sysfs attribute > > Same as above. Slightly easier to modify, but a more unusual > interface. > > 2) Have a per-inode attribute > > Allows to set it on a specific file. Would require an on-disk > format change for the usual attr options. > > 3) Have a fcntl or similar to allow an application to override it > > Fine granularity. Requires application change. We might not > allow any application to force this as it could be used to inject > corruption. > > In other words, they are all kinda horrible. Hi Christoph, Has the opposite been considered: only fall back to buffered I/O for buggy software that modifies direct I/O buffers before I/O has completed? Regarding selecting the direct I/O behavior for a process, how about introducing a new prctl() flag and introducing a new command-line utility that follows the style of ionice and sets the new flag before any code runs in the started process? Thanks, Bart.