From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f182.google.com (mail-pf1-f182.google.com [209.85.210.182]) (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 14D741D90DF for ; Sun, 5 Oct 2025 23:38:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759707505; cv=none; b=j6Zba5CqQbEp1gEQhEEBp6czHBNlI88CCCPMveZrdjJl65OUX+UlLNW39UIhLx0LI9D6Wu8x6duYO0DDKsEPNezI2zG+WtN5zvryQ3Em2EFkfLNfUXcmQpnedqlizLwNNGmhuYMzc9jUIKPyyqfZjCoO8qFvIMKDAtyVB9XGEQ0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759707505; c=relaxed/simple; bh=ZeL8g3+NIGghkoED2HmChwuHilgupZ9KQh+zbVphGW4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=L34ZPpuRDfZIMCSVcWkoNAEPTiNZhv1sfZKvp32dR6Z1WMaUKV1iywgApWRg65MioFmOTjV5lEgECjCOHiJghNupAGCbPMJQ6xOE1kFzC8BEWaXRJvUiRiHDv09xI/lU8lgHpq/Vj0Plm1jIpbo2wRa3uFzYuKoZh1Fs+yr5Ec4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=fromorbit.com; spf=pass smtp.mailfrom=fromorbit.com; dkim=pass (2048-bit key) header.d=fromorbit-com.20230601.gappssmtp.com header.i=@fromorbit-com.20230601.gappssmtp.com header.b=KAt6JuNa; arc=none smtp.client-ip=209.85.210.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=fromorbit.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=fromorbit.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=fromorbit-com.20230601.gappssmtp.com header.i=@fromorbit-com.20230601.gappssmtp.com header.b="KAt6JuNa" Received: by mail-pf1-f182.google.com with SMTP id d2e1a72fcca58-78a9793aa09so5044581b3a.0 for ; Sun, 05 Oct 2025 16:38:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fromorbit-com.20230601.gappssmtp.com; s=20230601; t=1759707503; x=1760312303; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=wYZUqfHCkY9qWTGMyfXAR/EXot/02oxeQhh+iKW+hV4=; b=KAt6JuNao17F0KLky6jysffcgeHqsYte1hgupMEyzH9N/l8yrthDpUQLwB/ftz1DU5 xH+fgRIscd9OYV19/pkQs/Jeolq8Uq3nb38twgr4C7wk21xz6GZNUNWh204Wb09SxGU2 l9Ers5x4rb4uAqYqzYYZ86sX4ZNdzISF458bvUu6SXrqLFpeKkIbCAIhx3MHI1z7MT/v nrkvhgVFzNAS4H3dN9pKr30BOk6dd6Daf5BGMXdnLgeVOipgJ1UK/53DxvHeevoFxxT2 XV2ojKqHSW/Kj+coRzd+B3hBCFw/FK9RB0+lRxzTA9TmHnmjCgibOKMng2GdvsCIudXX 1Xdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1759707503; x=1760312303; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=wYZUqfHCkY9qWTGMyfXAR/EXot/02oxeQhh+iKW+hV4=; b=dKlejMEVYL3dIN8/YPjevs7dwMU1PGVjc1/DRbg4yGq27pjuzSIC/4Vmlj4k6EqA3G 8cB8db+XuMuNDEPcHayks4tU1g2OJZaAhX9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Gl4xm8ixxs91eVA== X-Received: by 2002:a05:6a00:39a6:b0:77f:11bd:749a with SMTP id d2e1a72fcca58-78c98cb7834mr10735744b3a.20.1759707503195; Sun, 05 Oct 2025 16:38:23 -0700 (PDT) Received: from dread.disaster.area (pa49-180-91-142.pa.nsw.optusnet.com.au. [49.180.91.142]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-78b020537e0sm10861937b3a.56.2025.10.05.16.38.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Oct 2025 16:38:22 -0700 (PDT) Received: from dave by dread.disaster.area with local (Exim 4.98.2) (envelope-from ) id 1v5YJ2-0000000B2DA-1HKV; Mon, 06 Oct 2025 10:38:20 +1100 Date: Mon, 6 Oct 2025 10:38:20 +1100 From: Dave Chinner To: Christoph Hellwig Cc: Pavel Emelyanov , linux-fsdevel@vger.kernel.org, "Raphael S . Carvalho" , linux-api@vger.kernel.org, linux-xfs@vger.kernel.org Subject: Re: [PATCH] fs: Propagate FMODE_NOCMTIME flag to user-facing O_NOCMTIME Message-ID: References: <20251003093213.52624-1-xemul@scylladb.com> Precedence: bulk X-Mailing-List: linux-api@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Fri, Oct 03, 2025 at 09:26:50PM -0700, Christoph Hellwig wrote: > On Fri, Oct 03, 2025 at 12:32:13PM +0300, Pavel Emelyanov wrote: > > The FMODE_NOCMTIME flag tells that ctime and mtime stamps are not > > updated on IO. The flag was introduced long ago by 4d4be482a4 ([XFS] > > add a FMODE flag to make XFS invisible I/O less hacky. Back then it > > was suggested that this flag is propagated to a O_NOCMTIME one. > > skipping c/mtime is dangerous. The XFS handle code allows it to > support HSM where data is migrated out to tape, and requires > CAP_SYS_ADMIN. Allowing it for any file owner would expand the scope > for too much as now everyone could skip timestamp updates. We have already provided a safe method for minimising the overhead of c/mtime updates in the IO path - it's called lazytime. The lazytime mount option provides eventual consistency for c/mtime updates for IO operations instead of immediate consistency. Timestamps are still updated to have the correct values, but the latency/performance of the timestamp updates is greatly improved by holding them purely in memory until some other trigger forces them to be persisted to disk. > > It can be used by workloads that want to write a file but don't care > > much about the preciese timestamp on it and can update it later with > > utimens() call. > > The workload might not care, the rest of the system does. ctime can't > bet set to arbitrary values, so it is important for backups and as > an audit trail. Lazytime works for this use case; a call to utimens() will cause a persistent update of the timestamps. As will any other inode modification that has persistence requirements (e.g. block allocation during IO or other syscalls that modify inode metadata). > > There's another reason for having this patch. When performing AIO write, > > the file_modified_flags() function checks whether or not to update inode > > times. In case update is needed and iocb carries the RWF_NOWAIT flag, > > the check return EINTR error that quickly propagates into cb completion > > without doing any IO. This restriction effectively prevents doing AIO > > writes with nowait flag, as file modifications really imply time update. > > Well, we'll need to look into that, including maybe non-blockin > timestamp updates. This came up recently on #xfs w.r.t. lazytime behaviour - we need to pass the NOWAIT decision semnatics down to the filesystem to allow lazytime to be truly non-blocking. At the moment the high level VFS NOWAIT checks (via inode_needs_update_time()) have no visibility of this filesystem specific functionality, so even if we can do the lazy timestamp update without blocking we still give an -EAGAIN if IOCB_NOWAIT is set. -Dave. -- Dave Chinner david@fromorbit.com