Coda File System

Re: Coda on FreeBSD 9?

From: <u-codalist-tccc_at_aetey.se>
Date: Mon, 16 Jan 2012 15:19:04 +0100
(made a mistake while posting, sorry if you get an extra copy because of this)

Hello Greg,

On Mon, Jan 09, 2012 at 12:53:47PM -0500, Greg Troxel wrote:
> > (BTW there used to be some bad interaction between directory
> > formats in BSD vs Coda vs Linux which caused Linux-ABI programs
> > accessing Coda to only be able to read the first page of
> > a directory. Wonder whether this is the case on NetBSD.
> > I'll see)
> 
> Native coda on netbsd does not have this problem any more.  I think the
> problem was that the coda code that generated directories put them in a
> Linuxy format.
> 
> I am not clear what happens when an emulated Linux binary reads a
> directory.  But I'd expect it be ok assuming native is ok.

Unfortunately neither is ok, even though Linux ABI seems to manage this
a little better.

Testing NetBSD 5.1.1 on i386 with Coda 6.9.5 via pkg_add.

Coda looks working, Linux emulation looks working
(not testing beyond the simplest things like "ls")

Nevertheless, I see the mentioned getdents()/readdir() problem,
where neither the native binaries nor Linux ones get
correct results:

CODADIR=/coda/[a-large-directory-with-binaries]

On a Linux host:
$ ls -ld $CODADIR
dr-xr-xr-x 1 [number] nogroup 57344 2009-12-27 15:06 [value-of-$CODADIR]
$ ls $CODADIR | wc
   1635    1635   15177
$

On NetBSD:
$ ls -ld $CODADIR
dr-xr-xr-x 1 [number] 65534 57344 2009-12-27 15:06 [value-of-$CODADIR]
$

This looks fully correct. But then:

NetBSD, a native ls binary:
$ /bin/ls $CODADIR | /usr/bin/wc
     314     314    2946
$

NetBSD, a Linux ls binary:
$ ls $CODADIR | /usr/bin/wc
ls: reading directory [value-of-$CODADIR]: Invalid argument
    1102    1102   10226
$

A comparison of unsorted output shows that the native binary
reads the beginning of the directory:
$ /bin/ls -f $CODADIR >/tmp/native
$ ls -U $CODADIR >/tmp/linux
ls: reading directory /coda/0i.se/sw/1/T/_ut: Invalid argument
$ cmp /tmp/native /tmp/linux
cmp: EOF on /tmp/native
$

Unfortunately the entries' order in the directory looks different on
my Linux machine so I can not compare which part is missing under Linux
ABI on NetBSD.

Note the error message from the Linux ls on NetBSD.

Note also that file access looks working for all file entries,
despite the directory enumeration being broken:
On NetBSD, with the file list produced on a Linux host:
$ wc /tmp/linux-on-linux 
 1635  1635 15177 /tmp/linux-on-linux
$ for a in `cat /tmp/linux-on-linux`; do
    [ -f "$CODADIR"/"$a" ] || echo MISSING "$a"
  done
$

At Coda accesses the console fills with kernel messages (in green)
"coda_inactive: 0xNNNNNNNN usecount 1"
seemingly once per Coda file being accessed for the first time
(per new cache entry?) I assume this to be just informational.

So I am pleased to discover that NetBSD seems to have
a working Coda client (not tested with any real workload yet though)
but it needs a fix for the directory accesses.

(Internally Coda uses Linux format for the directories, this
may explain why Linux ABI works somewhat "better" in that respect.)

Should I submit a bug report somewhere? Or could you look at it Greg?

Best regards,
Rune
Received on 2012-01-16 09:30:03