[OmniOS-discuss] flock from RHEL7 client to OmniOS

Derek Yarnell derek at umiacs.umd.edu
Sun Jun 29 03:33:25 UTC 2014


On 6/28/14, 10:29 PM, Paul B. Henson wrote:
> On Sat, Jun 28, 2014 at 10:40:06AM -0400, Derek Yarnell wrote:
>> Is anyone else seeing a problem with flock over NFS on more recent
>> clients including RHEL7 (I am guessing recent fedora releases too)?
> 
> Hmm, historically flock was not NFS compatible, you were supposed to use
> lockf or fcntl. I don't have an RHEL7 box at the moment, but the man
> page for flock(2) on an RHEL6 box says:
> 
>        flock()  does not lock files over NFS.  Use fcntl(2) instead: that does
>        work over NFS, given a sufficiently  recent  version  of  Linux  and  a
>        server which supports locking.
> 

Well my problem is that createrepo uses it for whatever reason

open("/fs/UMyumrepos/rhel7/stable/repodata/locktest",
O_WRONLY|O_CREAT|O_TRUNC, 0666) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
flock(3, LOCK_EX)                       = -1 ENOLCK (No locks available)
write(2, "Could not create exclusive lock "..., 155Could not create
exclusive lock in /fs/UMyumrepos/rhel7/stable/repodata and sqlite
database generation enabled. Is this path on nfs? Is your lockd
running?) = 155
write(2, "\n", 1
)                       = 1
close(3)                                = 0

The code is really calling flock it seems.  I am guessing that there is
some good reasons this is working on some NFS implementations and not
others, interesting that it works on Nexenta 3.x.  I guess I will start
up a support ticket for this with Red Hat.

/usr/lib/python2.7/site-packages/createrepo/__init__.py:
if self.conf.database:
            # do flock test on temp_final, temp_output
            # if it fails raise MDError
            for direc in [temp_final, temp_output]:
                f = open(direc + '/locktest', 'w')
                try:
                    fcntl.flock(f.fileno(), fcntl.LOCK_EX)
                except (OSError, IOError), e:
                    raise MDError, _("Could not create exclusive lock in
%s and sqlite database generation enabled. Is this path on nfs? Is your
lockd running?") % direc
                else:
                    os.unlink(direc + '/locktest')


-- 
Derek T. Yarnell
University of Maryland
Institute for Advanced Computer Studies


More information about the OmniOS-discuss mailing list