gluster-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gluster-devel] glusterfs_open() glusterfs_fstat() glusterfs_readdir


From: Serial Thrilla
Subject: Re: [Gluster-devel] glusterfs_open() glusterfs_fstat() glusterfs_readdir() bug?
Date: Thu, 26 Mar 2009 12:18:07 -0700
User-agent: Thunderbird 2.0.0.21 (Windows/20090302)

Thanks! That patch fixes the glusterfs_fstat() call.
Unfortunately, glusterfs_readdir() wasn't fixed.

Attached is the new code, output, and logs. At the moment there are no entries in /home/export/ so I'm not sure why it is returning "f" and then another return with no name.

I had an issue before with 3 entries in /home/export (test, test2, test3). It was returning 4 items from glusterfs_readdir() and they were all one letter names like "P", "[".

The "count" parameter for glusterfs_readdir() doesn't appear to be used so I made it 0 for now. Changing it to other values has no effect.


Thanks
Rob


Shehjar Tikoo wrote:
Hi

Thanks for the report. The attached patch should fix this problem
for rc7. The test program, glfs.c, works fine for me with this
patch applied while using the volfiles supplied. Could you please
confirm if this works for your setup?

Thanks
Shehjar

Serial Thrilla wrote:
Hey all, attached are the code and output of server and client.

*Please be aware that the server and client run on the same machine*

glusterfs_open() will return a file descriptor but glusterfs_fstat()
 returns -1 for that descriptor.

Is it normal for the file descriptor to change on each call to glusterfs_open() despite the same parameters?

Also, I was having issues with glusterfs_readdir() but that wasn't working either so I suspect there's an issue with the descriptor.

Please let me know if you need any more info.

Attn core developers: Please let me know if you would like access to my dev box and I'll be happy to provide it.

Thanks Rob


------------------------------------------------------------------------



_______________________________________________ Gluster-devel mailing
list address@hidden http://lists.nongnu.org/mailman/listinfo/gluster-devel


------------------------------------------------------------------------


No virus found in this incoming message.
Checked by AVG - www.avg.com Version: 8.0.238 / Virus Database: 270.11.29/2024 - Release Date: 03/26/09 07:12:00

address@hidden:~/glfs$ sudo ./a.out
init errno 115
fd 138863008
open errno 0
fstat ret 0
fstat errno 0
uid 1000
inod 0
size 4096
readdir errno 0
readdir ret 1
name f
reclen 26031
readdir errno 0
readdir ret 1
name
reclen 65535
readdir errno 0
readdir ret 0
close ret 0
close errno 0
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <libglusterfsclient.h>

int main (int argc, char *argv[]) {

        /* ==== init ==== */

        glusterfs_init_ctx_t ctx;

    memset (&ctx, 0, sizeof (ctx));

    ctx.specfile = "/usr/local/etc/glusterfs/glusterfs.vol";
    ctx.logfile = "/tmp/glfs_log";
    ctx.loglevel = "debug";
    ctx.lookup_timeout = ctx.stat_timeout = 600;

        libglusterfs_handle_t client_context;

        errno = 0;

        client_context = glusterfs_init(&ctx);

        printf("init errno %d\n", errno);

        /* ==== open ==== */

        int ret = 0;
        unsigned long fd = 0;
        char *path = "/";
        int flags = O_RDONLY;
        mode_t mode = 0;

        errno = 0;

        fd = glusterfs_open(client_context, path, flags, mode);

        printf("fd %lu\n", fd);
        printf("open errno %d\n", errno);

        struct stat statbuf;

        memset (&statbuf, 0, sizeof (statbuf));

        ret = glusterfs_fstat(fd, &statbuf);

        printf("fstat ret %d\n", ret);
        printf("fstat errno %d\n", errno);
        printf("uid %u\n", statbuf.st_uid);
        printf("inod %lu\n", statbuf.st_ino);
        printf("size %ld\n", statbuf.st_size);

        /* ==== readdir ==== */

        if(fd > 0) {
                struct dirent *dirp;
                /*unsigned int count = sizeof(struct dirent);*/
                unsigned int count = 0;

                do {
                        errno = 0;
                        dirp = (struct dirent *) calloc(1, sizeof(struct 
dirent));

                        ret = glusterfs_readdir(fd, dirp, count);

                        printf("readdir errno %d\n", errno);
                        printf("readdir ret %d\n", ret);

                        if(ret <= 0) {
                                break;
                        }

                        printf("name %s\n", dirp->d_name);
                        printf("reclen %hu\n", dirp->d_reclen);


                } while(1);
    }

        errno = 0;

        ret = glusterfs_close(fd);

        printf("close ret %d\n", ret);
        printf("close errno %d\n", errno);

        /* ===== end ===== */

        glusterfs_fini(client_context);

        client_context = 0;

        exit(EXIT_SUCCESS);

}

