From: Sage Weil Date: Wed, 4 Jun 2008 19:58:46 +0000 (-0700) Subject: mon: use fcntl F_SETLK instead of flock X-Git-Tag: v0.3~175 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=ae09ad0ef5ffa2c24060d86f6769576ce6c66a8b;p=ceph.git mon: use fcntl F_SETLK instead of flock --- diff --git a/src/mon/MonitorStore.cc b/src/mon/MonitorStore.cc index 950e95809410..8bc16804420e 100644 --- a/src/mon/MonitorStore.cc +++ b/src/mon/MonitorStore.cc @@ -46,7 +46,13 @@ int MonitorStore::mount() lock_fd = ::open(t, O_CREAT|O_RDWR, 0600); if (lock_fd < 0) return -errno; - int r = ::flock(lock_fd, LOCK_EX|LOCK_NB); + struct flock l; + memset(&l, 0, sizeof(l)); + l.l_type = F_WRLCK; + l.l_whence = SEEK_SET; + l.l_start = 0; + l.l_len = 0; + int r = ::fcntl(lock_fd, F_SETLK, &l); if (r < 0) { derr(0) << "failed to lock " << t << ", is another cmon still running?" << dendl; return -errno;