[Gluster-devel] 回复:   glfs_creat this method hang up

ABC-new 360532762 at qq.com
Thu Aug 28 06:07:14 UTC 2014


while hang,stack info:


 Program received signal SIGINT, Interrupt.
0x0000003e1380b43c in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
Missing separate debuginfos, use: debuginfo-install glibc-2.12-1.107.el6.x86_64 glusterfs-3.4.0.57rhs-1.el6_5.x86_64 glusterfs-api-3.4.0.57rhs-1.el6_5.x86_64 glusterfs-libs-3.4.0.57rhs-1.el6_5.x86_64 keyutils-libs-1.4-4.el6.x86_64 krb5-libs-1.10.3-10.el6.x86_64 libcom_err-1.41.12-14.el6.x86_64 libselinux-2.0.94-5.3.el6.x86_64 openssl-1.0.1e-16.el6_5.14.x86_64 uuid-1.6.1-10.el6.x86_64 zlib-1.2.3-29.el6.x86_64
(gdb) bt
#0  0x0000003e1380b43c in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1  0x00007ffff7b9903b in syncop_lookup () from /usr/lib64/libglusterfs.so.0
#2  0x00007ffff7ddfd59 in glfs_first_lookup_safe () from /usr/lib64/libgfapi.so.0
#3  0x00007ffff7ddfde7 in __glfs_first_lookup () from /usr/lib64/libgfapi.so.0
#4  0x00007ffff7ddfe66 in __glfs_active_subvol () from /usr/lib64/libgfapi.so.0
#5  0x00007ffff7de010f in glfs_active_subvol () from /usr/lib64/libgfapi.so.0
#6  0x00007ffff7ddd0ff in glfs_creat () from /usr/lib64/libgfapi.so.0
#7  0x00000000004014c2 in main (argc=1, argv=0x7fffffffe6f8) at glfs_example.c:80
thank you.
‍Best Regards,
Lixiaopo





------------------ 原始邮件 ------------------
发件人: "360532762";<360532762 at qq.com>;
发送时间: 2014年8月28日(星期四) 中午1:01
收件人: "Soumya Koduri"<skoduri at redhat.com>; "Pranith Kumar Karampuri"<pkarampu at redhat.com>; 
抄送: "Gluster Devel"<gluster-devel at gluster.org>; 
主题: Re:  [Gluster-devel] glfs_creat this method hang up



Hi~:
Soumya,‍
the glusterfs_example.c is placed in directory /usr/local/glusterfs.
I want to the file name generated by uuid.but now have not to do that yet,the variable filename is hard code.e.g."/2fcdec2e-688c-4077-bf96-4a42963dcffc.MOV‍".
result is ok.


 [root at localhost glusterfs]# pwd
/usr/include/glusterfs
[root at localhost glusterfs]# gcc -o glusterfs_example glusterfs_example.c -lgfapi
[root at localhost glusterfs]# ./glusterfs_example dr 192.168.108.150
glfs_init: returned 0
----/2fcdec2e-688c-4077-bf96-4a42963dcffc.MOV----
/2fcdec2e-688c-4077-bf96-4a42963dcffc.MOV: (0x20241e0) Success
/2fcdec2e-688c-4077-bf96-4a42963dcffc.MOV: (0x20241e0) Structure needs cleaning
read 32, hi there‍ 



keep the source code not changed and then  I add "-luuid" to gcc , compiled result is ok, but while run,hanging occured.


 [root at localhost glusterfs]# gcc -o glusterfs_example glusterfs_example.c -lgfapi -luuid
[root at localhost glusterfs]# ./glusterfs_example dr 192.168.108.151
glfs_init: returned 0
----/2fcdec2e-688c-4077-bf96-4a42963dcffc.MOV----


<------------------------------hanging  here ----------------------------->


 source code :
 #include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include "api/glfs.h"
#include "api/glfs-handles.h"
#include <string.h>
#include <time.h>

int
main (int argc, char *argv[])
{
  glfs_t    *fs2 = NULL;
  int        ret = 0;
  glfs_fd_t *fd = NULL;
  glfs_fd_t *fd2 = NULL;
  char       readbuf[32];
  char       writebuf[32];
  char      *filename = "/2fcdec2e-688c-4077-bf96-4a42963dcffc.MOV";

  if (argc != 3) {
    printf ("Expect following args\n\t%s <volname> <hostname>\n", argv[0]);
    return -1;
  }

  fs2 = glfs_new (argv[1]);
  if (!fs2) {
    fprintf (stderr, "glfs_new: returned NULL\n");
    return 1;
  }
  ret = glfs_set_volfile_server (fs2, "tcp", argv[2], 24007);
  ret = glfs_set_logging (fs2, "/dev/stderr", 1);
  ret = glfs_init (fs2);
  fprintf (stderr, "glfs_init: returned %d\n", ret);

  printf("----%s----\n", filename);
  fd = glfs_creat (fs2, filename, O_RDWR, 0644);
  fprintf (stderr, "%s: (%p) %s\n", filename, fd, strerror (errno));

  fd2 = glfs_open (fs2, filename, O_RDWR);
  fprintf (stderr, "%s: (%p) %s\n", filename, fd, strerror (errno));

  sprintf (writebuf, "hi there\n");
  ret = glfs_write (fd, writebuf, 32, 0);

  glfs_lseek (fd2, 0, SEEK_SET);
  ret = glfs_read (fd2, readbuf, 32, 0);
  printf ("read %d, %s", ret, readbuf);

  glfs_close (fd);
  glfs_close (fd2);

   glfs_fini (fs2);

  return ret;
}‍




Thanks,
Lixiaopo
------------------ Original ------------------
From:  "Soumya Koduri";<skoduri at redhat.com>;
Date:  Wed, Aug 27, 2014 07:42 PM
To:  "Pranith Kumar Karampuri"<pkarampu at redhat.com>; "ABC-new"<360532762 at qq.com>; 
Cc:  "Gluster Devel"<gluster-devel at gluster.org>; 
Subject:  Re: [Gluster-devel] glfs_creat this method hang up



Could you please share your glusterfs_example code and the steps you 
have used to compile it and execute the binary? Would like to check how 
the gfapi header files are linked.

Thanks,
Soumya

On 08/27/2014 03:22 PM, Pranith Kumar Karampuri wrote:
> Guys who work with glfs_*, could you guys reply to this question.
>
> Pranith
> On 08/27/2014 03:16 PM, ABC-new wrote:
>> hi~:
>>
>>        while i run the glusterfs example via libgfapi, gcc -c
>> glusterfs_example -o glfs -luuid
>>        the method glfs_creat hang up.
>>
>>        I want to generate the uuid for file name.
>>
>>
>>    thank you.
>
> _______________________________________________
> Gluster-devel mailing list
> Gluster-devel at gluster.org
> http://supercolony.gluster.org/mailman/listinfo/gluster-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://supercolony.gluster.org/pipermail/gluster-devel/attachments/20140828/0247d537/attachment-0001.html>


More information about the Gluster-devel mailing list