Bug 9212

Summary: 9p: Frequent bad file descriptors from u9fs
Product: File System Reporter: Eric Van Hensbergen (ericvh)
Component: v9fsAssignee: Eric Van Hensbergen (ericvh)
Status: CLOSED PATCH_ALREADY_AVAILABLE    
Severity: normal CC: sqweek
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 2.6.22 Subsystem:
Regression: --- Bisected commit-id:

Description Eric Van Hensbergen 2007-10-22 11:03:48 UTC
From: sqweek@gmail.com
 So ever since I actually converted to u9fs on my server, I keep getting:
ls: cannot access /home/sqweek/mail//new: Bad file descriptor
 I have a precmd that checks my maildir every time a prompt is
displayed, and every time it hits problems it seems to be just as I
open a new terminal (and therefore shell, of course) - often enough
because I just got a mail notification so I open a new terminal to
check it.
 Here's what the serverside u9fs log has to say:

<- Twalk tag 0 fid 10 newfid 11 nwname 0
-> Rwalk tag 0 nwqid 0
<- Topen tag 0 fid 11 mode 0
-> Ropen tag 0 qid (0000000000058211 1193059597 d) iounit 0
<- Twalk tag 0 fid 10 newfid 12 nwname 0
-> Rwalk tag 0 nwqid 0
<- Tstat tag 0 fid 12
-> Rstat tag 0  stat 'new' 'sqweek' 'wheel' '' q (0000000000058211
1193059597 d) m 020000000755 at 1193066604 mt 1193059597 l 0 t 0 d 0
<- Tclunk tag 0 fid 12
-> Rclunk tag 0
<- Tread tag 0 fid 11 offset 0 count 8192
-> Rread tag 0 count 0 ''
<- Tclunk tag 0 fid 11
-> Rclunk tag 0
<- Twalk tag 0 fid 9 newfid 11 nwname 0
-> Rwalk tag 0 nwqid 0
<- Tflush tag 1 oldtag 0
-> Rflush tag 1
<- Twalk tag 0 fid 9 newfid 11 nwname 0
-> Rerror tag 0 ename fid already in use
<- Twalk tag 0 fid 10 newfid 11 nwname 0
-> Rerror tag 0 ename fid already in use

 It does appear that fid 11 is attempting to be reused without being
clunked, but I'm *far* from fluent with 9p, so I post it to an
audience that is.
Comment 1 sqweek 2007-10-26 21:14:15 UTC
 Oh, jeeze. I just realised I neglected to mention my bind mounts, which probably qualify as important detail.
 u9fs exports the whole tree, but I really only want a couple of specific directories imported, so I'm mounting to /home/sqweek/n/wren and then binding /home/sqweek/n/wren/home/sqweek/mail to /home/sqweek/mail as well as a couple of other binds. The final mount table looks like this:

192.168.1.86 on /home/sqweek/n/wren type 9p (rw,sync,dirsync,msize=8216,noextend,name=sqweek,aname=,uid=1000,gid=1000)
192.168.1.86 on /www type 9p (rw,sync,dirsync,msize=8216,noextend,name=sqweek,aname=,uid=1000,gid=1000)
192.168.1.86 on /home/sqweek/mail type 9p (rw,sync,dirsync,msize=8216,noextend,name=sqweek,aname=,uid=1000,gid=1000)
192.168.1.86 on /home/sqweek/info type 9p (rw,sync,dirsync,msize=8216,noextend,name=sqweek,aname=,uid=1000,gid=1000)
192.168.1.86 on /home/sqweek/spool type 9p (rw,sync,dirsync,msize=8216,noextend,name=sqweek,aname=,uid=1000,gid=1000)
192.168.1.86 on /home/sqweek/log type 9p (rw,sync,dirsync,msize=8216,noextend,name=sqweek,aname=,uid=1000,gid=1000)
192.168.1.86 on /home/sqweek/bin/share type 9p (rw,sync,dirsync,msize=8216,noextend,name=sqweek,aname=,uid=1000,gid=1000)

 Sorry for not mentioning this earlier.
Comment 2 Eric Van Hensbergen 2008-05-03 08:49:59 UTC
I'm having a difficult time reproducing this configuration. Is there anyway you can present a more simple configuration.

Also - are the bind mounts on the server or the client?

Its hard to derive the configuration from your mount table as it looksl ike you are just mounting the same thing to a bunch of different directories (which I assume is not the case).
Comment 3 sqweek 2008-05-12 04:38:49 UTC
 The binds are on the client. They are the same path on the server (wren=192.168.1.86, "9bind old new" just does a mount(old, new, NULL, MS_BIND, NULL)):

wren=/home/sqweek/n/wren
if srv -a wren 2>/dev/null; then
        9mount -i 'unix!'`namespace`'/wren' $wren && {
                9bind $wren/www /www
                9bind $wren/home/sqweek/mail $HOME/mail
                9bind $wren/home/sqweek/info $HOME/info
                9bind $wren/home/sqweek/spool $HOME/spool
                9bind $wren/home/sqweek/log $HOME/log
                9bind $wren/home/sqweek/bin/share $HOME/bin/share
                9bind $wren/home/sqweek/code $HOME/code
        }
fi

 Note that I haven't seen this problem since upgrading to 2.6.23.
-sqweek
Comment 4 Eric Van Hensbergen 2008-05-12 05:53:37 UTC
Closing sinc eit seems to be fixed post 2.6.23.