address@hidden:~/glusterfs-2.0.0rc7$ sudo glusterfsd --debug
[sudo] password for rob:
2009-03-26 12:16:07 D [glusterfsd.c:335:_get_specfp] glusterfs: loading volume 
file /usr/local/etc/glusterfs/glusterfsd.vol
================================================================================
Version      : glusterfs 2.0.0rc7 built on Mar 24 2009 15:56:32
TLA Revision : 4e5c297d7c3480d0d3ab1c0c2a184c6a4fb801ef
Starting Time: 2009-03-26 12:16:07
Command line : glusterfsd --debug
PID          : 11897
System name  : Linux
Nodename     : rob-desktop
Kernel Release : 2.6.27-11-generic
Hardware Identifier: i686

Given volfile:
+------------------------------------------------------------------------------+
  1: volume brick
  2:  type storage/posix
  3:  option directory /home/export
  4: end-volume
  5:
  6: #volume trace
  7: #  type debug/trace
  8: #  subvolumes brick
  9: #end-volume
 10:
 11: ### Add network serving capability to above brick.
 12: volume server
 13:  type protocol/server
 14:  option transport-type tcp
 15:  subvolumes brick
 16:  option auth.addr.trace.allow *
 17:  option auth.addr.brick.allow *
 18: end-volume
 19:
 20: #volume trace
 21: #  type debug/trace
 22: #  subvolumes server
 23: #end-volume

+------------------------------------------------------------------------------+
2009-03-26 12:16:07 D [spec.y:188:new_section] parser: New node for 'brick'
2009-03-26 12:16:07 D [xlator.c:469:xlator_set_type] xlator: attempt to load 
file /usr/local/lib/glusterfs/2.0.0rc7/xlator/storage/posix.so
2009-03-26 12:16:07 D [spec.y:214:section_type] parser: Type:brick:storage/posix
2009-03-26 12:16:07 D [spec.y:243:section_option] parser: 
Option:brick:directory:/home/export
2009-03-26 12:16:07 D [spec.y:327:section_end] parser: end:brick
2009-03-26 12:16:07 D [spec.y:188:new_section] parser: New node for 'server'
2009-03-26 12:16:07 D [xlator.c:469:xlator_set_type] xlator: attempt to load 
file /usr/local/lib/glusterfs/2.0.0rc7/xlator/protocol/server.so
2009-03-26 12:16:07 D [spec.y:214:section_type] parser: 
Type:server:protocol/server
2009-03-26 12:16:07 D [spec.y:243:section_option] parser: 
Option:server:transport-type:tcp
2009-03-26 12:16:07 D [spec.y:312:section_sub] parser: child:server->brick
2009-03-26 12:16:07 D [spec.y:243:section_option] parser: 
Option:server:auth.addr.trace.allow:*
2009-03-26 12:16:07 D [spec.y:243:section_option] parser: 
Option:server:auth.addr.brick.allow:*
2009-03-26 12:16:07 D [spec.y:327:section_end] parser: end:server
2009-03-26 12:16:07 D [glusterfsd.c:1115:main] glusterfs: running in pid 11897
2009-03-26 12:16:07 D [xlator.c:599:xlator_init_rec] brick: Initialization done
2009-03-26 12:16:07 D [transport.c:141:transport_load] transport: attempt to 
load file /usr/local/lib/glusterfs/2.0.0rc7/transport/socket.so
2009-03-26 12:16:07 D [server-protocol.c:8160:init] server: defaulting 
limits.transaction-size to 4194304
2009-03-26 12:16:07 N [glusterfsd.c:1134:main] glusterfs: Successfully started

