[Linux-cluster] lock issue with gfs and gfs2
Steven Whitehouse
swhiteho at redhat.com
Wed Oct 15 07:15:27 UTC 2008
Hi,
Please file a bug at bugzilla.redhat.com,
Steve.
On Tue, 2008-10-14 at 21:33 -0700, Vipin Sharma wrote:
> Hi,
>
> Let me try to explain my issue with gfs/gfs2 filesystem. I have two
> node cluster and a shared gfs filesystem which is mounted on both the
> nodes at the same time. I can access the filesystem from both nodes.
> 1. From node A I put a lock on a file called testfile and tried to put
> the lock on testfile from node B. I get message, file is already
> locked, which is good since file is locked from ndoe A.
> 2. Now unmount the filesystem on node B while lock is still there on
> testfile from node A and mount it back. Now try to put lock on the
> testfile from node B which is locked from node A. Expected result
> would be not to succeed in puting lock from node B, but "NO" I am able
> to put the lock from node B.
> 3. Node B does not know that there is some lock on testfile form node
> A but now if you release the lock from node A and put it again and
> then try to put lock on testfile from node B it works as expected
> means you will not be able to put lock on testfile. It says file is
> already locked.
>
> It does not make any difference if I use gfs or gfs2 test works same
> way I tried on Oracle enterprise linux 5.1 and 5.2, which is nothing
> but redhat. Also node A or node B test results are same.
>
> I have lock file which is compiled one but the following program also
> works the same way.
> ===========================================================================
> /*
> ** lockdemo.c -- shows off your system's file locking. Rated R.
> */
>
> #include <stdio.h>
> #include <stdlib.h>
> #include <errno.h>
> #include <fcntl.h>
> #include <unistd.h>
>
> int main(int argc, char *argv[])
> {
> /* l_type l_whence l_start l_len l_pid */
> struct flock fl = { F_WRLCK, SEEK_SET, 0, 0, 0 };
> int fd;
>
> fl.l_pid = getpid();
>
> if (argc > 1)
> fl.l_type = F_RDLCK;
>
> if ((fd = open("lockdemo.c", O_RDWR)) == -1) {
> perror("open");
> exit(1);
> }
>
> printf("Press <RETURN> to try to get lock: ");
> getchar();
> printf("Trying to get lock...");
>
> if (fcntl(fd, F_SETLKW, &fl) == -1) {
> perror("fcntl");
> exit(1);
> }
>
> printf("got lock\n");
> printf("Press <RETURN> to release lock: ");
> getchar();
>
> fl.l_type = F_UNLCK; /* set to unlock same region */
>
> if (fcntl(fd, F_SETLK, &fl) == -1) {
> perror("fcntl");
> exit(1);
> }
>
> printf("Unlocked.\n");
>
> close(fd);
> }
>
> =============================================================================
>
> I will be happy to provide more details as requested.
>
> TIA
> vip
>
>
> --
> Linux-cluster mailing list
> Linux-cluster at redhat.com
> https://www.redhat.com/mailman/listinfo/linux-cluster
More information about the Linux-cluster
mailing list