git: 0af463e6619c - main - ffs_read(): lock buffers after snaplk with LK_NOWITNESS

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Sun, 06 Feb 2022 01:26:50 UTC
The branch main has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=0af463e6619cf9f7386129d427c244d3da30fa3a

commit 0af463e6619cf9f7386129d427c244d3da30fa3a
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2022-02-05 02:03:47 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2022-02-06 01:26:22 +0000

    ffs_read(): lock buffers after snaplk with LK_NOWITNESS
    
    Reviewed and tested by: mckusick
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 week
    Differential revision:  https://reviews.freebsd.org/D34179
---
 sys/ufs/ffs/ffs_vnops.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/sys/ufs/ffs/ffs_vnops.c b/sys/ufs/ffs/ffs_vnops.c
index 66dafed5ac9e..b57e9a3a71b0 100644
--- a/sys/ufs/ffs/ffs_vnops.c
+++ b/sys/ufs/ffs/ffs_vnops.c
@@ -695,6 +695,9 @@ ffs_read(ap)
 		return (EOVERFLOW);
 
 	bflag = GB_UNMAPPED | (uio->uio_segflg == UIO_NOCOPY ? 0 : GB_NOSPARSE);
+#ifdef WITNESS
+	bflag |= IS_SNAPSHOT(ip) ? GB_NOWITNESS : 0;
+#endif
 	for (error = 0, bp = NULL; uio->uio_resid > 0; bp = NULL) {
 		if ((bytesinfile = ip->i_size - uio->uio_offset) <= 0)
 			break;