2009-03-26 12:16:35 D [addr.c:174:gf_auth] brick: allowed = "*", received addr 
= "127.0.0.1"
2009-03-26 12:16:35 N [server-protocol.c:7513:mop_setvolume] server: accepted 
client from 127.0.0.1:1023
2009-03-26 12:16:35 D [server-protocol.c:7558:mop_setvolume] server: creating 
inode table with lru_limit=1024, xlator=brick
2009-03-26 12:16:35 D [inode.c:1010:inode_table_new] brick: creating new inode 
table with lru_limit=1024
2009-03-26 12:16:35 D [inode.c:471:__inode_create] brick/inode: create inode(0)
2009-03-26 12:16:35 D [addr.c:174:gf_auth] brick: allowed = "*", received addr 
= "127.0.0.1"
2009-03-26 12:16:35 N [server-protocol.c:7513:mop_setvolume] server: accepted 
client from 127.0.0.1:1022
2009-03-26 12:16:35 D [inode.c:293:__inode_activate] brick/inode: activating 
inode(1), lru=0/1024 active=1 purge=0
2009-03-26 12:16:35 D [inode.c:471:__inode_create] brick/inode: create inode(0)
2009-03-26 12:16:35 D [inode.c:293:__inode_activate] brick/inode: activating 
inode(0), lru=0/1024 active=2 purge=0
2009-03-26 12:16:35 D [server-protocol.c:3629:server_lookup_resume] brick: 3: 
LOOKUP '1/(null)'
2009-03-26 12:16:35 D [inode.c:94:__dentry_hash] brick/inode: dentry hashed  
(6643801)
2009-03-26 12:16:35 D [inode.c:312:__inode_passivate] brick/inode: passivating 
inode(6643801) lru=1/1024 active=1 purge=0
2009-03-26 12:16:35 D [inode.c:293:__inode_activate] brick/inode: activating 
inode(6643801), lru=0/1024 active=2 purge=0
2009-03-26 12:16:35 D [server-protocol.c:5285:server_opendir_resume] brick: 5: 
OPENDIR '/ (6643801)'
2009-03-26 12:16:35 D [server-protocol.c:5503:server_readdir] brick: 6: READDIR 
'fd=0 (6643801); offset=0; size=276
2009-03-26 12:16:35 D [server-protocol.c:5503:server_readdir] brick: 7: READDIR 
'fd=0 (6643801); offset=1720739247; size=276
2009-03-26 12:16:35 D [server-protocol.c:5503:server_readdir] brick: 8: READDIR 
'fd=0 (6643801); offset=2147483647; size=276
2009-03-26 12:16:35 D [server-protocol.c:1075:server_readdir_cbk] server: 8: 
READDIR 0 (6643801) ==> 0 (Success)
2009-03-26 12:16:35 D [server-protocol.c:4397:server_flush] brick: 3: FLUSH 
'fd=0 (6643801)'
2009-03-26 12:16:35 D [server-protocol.c:5381:server_releasedir] brick: 5: 
RELEASEDIR 'fd=0 (6643801)'
2009-03-26 12:16:35 D [inode.c:312:__inode_passivate] brick/inode: passivating 
inode(6643801) lru=1/1024 active=1 purge=0
2009-03-26 12:16:35 D [socket.c:90:__socket_rwv] server: EOF from peer 
127.0.0.1:1023
2009-03-26 12:16:35 D [socket.c:561:__socket_proto_state_machine] server: read 
(Transport endpoint is not connected) in state 1 (127.0.0.1:1023)
2009-03-26 12:16:35 N [server-protocol.c:8268:notify] server: 127.0.0.1:1023 
disconnected
2009-03-26 12:16:35 D [socket.c:1318:fini] server: transport 0x9070f38 destroyed
2009-03-26 12:16:35 D [socket.c:90:__socket_rwv] server: EOF from peer 
127.0.0.1:1022
2009-03-26 12:16:35 D [socket.c:561:__socket_proto_state_machine] server: read 
(Transport endpoint is not connected) in state 1 (127.0.0.1:1022)
2009-03-26 12:16:35 N [server-protocol.c:8268:notify] server: 127.0.0.1:1022 
disconnected
2009-03-26 12:16:35 N [server-helpers.c:530:server_connection_destroy] server: 
destroyed connection of rob-desktop-12453-2009/03/26-12:16:35:450910-client
2009-03-26 12:16:35 D [socket.c:1318:fini] server: transport 0x90711c8 destroyed
Given volfile:
+------------------------------------------------------------------------------+
  1: volume client
  2:  type protocol/client
  3:  option transport-type tcp
  4:  option remote-host localhost
  5:  option remote-subvolume brick
  6: end-volume
  7:
  8: volume trace
  9:   type debug/trace
 10:   subvolumes client
 11: end-volume

