From nobody Tue Oct 13 04:29:56 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 4j3hFc3KSgz6vgtK for ; Tue, 13 Oct 2026 04:29:56 +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 4j3hFc1mkfz4qRt for ; Tue, 13 Oct 2026 04:29:56 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1791865796; 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=OovYCEAFP9vJ7Fn34c2NbNDcpnUquY6ezLgSLNKQ6MQ=; b=Proa/R0ToL0lZG4etqHcHFhfRSa0hzrLjmcd800lm9mZD/72p1FiN9OFUIGo6/MZB2Xdvp Smhds9SaKNcbIWVJCmqKV918P6BexeQHZp6BU47an52oNWQUnb6dDTahjabxguUIjAu4yZ A78SogKtFb4SxCcagGWqYHcKtsFt3sCxc/f4Fi1aoIEtzxVftaE9t/8S9ELa6JTZyWr/V2 nviy1O2amOiFYgc6+1FTMwRfX6vA78xhaiZskL1wRf86oRjjsBYRfoYZSi/CXkFR39qHqi OjoTPoUEaKo5N8lMclbUHid9zI2nr863VMzT0UksQBkYVimpVOAaxznJbaoaDQ== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1791865796; b=lwSzvj21x/krbIBNyNRrG9SalCQygJpr5qSuDmGNEh8VZbe7fO0fb2RQfS1t09Z8bOwrDQ Z8CJA4tkmB25NZPGExPc7s+BKY0aY3IUoTC8Wpp6jHkVkU5Nalgg4ISEDNmCJZLFWCa66e 6W8zLD3J+yQKCTLf+Vtnkcm2ZWKQN9UqIoP0Ox/yw/j37Gkbt1w/nxiazIGmxSw5ie62P7 QNc7o9kIlxi+t3W3QG4MExqvWi9/5tH9TBMzboTKmFUMl2Dq9BvAvJezoxFmpywscXcnc+ sbcIybN7pyPfwcOxUexvAi9bLi2ny7iY4i5luO8i5fSsHtzhwBfyw9rAiiYoqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1791865796; 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=OovYCEAFP9vJ7Fn34c2NbNDcpnUquY6ezLgSLNKQ6MQ=; b=Y/ci4OXijIqE2mXie2QbjMjo1ahFo/ZmKvHzOemQpIwcL8OxhRPIfXMESpnlA0lNjbR+4L BSXR0GxtqrT3HvccRcvtsk4CKvuG+MrQpHGBXOTtDNzKh/AeRfXpoyS3RSN7CmEjUwOfYm 0bql/bLroioJePMJ1EHxSUCD9wjvwvEaeMWXLrBMGkpLldN8OO6eCahq2jzr8lZHpbL3uX 64Cyks2JxUW8Rm+NtHy/L1IguKp9peqhsNAnwqqJDksypAIV9cVntIERszZ2UYS6eRVJcE mBcQSiuqVuLrm4xSRD1GBsxhQAzB1y5u134H/VKV0ZL+1HS1DYdP2y68ckO0MA== 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 4j3hFc0nHTzxys for ; Tue, 13 Oct 2026 04:29:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 27db2 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 13 Oct 2026 04:29:56 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Maxim Sobolev Subject: git: e8534ba3ad36 - main - ufs: do not let a rolled back inode write end a data-only sync 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: e8534ba3ad36b88e94de0a3174e9ab7ac04a929d Auto-Submitted: auto-generated Date: Tue, 13 Oct 2026 04:29:56 +0000 Message-Id: <6acdb3c4.27db2.37d9be3a@gitrepo.freebsd.org> The branch main has been updated by sobomax: URL: https://cgit.FreeBSD.org/src/commit/?id=e8534ba3ad36b88e94de0a3174e9ab7ac04a929d commit e8534ba3ad36b88e94de0a3174e9ab7ac04a929d Author: Maxim Sobolev AuthorDate: 2026-10-13 02:44:40 +0000 Commit: Maxim Sobolev CommitDate: 2026-10-13 04:28:32 +0000 ufs: do not let a rolled back inode write end a data-only sync With soft updates, ffs_syncvnode() writes the inode between its passes while buffers are still dirty. That write can go out with new block pointers rolled back, for instance a new indirect block whose contents are only written in a later pass, yet ffs_update() clears IN_SIZEMOD and IN_IBLKDATA because the write was synchronous. A data-only sync then decides at the end that the inode need not be written, and fdatasync(2) or an O_DSYNC write that allocated the first indirect block returned with the on-disk inode not pointing to it. Note on entry whether a data-only sync has to write the inode, and base the final write, done once all dependencies are flushed, on that alone: nothing else can set IN_SIZEMOD or IN_IBLKDATA meanwhile, as the vnode is locked. A full sync always writes the inode last and was not affected. 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_vnops.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/sys/ufs/ffs/ffs_vnops.c b/sys/ufs/ffs/ffs_vnops.c index 493936578095..8cdad58a3096 100644 --- a/sys/ufs/ffs/ffs_vnops.c +++ b/sys/ufs/ffs/ffs_vnops.c @@ -271,11 +271,18 @@ ffs_syncvnode(struct vnode *vp, int waitfor, int flags) struct buf *bp, *nbp; ufs_lbn_t lbn; int error, passes, wflag; - bool unlocked, wait; + bool inoupdt, unlocked, wait; ip = VTOI(vp); bo = &vp->v_bufobj; ump = VFSTOUFS(vp->v_mount); + /* + * With soft updates, the passes below may write the inode while + * new block pointers in it are still rolled back. That clears + * IN_SIZEMOD and IN_IBLKDATA all the same, so note up front + * whether a data-only sync has to write the inode. + */ + inoupdt = (ip->i_flag & (IN_SIZEMOD | IN_IBLKDATA)) != 0; #ifdef WITNESS wflag = IS_SNAPSHOT(ip) ? LK_NOWITNESS : 0; #else @@ -442,7 +449,7 @@ next_locked: error = ffs_update(vp, 1); if (DOINGSUJ(vp)) softdep_journal_fsync(VTOI(vp)); - } else if ((ip->i_flag & (IN_SIZEMOD | IN_IBLKDATA)) != 0) { + } else if (inoupdt) { error = ffs_update(vp, 1); } if (error == 0 && unlocked)