Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 7 Sep 2021 00:39:56 GMT
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 5304b996818b - stable/13 - ffs_update(): recalculate flags after relocking the vnode
Message-ID:  <202109070039.1870duNS062171@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=5304b996818bde364b3ed436cfcc5fa49fdb4677

commit 5304b996818bde364b3ed436cfcc5fa49fdb4677
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2021-08-26 16:12:58 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2021-09-07 00:39:32 +0000

    ffs_update(): recalculate flags after relocking the vnode
    
    (cherry picked from commit f822d4feb87a7bd7747679aa779942d24fff08e0)
---
 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 12ab3ca0a5e1..96abdcd8f4b7 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))



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202109070039.1870duNS062171>