+------------------------------------------------------------------------------+
2009-03-26 12:16:35 D [spec.y:188:new_section] parser: New node for 'client'
2009-03-26 12:16:35 D [xlator.c:469:xlator_set_type] xlator: attempt to load 
file /usr/local/lib/glusterfs/2.0.0rc7/xlator/protocol/client.so
2009-03-26 12:16:35 D [spec.y:214:section_type] parser: 
Type:client:protocol/client
2009-03-26 12:16:35 D [spec.y:243:section_option] parser: 
Option:client:transport-type:tcp
2009-03-26 12:16:35 D [spec.y:243:section_option] parser: 
Option:client:remote-host:localhost
2009-03-26 12:16:35 D [spec.y:243:section_option] parser: 
Option:client:remote-subvolume:brick
2009-03-26 12:16:35 D [spec.y:327:section_end] parser: end:client
2009-03-26 12:16:35 D [spec.y:188:new_section] parser: New node for 'trace'
2009-03-26 12:16:35 D [xlator.c:469:xlator_set_type] xlator: attempt to load 
file /usr/local/lib/glusterfs/2.0.0rc7/xlator/debug/trace.so
2009-03-26 12:16:35 D [xlator.c:509:xlator_set_type] xlator: dlsym(notify) on 
/usr/local/lib/glusterfs/2.0.0rc7/xlator/debug/trace.so: undefined symbol: 
notify -- neglecting
2009-03-26 12:16:35 D [spec.y:214:section_type] parser: Type:trace:debug/trace
2009-03-26 12:16:35 D [spec.y:312:section_sub] parser: child:trace->client
2009-03-26 12:16:35 D [spec.y:327:section_end] parser: end:trace
2009-03-26 12:16:35 D [inode.c:1010:inode_table_new] libglusterfsclient: 
creating new inode table with lru_limit=14057
2009-03-26 12:16:35 D [inode.c:471:__inode_create] libglusterfsclient/inode: 
create inode(0)
2009-03-26 12:16:35 D [client-protocol.c:6559:init] client: defaulting 
transport-timeout to 600
2009-03-26 12:16:35 D [client-protocol.c:6570:init] client: defaulting 
ping-timeout to 10
2009-03-26 12:16:35 D [transport.c:141:transport_load] transport: attempt to 
load file /usr/local/lib/glusterfs/2.0.0rc7/transport/socket.so
2009-03-26 12:16:35 D [transport.c:141:transport_load] transport: attempt to 
load file /usr/local/lib/glusterfs/2.0.0rc7/transport/socket.so
2009-03-26 12:16:35 D [xlator.c:599:xlator_init_rec] client: Initialization done
2009-03-26 12:16:35 C [dict.c:1092:data_to_str] dict: @data=(nil)
2009-03-26 12:16:35 C [dict.c:1092:data_to_str] dict: @data=(nil)
2009-03-26 12:16:35 N [client-protocol.c:6159:client_setvolume_cbk] client: 
connection and handshake succeeded
2009-03-26 12:16:35 N [client-protocol.c:6159:client_setvolume_cbk] client: 
connection and handshake succeeded
2009-03-26 12:16:35 N [trace.c:1244:trace_lookup] trace: 0: (loc {path=/, 
ino=0})
2009-03-26 12:16:35 N [trace.c:512:trace_lookup_cbk] trace: 0: (op_ret=0, 
ino=0, *buf {st_dev=2049, st_ino=6643801, st_mode=40755, st_nlink=2, 
st_uid=1000, st_gid=1000, st_rdev=0, st_size=4096, st_blksize=4096, 
st_blocks=8})
2009-03-26 12:16:35 N [trace.c:1833:trace_opendir] trace: 1:( loc {path=/, 
ino=6643801}, fd=0xb6c004f0)
2009-03-26 12:16:35 N [trace.c:684:trace_opendir_cbk] trace: 1: (op_ret=0, 
op_errno=0, fd=0xb6c004f0)
2009-03-26 12:16:35 N [trace.c:1885:trace_readdir] trace: 2: (fd=0xb6c004f0, 
size=276, offset=0)
2009-03-26 12:16:35 N [trace.c:271:trace_readdir_cbk] trace: 2 :(op_ret=2, 
op_errno=0)
2009-03-26 12:16:35 N [trace.c:1885:trace_readdir] trace: 3: (fd=0xb6c004f0, 
size=276, offset=1720739247)
2009-03-26 12:16:35 N [trace.c:271:trace_readdir_cbk] trace: 3 :(op_ret=1, 
op_errno=0)
2009-03-26 12:16:35 N [trace.c:1885:trace_readdir] trace: 4: (fd=0xb6c004f0, 
size=276, offset=2147483647)
2009-03-26 12:16:35 N [trace.c:271:trace_readdir_cbk] trace: 4 :(op_ret=0, 
op_errno=0)
2009-03-26 12:16:35 N [trace.c:1712:trace_flush] trace: 5: (*fd=0xb6c004f0)
2009-03-26 12:16:35 N [trace.c:663:trace_flush_cbk] trace: 5: (op_ret=0, 
op_errno=0)
2009-03-26 12:16:35 N [trace.c:2261:fini] trace: trace translator unloaded


reply via email to

[Prev in Thread] Current Thread [Next in Thread]