From nobody Tue Oct 13 04:29:52 2026 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4j3hFX70zgz6vgp9 for ; Tue, 13 Oct 2026 04:29:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "YR2" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4j3hFX6R3mz4qSw for ; Tue, 13 Oct 2026 04:29:52 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1791865792; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=vYF2bSdBR1y+60eMHL+aD8+zyJQWbz+p6Sl3BCPjWWU=; b=Ioajl7kQKwFhX6tafnCh/ODFpvbzKvTle06Ca05JEtefwwtgpsil0BtirIalXfWgDUSu+D xfNjqg6/CCkkJC4L7YbQb02EP3E3MFmracVNGA8kfIpbQubYdiVDBsL2J4FmT9A2eX4IL1 TPaTgwIbVfzHUdueQ3wGNK4vzF1XrplrsHlmI7dKRy9AP6F9ZxKKqW9uMAApxLsJddaUp8 ZhuPG9tnU9Ehdx3Czdm0Azq9sgpaYp6bTcVjrrH3R49HpuddD9Cn7Q4peG0OMQ2Pvhj5G7 c9vPJ+z39HSw0qQzkQ621zX0cRh2iBCGBUdgniY4S0H3qcHzaX8skYmIrAuCag== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1791865792; b=c/VZRkvnUrkI9zFQaL9HWtvq26FzFgnZwTn/KZ6Bgu2x/C4i3ATZPfqWN7bU4B9iOI0dB/ 7dnlxfmIxUFWFnkXqhirw+nCS1BOLjrwSKeyhj22HpQK9EqvHiuXaFoDWUNUBmozDj4nkB xPYf7uhMHYRwmmUANzCu2sn/flFAD3kplZm0lf03ODc5rxVBUnU6Utn8EYZfAKWhtx4yz9 R3gT/dJgYXlO7FFAAgR8HMK4vb4eQKz2Xl/AS/fNy0/eci6fT8hXArbGDPpgkUK0+FF02v YpECBDwrKUZAJXIhH6VezFCS8jhJvzOX7iN9Zf84WCf5xpCVHBgpx56/e3FqIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1791865792; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=vYF2bSdBR1y+60eMHL+aD8+zyJQWbz+p6Sl3BCPjWWU=; b=ZGgnOi71l3KxoK+Pre0QwBAf6GnZkDmxl6jDtK1KHyi/XbTBDyVCY8pg22iywupICMJ18a rZAHV/WTaifoPFCUbYe/VSZOZq6SIkUxMuoRlDGrjGMCjkHdxTZnHD+ealZf13QQT992+c Fsbgz881AoZPScs1A6OSF6flFjmbaGHSIKKnBXHxGyOmr8C35uOtgLXHW/ZovZ3s51Dnmn bwMoxsKLz6c39INPUp1mEMiRlrqwkpI0t2LFJJF+tCQqALzMKscT2XbAyzAyInKaV5YETO PNe1uM6pSQt5BFuN7SQAg8ENqvbbBNcJ8D3dts9ZkaShpRZjLcgkDnWivXGChg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4j3hFX5W0Vzyxk for ; Tue, 13 Oct 2026 04:29:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3118b by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 13 Oct 2026 04:29:52 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Maxim Sobolev Subject: git: 8ff663dde22f - main - ufs: make fdatasync(2) and O_DSYNC writes update the inode List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org List-Id: Commit messages for the main branch of the src repository List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: sobomax X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8ff663dde22fe9f50ba5d71d0237bec9b9b44683 Auto-Submitted: auto-generated Date: Tue, 13 Oct 2026 04:29:52 +0000 Message-Id: <6acdb3c0.3118b.4c5caef@gitrepo.freebsd.org> The branch main has been updated by sobomax: URL: https://cgit.FreeBSD.org/src/commit/?id=8ff663dde22fe9f50ba5d71d0237bec9b9b44683 commit 8ff663dde22fe9f50ba5d71d0237bec9b9b44683 Author: Maxim Sobolev AuthorDate: 2026-10-13 02:39:05 +0000 Commit: Maxim Sobolev CommitDate: 2026-10-13 04:28:32 +0000 ufs: make fdatasync(2) and O_DSYNC writes update the inode ffs_syncvnode() in the DATA_ONLY case and ffs_write() for IO_DATASYNC decide whether the inode has to be written by testing IN_SIZEMOD and IN_IBLKDATA against ip->i_flags, the chflags(2) word, instead of the in-core state ip->i_flag. IN_SIZEMOD and IN_IBLKDATA alias UF_READONLY and UF_ARCHIVE, so for ordinary files the test was always false: after an fdatasync() or an O_DSYNC write that extended a file or filled a hole, the data blocks were on disk but the inode size and block pointers were not, and a crash before the syncer got to the inode lost the "synced" data. Files with uarchive or urdonly set got a synchronous inode write on every call instead. journal_mount() has the same mixup and sets IN_MODIFIED in i_flags, which leaves UF_OPAQUE set on the in-core .sujournal inode. The synchronous ffs_update() that follows writes the inode regardless, so only the stray flag is fixed here. Fixes: 7428630b757 ("UFS: write inode block for fdatasync(2) if pointers in inode where allocated") Fixes: 52488b51489 ("Further evaluation of the POSIX spec for fdatasync()...") Fixes: e7347be9e34 ("ffs: Support O_DSYNC.") Fixes: 113db2dddb7 ("Merge soft-updates journaling from projects/suj/head into head.") Sponsored by: Sippy Software, Inc. Reviewed by: kib Tested by: pho Differential Revision: https://reviews.freebsd.org/D60134 MFC after: 1 month --- sys/ufs/ffs/ffs_softdep.c | 2 +- sys/ufs/ffs/ffs_vnops.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/ufs/ffs/ffs_softdep.c b/sys/ufs/ffs/ffs_softdep.c index a83f7ee9b91c..a7068f43a800 100644 --- a/sys/ufs/ffs/ffs_softdep.c +++ b/sys/ufs/ffs/ffs_softdep.c @@ -2976,7 +2976,7 @@ journal_mount(struct mount *mp, */ if (fs->fs_clean) { DIP_SET(ip, i_modrev, fs->fs_mtime); - ip->i_flags |= IN_MODIFIED; + ip->i_flag |= IN_MODIFIED; ffs_update(vp, 1); } out: diff --git a/sys/ufs/ffs/ffs_vnops.c b/sys/ufs/ffs/ffs_vnops.c index ee495fe3888c..be708d07a2ca 100644 --- a/sys/ufs/ffs/ffs_vnops.c +++ b/sys/ufs/ffs/ffs_vnops.c @@ -458,7 +458,7 @@ next_locked: error = ffs_update(vp, 1); if (DOINGSUJ(vp)) softdep_journal_fsync(VTOI(vp)); - } else if ((ip->i_flags & (IN_SIZEMOD | IN_IBLKDATA)) != 0) { + } else if ((ip->i_flag & (IN_SIZEMOD | IN_IBLKDATA)) != 0) { error = ffs_update(vp, 1); } if (error == 0 && unlocked) @@ -1044,7 +1044,7 @@ ffs_write( } } else if (resid > uio->uio_resid && (ioflag & IO_SYNC)) { if (!(ioflag & IO_DATASYNC) || - (ip->i_flags & (IN_SIZEMOD | IN_IBLKDATA))) + (ip->i_flag & (IN_SIZEMOD | IN_IBLKDATA))) error = ffs_update(vp, 1); if (ffs_fsfail_cleanup(VFSTOUFS(vp->v_mount), error)) error = ENXIO;