From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f172.google.com (mail-pf1-f172.google.com [209.85.210.172]) (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 A4AD033A01E for ; Wed, 29 Oct 2025 15:58:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761753537; cv=none; b=lgYbpoiJuT6CqcXz9Lm8e6eoDx4lfsTKMol0HA16gFEMspeTsrSwltMPzx870LAJRS8WBpqUDY1W1pm2gnGSxGihBq1di1pVVSkNVIX9kELSaGO3QEdaGnzPnDbdV7lm8Bw+Omu0W6LdWPaxwGywSQFSuxi4kBbdojkdykADkyo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761753537; c=relaxed/simple; bh=tPzwOV7GvDpR5Xi6HBtXCUHPQBBKe8WKMdp/yKCjpiU=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=kgkgx5v1DzrK2HK3pGXB6II7k2FSv9ctd5f6DMLAzzmXo+VV/Y1Ng0MskJ+RWEnyXWc2qNZ8v+Muo/XpPO/lWI74l7b6MXpu4bpraPZRLi60Tu6s986oHLMaOzpsT8Uf85EzvMBXx42yYtkOi1d1pyiz4q1v5+9fjZOnN0iLIv4= 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.172 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-f172.google.com with SMTP id d2e1a72fcca58-7a28c7e3577so76049b3a.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=kXVxOYSQaTOIJiWX7Thz2wniFxYjizWrLo0v/gpar65rOLGj1GaLv9f14XuReArY+1 Jk8jM9lZRUd5cL89mRI8ppyPvryZDhWdt9EWC3DBscKHlHluZBVxFELVTAHQc3ljWjhp yzSLbD2DwIvLVkZYUDxqpnNYXwQdOUig/Xbox7F8XMqnY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zDGmjWuA4/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-block@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.