[Gluster-devel] read/write on directory?

Emmanuel Dreyfus manu at netbsd.org
Thu Nov 10 15:43:03 UTC 2011


While tracking my ENOENT bug, I noticed that running vi while cwd was on
the glusterfs volume produced that:

[2011-11-10 15:56:16.395189] W [read-ahead.c:496:ra_readv]
0-gfs-read-ahead: readv received on fd (0xb8c013fc) with no file set in
its context[2011-11-10 15:56:16.395523] W [page.c:979:__ioc_page_error]
0-gfs-io-cache: page error for page = 0xad814060 & waitq = 0xacf0ec20

I can narrow this down to this test case. Running it while cwd is on the
glusterfs volume produces the warning above, on NetBSD:

#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <err.h>
#include <sysexits.h>

main(void) {
        int fd;
        char buf[1];

        if ((fd = open("./", 0, 0)) == -1)
                err(EX_OSERR, "open failed");

        if (read(fd, buf, sizeof(buf)) == -1)
                err(EX_OSERR, "read failed");

        if (close(fd) == -1)
                err(EX_OSERR, "read failed");

        return 0;

As I understand the problem here is that Linux returns EISDIR when doing
read/write on a directory, while NetBSD tolerates that. I suspect
glusterfs on Linux nevers sees a read on a directory, as this is
rejected by the kernel.

What is the proper fix? Change NetBSD FUSE to catch read/write on
directories and return EISDIR? Or make make sure glusterfs ignores the
operation and returns no data?

Emmanuel Dreyfus
manu at netbsd.org

More information about the Gluster-devel mailing list