From owner-dev-commits-src-all@freebsd.org Tue Aug 31 04:38:54 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 653D266457A; Tue, 31 Aug 2021 04:38:54 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GzDwZ1x5Dz4XBt; Tue, 31 Aug 2021 04:38:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 28DFD29F5; Tue, 31 Aug 2021 04:38:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17V4csB0003757; Tue, 31 Aug 2021 04:38:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17V4csPp003756; Tue, 31 Aug 2021 04:38:54 GMT (envelope-from git) Date: Tue, 31 Aug 2021 04:38:54 GMT Message-Id: <202108310438.17V4csPp003756@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: f822d4feb87a - main - ffs_update(): recalculate flags after relocking the vnode MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f822d4feb87a7bd7747679aa779942d24fff08e0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 Aug 2021 04:38:54 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=f822d4feb87a7bd7747679aa779942d24fff08e0 commit f822d4feb87a7bd7747679aa779942d24fff08e0 Author: Konstantin Belousov AuthorDate: 2021-08-26 16:12:58 +0000 Commit: Konstantin Belousov CommitDate: 2021-08-31 04:38:35 +0000 ffs_update(): recalculate flags after relocking the vnode Inode type could migrate between snapshot and regular types while the vnode is unlocked. Recalculate flags specific for snapshot after relock. Reviewed by: mckusick Reported and tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week --- sys/ufs/ffs/ffs_inode.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sys/ufs/ffs/ffs_inode.c b/sys/ufs/ffs/ffs_inode.c index b3d41aa023f9..2bc3da7e603f 100644 --- a/sys/ufs/ffs/ffs_inode.c +++ b/sys/ufs/ffs/ffs_inode.c @@ -145,10 +145,10 @@ ffs_update(vp, waitfor) * snapshot vnode to prevent it from being removed while we are * waiting for the buffer. */ +loop: flags = 0; if (IS_SNAPSHOT(ip)) flags = GB_LOCK_NOWAIT; -loop: bn = fsbtodb(fs, ino_to_fsba(fs, ip->i_number)); error = ffs_breadz(VFSTOUFS(vp->v_mount), ITODEVVP(ip), bn, bn, (int) fs->fs_bsize, NULL, NULL, 0, NOCRED, flags, NULL, &bp); @@ -176,6 +176,11 @@ loop: vrele(vp); if (VN_IS_DOOMED(vp)) return (ENOENT); + + /* + * Recalculate flags, because the vnode was relocked and + * could no longer be a snapshot. + */ goto loop; } if (DOINGSOFTDEP(vp))