#776749 mount.diod: fails to update mtab

Package:
diod
Source:
diod
Description:
I/O forwarding server for 9P
Submitter:
Jan Braun
Date:
2015-02-01 08:27:12 UTC
Severity:
normal
#776749#5
Date:
2015-02-01 08:25:50 UTC
From:
To:
Hello,

Mounting a diod fs always "fails" for me due to inability of writing
mtab:

| $ grep becki /etc/fstab
| HOSTNAME:/media/becki     /media/becki     diod   noauto,rw       0 0
| $ sudo mount /media/becki/ ; echo $?
| mount.diod: failed to add entry to /etc/mtab
| mount.diod: failed to update /etc/mtab
| 1
| $ grep becki /etc/mtab
| HOSTNAME:/media/becki /media/becki 9p rw,sync,dirsync,relatime,aname=/media/becki,uname=root,access=user,trans=fd,msize=65536,version=9p2000.L,debug=1,rwdepth=1,rfdno=4,wfdno=4 0 0
| $

Only the exit code is wrong, the remote fs is actually present and
working. I suspect the reason is that mount.diod does a 9p mount under
the hood, which adds its own mtab entry, and then mount.diod's mtab
update fails because that would produce two entries for the same
mountpoint. Just a guess tho.
Tellingly, the examples in /usr/share/doc/diod/README always
call mount (or diodmount) with the -n (--no-mtab) option.

Note that the exit code is clearly wrong according to mount(8):
| RETURN CODES
| mount has the following return codes (the bits can be ORed):
| 1      incorrect invocation or permissions
| 16     problems writing or locking /etc/mtab

This makes reliably scripting my mounts quite annoying:
I can't give no-mtab as an option in /etc/fstab for just the diod mount.
And if just always mounting _everything_ with --no-mtab is the solution
(since mtab is supposedly a legacy thing), then why isn't ignoring mtab
updates the default anyway?

If somebody can figure out a proper fix, I'll happily try to come up
with a patch. (I can't do the former, since I clearly don't understand
all the implications.)
regards,
    Jan