Subject: kern/31479: fifo behaviour on tmpfs
To: None <kern-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: None <m4nb@biff.mail-box.ne.jp>
List: netbsd-bugs
Date: 10/05/2005 05:27:00
>Number:         31479
>Category:       kern
>Synopsis:       fifo behaviour on tmpfs
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Oct 05 05:27:00 +0000 2005
>Originator:     YOMURA Masanori
>Release:        NetBSD 3.99.9
>Organization:
>Environment:
>Description:
mkfifo on tmpfs, and create reader and writer processes.
After the writer closes it, the reader still opens. 

---
[/fs/tmpfs] % mkfifo fifo
[/fs/tmpfs] % echo hello > fifo & cat fifo
[1] 109
hello

---
mfs and ffs works correctly.
[/fs/mfs] % mkfifo fifo
[/fs/mfs] % echo hello > fifo & cat fifo 
[1] 27828
hello
[1]  + Done                          echo hello > fifo
[/fs/mfs] % 

>How-To-Repeat:
above

>Fix:
sys/fs/tmpfs/tmpfs_fifoops.c:
tmpfs_fifo_close(void *v)
{
    struct vnode *vp = ((struct vop_close_args *)v)->a_vp;

    int error;

    error = VOP_UPDATE(vp, NULL, NULL, UPDATE_CLOSE);
    if (error != 0)
        error = VOCALL(fifo_vnodeop_p, VOFFSET(vop_close), v);

    return error;
}

Is this 'if (error != 0)' correct? The tmpfs_update looks return 0 on success (actually always).