gluster-devel
[Top][All Lists]
Advanced

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

[Gluster-devel] Problems with flock functionality with fuse-2.7.0-gls3 a


From: Harris Landgarten
Subject: [Gluster-devel] Problems with flock functionality with fuse-2.7.0-gls3 and tls 450
Date: Thu, 9 Aug 2007 22:13:03 -0400 (EDT)

I ran the following ruby program named testlock.rb:

#!/usr/bin/ruby

class File
  def File.open_locked(*args)
    File.open(*args) do |f|
      begin
        f.flock(File::LOCK_EX)
        result = yield f
      ensure
        f.flock(File::LOCK_UN)
        return result
      end
    end
  end
end

file = ARGV.shift || "./testlockfile"
delay = ARGV.shift || 10
hostname = `hostname`
hostname.chomp!
puts "opening #{file} and locking"
File.open_locked(file, "w"){ |f| f.puts "test"; puts "#{Time.now} : locking 
file"; sleep delay.to_i; f.puts "finished" }
puts "#{file} #{hostname} end #{Time.now}"
puts "#{file} #{hostname} unlocked"

When run on the local file system as:

$ ruby ./testlock.rb testfile 60

I ran another instance on the same client and it blocked until the first 
instance released the LOCK_EX and then completed.

The same test was run on gluster as:

$ ruby ./testlock.rb /mnt/glusterfs/testfile 60

When another instance was started:

$ ruby ./testlock.rb /mnt/glusterfs/test/testfile
opening /mnt/glusterfs/test/testfile and locking
./testlock.rb:6:in `initialize': No such file or directory - 
/mnt/glusterfs/test/testfile (Errno::ENOENT)
        from ./testlock.rb:6:in `open'
        from ./testlock.rb:6:in `open_locked'
        from ./testlock.rb:24

Glusterfs is reporting the LOCK_EX file as ENOENT when another LOCK_EX is 
requested instead of blocking.

Harris




reply via email to

[Prev in Thread] Current Thread [Next in Thread]