glusterfs_open() glusterfs_fstat() bug?

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

 



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
#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);

	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);

}

rob@rob-desktop:~/glfs.src/glusterfs$ cat /etc/issue
Ubuntu 8.10 \n \l

rob@rob-desktop:~/glfs.src/glusterfs$ uname -a
Linux rob-desktop 2.6.27-11-generic #1 SMP Thu Jan 29 19:24:39 UTC 2009 i686 GNU/Linux

rob@rob-desktop:~/glfs.src/glusterfs$ cat /etc/debian_version
lenny/sid
rob@rob-desktop:~$ sudo glusterfsd --debug
2009-03-24 22:57:48 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-24 22:57:48
Command line : glusterfsd --debug
PID          : 5766
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-24 22:57:48 D [spec.y:188:new_section] parser: New node for 'brick'
2009-03-24 22:57:48 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-24 22:57:48 D [spec.y:214:section_type] parser: Type:brick:storage/posix
2009-03-24 22:57:48 D [spec.y:243:section_option] parser: Option:brick:directory:/home/export
2009-03-24 22:57:48 D [spec.y:327:section_end] parser: end:brick
2009-03-24 22:57:48 D [spec.y:188:new_section] parser: New node for 'server'
2009-03-24 22:57:48 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-24 22:57:48 D [spec.y:214:section_type] parser: Type:server:protocol/server
2009-03-24 22:57:48 D [spec.y:243:section_option] parser: Option:server:transport-type:tcp
2009-03-24 22:57:48 D [spec.y:312:section_sub] parser: child:server->brick
2009-03-24 22:57:48 D [spec.y:243:section_option] parser: Option:server:auth.addr.trace.allow:*
2009-03-24 22:57:48 D [spec.y:243:section_option] parser: Option:server:auth.addr.brick.allow:*
2009-03-24 22:57:48 D [spec.y:327:section_end] parser: end:server
2009-03-24 22:57:48 D [glusterfsd.c:1115:main] glusterfs: running in pid 5766
2009-03-24 22:57:48 D [xlator.c:599:xlator_init_rec] brick: Initialization done
2009-03-24 22:57:48 D [transport.c:141:transport_load] transport: attempt to load file /usr/local/lib/glusterfs/2.0.0rc7/transport/socket.so
2009-03-24 22:57:48 D [server-protocol.c:8160:init] server: defaulting limits.transaction-size to 4194304
2009-03-24 22:57:48 N [glusterfsd.c:1134:main] glusterfs: Successfully started



