The branch main has been updated by kib:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=10db1896495b744aa5b039dd4ef1973b7a339379

commit 10db1896495b744aa5b039dd4ef1973b7a339379
Author:     Konstantin Belousov <k...@freebsd.org>
AuthorDate: 2021-07-22 10:27:43 +0000
Commit:     Konstantin Belousov <k...@freebsd.org>
CommitDate: 2021-07-27 16:58:47 +0000

    fifofs: fifo vnode might be relocked before VOP_OPEN() is called
    
    Handle it in fifo_close by checking for v_fifoinfo == NULL
    
    Reported and tested by: pho
    Reviewed by:    markj
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 week
    Differential revision:  https://reviews.freebsd.org/D31310
---
 sys/fs/fifofs/fifo_vnops.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/sys/fs/fifofs/fifo_vnops.c b/sys/fs/fifofs/fifo_vnops.c
index d2a51de84fba..861f1b40a744 100644
--- a/sys/fs/fifofs/fifo_vnops.c
+++ b/sys/fs/fifofs/fifo_vnops.c
@@ -282,9 +282,21 @@ fifo_close(ap)
        struct pipe *cpipe;
 
        vp = ap->a_vp;
+       ASSERT_VOP_ELOCKED(vp, "fifo_close");
        fip = vp->v_fifoinfo;
+
+       /*
+        * During open, it is possible that the fifo vnode is relocked
+        * after the vnode is instantiated but before VOP_OPEN() is
+        * done.  For instance, vn_open_vnode() might need to upgrade
+        * vnode lock, or ffs_vput_pair() needs to unlock vp to sync
+        * dvp.  In this case, reclaim can observe us with v_fifoinfo
+        * equal to NULL.
+        */
+       if (fip == NULL)
+               return (0);
+
        cpipe = fip->fi_pipe;
-       ASSERT_VOP_ELOCKED(vp, "fifo_close");
        if (ap->a_fflag & FREAD) {
                fip->fi_readers--;
                if (fip->fi_readers == 0) {
_______________________________________________
dev-commits-src-main@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main
To unsubscribe, send any mail to "dev-commits-src-main-unsubscr...@freebsd.org"

Reply via email to