DLM: dlm_query_wait()

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

 



While playing with DLM I modified the code in dlmtest.c to use
dlm_query_wait, however it seems to always return EINPROG status. There is a
comment in dlmtest.c:query_lock  indicating that the synch version does not
exist. Is this a bug or am I missing something (I can certainly get away
with the async routine, which works)?
	Thanks, 
	Mike

---------------------------------------------------------------
Here is the code with the comment:
---------------------------------------------------------------
"

    status = dlm_query(&lksb,
         DLM_QUERY_QUEUE_ALL | DLM_QUERY_LOCKS_ALL,
         &qinfo,
         query_ast_routine,
         &lksb);
    if (status)
 perror("Query failed");
    else
 sleep(1); /* Just to allow the result to come back. There isn't
       a synchronous version of this call */

"

---------------------------------------------------------------
Here is the modified code:
---------------------------------------------------------------
static int query_lock(int lockid)
{
    int status;

    lksb.sb_lkid = lockid;
    qinfo.gqi_resinfo = &resinfo;
    qinfo.gqi_lockinfo = malloc(sizeof(struct dlm_lockinfo) *
MAX_QUERY_LOCKS);
    qinfo.gqi_locksize = MAX_QUERY_LOCKS;
    lksb.sb_lvbptr = (char *)&qinfo;

    status = dlm_query_wait(&lksb,
                            DLM_QUERY_QUEUE_ALL | DLM_QUERY_LOCKS_ALL,
                            &qinfo);
    if (status)
	   perror("Query failed");
    else
    {
         if (lksb.sb_status)
         {
              printf("Query failed: sb_status: %d (0x%08x)\n",
lksb.sb_status, lksb.sb_status);
		  return status;
         }
         query_ast_routine(&lksb);
    }

    return status;
}

--
Linux-cluster mailing list
Linux-cluster@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/linux-cluster

[Index of Archives]     [Corosync Cluster Engine]     [GFS]     [Linux Virtualization]     [Centos Virtualization]     [Centos]     [Linux RAID]     [Fedora Users]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite Camping]

  Powered by Linux