linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bernd Petrovitsch <bernd@sysprog.at>
To: linux-nfs@vger.kernel.org
Subject: Debugging fcntl() file locks
Date: Thu, 27 May 2010 12:11:00 +0200	[thread overview]
Message-ID: <1274955060.14002.40.camel@thorin> (raw)

Hi all!

How can I debug fcntl() file locks on a NFSv3-client?
The server side is a NetApp-Box (no details at hand but I can ask).
The client side are stock-RHEL5.3/CentOS-5.3 kernels - 2.6.18-92.el5.

The file system in question is mounted on 2 clients. flock() on a file
succeeds but fcntl() fails with EAGAIN. From what I found in the
Internet and manual pages, this means that someone else already locked
that file (- the file is successfully open()ed read/write so it can't be
"your are not allowed to write-lock the file").
But how do I find out on which host and which process?

strace shows:
----  snip  ----
open("/... secret ...", O_RDWR) = 3
ioctl(3, SNDCTL_TMR_TIMEBASE or TCGETS, 0x7fff7925b400) = -1 ENOTTY (Inappropriate ioctl for device)
lseek(3, 0, SEEK_CUR)                   = 0
fstat(3, {st_mode=S_IFREG|0600, st_size=935, ...}) = 0
fcntl(3, F_SETFD, FD_CLOEXEC)           = 0
flock(3, LOCK_EX|LOCK_NB)               = 0
fcntl(3, F_SETLK, {type=F_WRLCK, whence=SEEK_SET, start=0, len=0}) = -1 EAGAIN (Resource temporarily unavailable)
----  snip  ---- 
[ This is a perl script using CPAN modules at the top. ]

/proc/mounts shows 
----  snip  ---- 
rw,nodiratime,vers=3,rsize=32768,wsize=32768,hard,proto=tcp,timeo=600,retrans=2,sec=sys,addr=<ip-address>
----  snip  ---- 
as options for the filesystem.

Thanks in advance,
	Bernd
-- 
mobile: +43 664 4416156              http://www.sysprog.at/
    Linux Software Development, Consulting and Services


             reply	other threads:[~2010-05-27 11:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-27 10:11 Bernd Petrovitsch [this message]
2010-05-27 12:34 ` Debugging fcntl() file locks Trond Myklebust
2010-05-27 13:46   ` Bernd Petrovitsch
2010-05-27 14:18     ` Trond Myklebust
2010-05-28  9:36       ` Bernd Petrovitsch

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1274955060.14002.40.camel@thorin \
    --to=bernd@sysprog.at \
    --cc=linux-nfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).