[Lustre-discuss] Group Lock in Lustre: write call is blocking
pascal.deveze at bull.net
pascal.deveze at bull.net
Mon Mar 16 02:41:20 PDT 2009
Hi,
I have seen the group lock Design at:
http://lists.lustre.org/pipermail/lustre-devel/2006-May/000071.html
I checked the group lock capabilities with the programme
parallel_grouplock.c:
http://lustre.sourcearchive.com/documentation/1.6.5/parallel__grouplock_8c-source.html
This program runs well, but ... it only tests the read function call.
I have a Lustre version 1.6.6, and on this release, the write is blocking
(I have to delete my job). I would like to use the write call.
Here is a little program to reproduce this.
Could anyone tell me if I made a mistake, if Lustre does not support the
group lock or if it is a bug in Lustre ?
Thanks very much for your help.
Best Regards,
P. Devèze
===============================================
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <errno.h>
#include "lustre_user.h"
char *strerror(int errnum);
#define FILEMODE S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH
#define FILENAME "/mnt/fs_mpi/GL"
// Process takes a GROUP_LOCK and writes
// The write call will block ===> WHY ?
int main(int argc, char *argv[]) {
int nb, rc, fd, gid = 1;
if ((fd = open(FILENAME, O_RDWR | O_CREAT, FILEMODE)) == -1) {
printf("Error opening file: %s\n", strerror(errno));
exit(-1);
}
if ((rc = ioctl(fd, LL_IOC_GROUP_LOCK, gid)) == -1) {
printf("Error ioctl GROUP_LOCK on file %d: %s\n", rc,
strerror(errno));
exit(-1);
}
printf("GROUP_LOCK OK, we will write on file\n");
// This write call will block
nb=write(fd, "Hello\n", 6);
if (nb != 6) printf("write: %s\n", strerror(errno));
printf("write done\n");
printf("We will free the lock\n");
if ((rc = ioctl(fd, LL_IOC_GROUP_UNLOCK, gid)) == -1) {
printf("Error ioctl GROUP_UNLOCK on file %d: %s", rc,
strerror(errno));
}
printf("group lock is free\n");
close(fd);
}
=============================================================
More information about the lustre-discuss
mailing list