2009-03-24 22:58:07 D [addr.c:174:gf_auth] brick: allowed = "*", received addr = "127.0.0.1"
2009-03-24 22:58:07 N [server-protocol.c:7513:mop_setvolume] server: accepted client from 127.0.0.1:1023
2009-03-24 22:58:07 D [server-protocol.c:7558:mop_setvolume] server: creating inode table with lru_limit=1024, xlator=brick
2009-03-24 22:58:07 D [inode.c:1010:inode_table_new] brick: creating new inode table with lru_limit=1024
2009-03-24 22:58:07 D [inode.c:471:__inode_create] brick/inode: create inode(0)
2009-03-24 22:58:07 D [addr.c:174:gf_auth] brick: allowed = "*", received addr = "127.0.0.1"
2009-03-24 22:58:07 N [server-protocol.c:7513:mop_setvolume] server: accepted client from 127.0.0.1:1022
2009-03-24 22:58:07 D [inode.c:293:__inode_activate] brick/inode: activating inode(1), lru=0/1024 active=1 purge=0
2009-03-24 22:58:07 D [inode.c:471:__inode_create] brick/inode: create inode(0)
2009-03-24 22:58:07 D [inode.c:293:__inode_activate] brick/inode: activating inode(0), lru=0/1024 active=2 purge=0
2009-03-24 22:58:07 D [server-protocol.c:3629:server_lookup_resume] brick: 3: LOOKUP '1/(null)'
2009-03-24 22:58:07 D [inode.c:94:__dentry_hash] brick/inode: dentry hashed  (6643801)
2009-03-24 22:58:07 D [inode.c:312:__inode_passivate] brick/inode: passivating inode(6643801) lru=1/1024 active=1 purge=0
2009-03-24 22:58:07 D [inode.c:293:__inode_activate] brick/inode: activating inode(6643801), lru=0/1024 active=2 purge=0
2009-03-24 22:58:07 D [server-protocol.c:5285:server_opendir_resume] brick: 5: OPENDIR '/ (6643801)'
2009-03-24 22:58:07 D [server-protocol.c:4397:server_flush] brick: 3: FLUSH 'fd=0 (6643801)'
2009-03-24 22:58:07 D [server-protocol.c:5381:server_releasedir] brick: 5: RELEASEDIR 'fd=0 (6643801)'
2009-03-24 22:58:07 D [inode.c:312:__inode_passivate] brick/inode: passivating inode(6643801) lru=1/1024 active=1 purge=0
2009-03-24 22:58:07 D [socket.c:90:__socket_rwv] server: EOF from peer 127.0.0.1:1023
2009-03-24 22:58:07 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-24 22:58:07 N [server-protocol.c:8268:notify] server: 127.0.0.1:1023 disconnected
2009-03-24 22:58:07 D [socket.c:1318:fini] server: transport 0x8c6df38 destroyed
2009-03-24 22:58:07 D [socket.c:90:__socket_rwv] server: EOF from peer 127.0.0.1:1022
2009-03-24 22:58:07 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-24 22:58:07 N [server-protocol.c:8268:notify] server: 127.0.0.1:1022 disconnected
2009-03-24 22:58:07 N [server-helpers.c:530:server_connection_destroy] server: destroyed connection of rob-desktop-6074-2009/03/24-22:58:07:439698-client
2009-03-24 22:58:07 D [socket.c:1318:fini] server: transport 0x8c6e1c8 destroyed
rob@rob-desktop:~/glfs$ sudo ./a.out
[sudo] password for rob:
init errno 115
fd 140808608
open errno 0
fstat ret -1
fstat errno 22
uid 0
inod 0
size 0
close ret 0
close errno 0
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-24 22:58:07 D [spec.y:188:new_section] parser: New node for 'client'
2009-03-24 22:58:07 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-24 22:58:07 D [spec.y:214:section_type] parser: Type:client:protocol/client
2009-03-24 22:58:07 D [spec.y:243:section_option] parser: Option:client:transport-type:tcp
2009-03-24 22:58:07 D [spec.y:243:section_option] parser: Option:client:remote-host:localhost
2009-03-24 22:58:07 D [spec.y:243:section_option] parser: Option:client:remote-subvolume:brick
2009-03-24 22:58:07 D [spec.y:327:section_end] parser: end:client
2009-03-24 22:58:07 D [spec.y:188:new_section] parser: New node for 'trace'
2009-03-24 22:58:07 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-24 22:58:07 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-24 22:58:07 D [spec.y:214:section_type] parser: Type:trace:debug/trace
2009-03-24 22:58:07 D [spec.y:312:section_sub] parser: child:trace->client
2009-03-24 22:58:07 D [spec.y:327:section_end] parser: end:trace
2009-03-24 22:58:07 D [inode.c:1010:inode_table_new] libglusterfsclient: creating new inode table with lru_limit=14057
2009-03-24 22:58:07 D [inode.c:471:__inode_create] libglusterfsclient/inode: create inode(0)
2009-03-24 22:58:07 D [client-protocol.c:6559:init] client: defaulting transport-timeout to 600
2009-03-24 22:58:07 D [client-protocol.c:6570:init] client: defaulting ping-timeout to 10
2009-03-24 22:58:07 D [transport.c:141:transport_load] transport: attempt to load file /usr/local/lib/glusterfs/2.0.0rc7/transport/socket.so
2009-03-24 22:58:07 D [transport.c:141:transport_load] transport: attempt to load file /usr/local/lib/glusterfs/2.0.0rc7/transport/socket.so
2009-03-24 22:58:07 D [xlator.c:599:xlator_init_rec] client: Initialization done
2009-03-24 22:58:07 C [dict.c:1092:data_to_str] dict: @data=(nil)
2009-03-24 22:58:07 C [dict.c:1092:data_to_str] dict: @data=(nil)
2009-03-24 22:58:07 N [client-protocol.c:6159:client_setvolume_cbk] client: connection and handshake succeeded
2009-03-24 22:58:07 N [client-protocol.c:6159:client_setvolume_cbk] client: connection and handshake succeeded
2009-03-24 22:58:07 N [trace.c:1244:trace_lookup] trace: 0: (loc {path=/, ino=0})
2009-03-24 22:58:07 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-24 22:58:07 N [trace.c:1833:trace_opendir] trace: 1:( loc {path=/, ino=6643801}, fd=0x86491a0)
2009-03-24 22:58:07 N [trace.c:684:trace_opendir_cbk] trace: 1: (op_ret=0, op_errno=0, fd=0x86491a0)
2009-03-24 22:58:07 N [trace.c:1712:trace_flush] trace: 2: (*fd=0x86491a0)
2009-03-24 22:58:07 N [trace.c:663:trace_flush_cbk] trace: 2: (op_ret=0, op_errno=0)
2009-03-24 22:58:07 N [trace.c:2261:fini] trace: trace translator unloaded
volume client
 type protocol/client
 option transport-type tcp
 option remote-host localhost
 option remote-subvolume brick
end-volume

volume trace
  type debug/trace
  subvolumes client
end-volume
#commented out trace because there's actually
#less output with trace enabled

volume brick
 type storage/posix
 option directory /home/export
end-volume

#volume trace
#  type debug/trace
#  subvolumes brick
#end-volume

### Add network serving capability to above brick.
volume server
 type protocol/server
 option transport-type tcp
 subvolumes brick
 option auth.addr.trace.allow *
 option auth.addr.brick.allow *
end-volume

#volume trace
#  type debug/trace
#  subvolumes server
#end-volume

[Index of Archives]     [Gluster Users]     [Ceph Users]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux