Re: All (?) gconf apps hang at startup.

Erik Gustavsson <cyrano algonet se> writes:

> On 25 Oct 2001, Havoc Pennington wrote:
> > 
> > Can you strace -f, or just do "strace gconfd-1", so we can see what
> > the daemon is up to?
> I have included the full output of "strace -f eog" as an attachment.
> It's gzipped, because that reduced the size by a factor of ten.

So here is gconfd-1 trying to get the lock:
  [pid  6675] fcntl64(6, F_SETLK, {type=F_WRLCK, whence=SEEK_SET, start=0, len=0} <unfinished ...>

This is _blocking_ - weird, not supposed to happen. 

> > Any chance you have an NFS-mounted home directory?
> > 
> I do...  Never caused any problems before, but come to think of it, I did
> switch to using NFSv3 enabled kernels on both server and client a few
> weeks ago. 

So what will happen is that you need rpc.statd running on the NFS
client, and rpc.lockd on the server, and they interact to make fcntl()
locking work over NFS. This does work fine if everything is set up
properly; it's a standard part of NFS. My home dir is on NFS and
works, for example.

However, apparently it was broken in Linux in fairly recent
memory. So maybe you are seeing that, or maybe just a local issue.

A typical symptom of broken rpc.statd is that fcntl() in the strace
fails with ENOLCK - Alex saw that yesterday after fooling around with
xinetd or portmapper or something. I haven't seen it block, though.

I'd suspect some bug in NFS on client or server side. I don't really
know enough about NFS internals to speculate on what the bug might be.

I'll append a small program you can use to test whether locking is
working, if it works with this and not gconfd we should investigate
gconf more, if this small program doesn't work for you then it's an
operating system issue that needs resolving on that level. If nothing
else this little program is a good test case when reporting a bug to
the OS vendor. Compile with "cc -Wall -g -O2 lockit.c -o lockit" or


#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <string.h>

/* Your basic Stevens cut-and-paste */
static int
lock_reg (int fd, int cmd, int type, off_t offset, int whence, off_t
  struct flock lock;

  lock.l_type = type; /* F_RDLCK, F_WRLCK, F_UNLCK */
  lock.l_start = offset; /* byte offset relative to whence */
  lock.l_whence = whence; /* SEEK_SET, SEEK_CUR, SEEK_END */
  lock.l_len = len; /* #bytes, 0 for eof */

  return fcntl (fd, cmd, &lock);

#define lock_entire_file(fd) \
  lock_reg ((fd), F_SETLK, F_WRLCK, 0, SEEK_SET, 0)
#define unlock_entire_file(fd) \
  lock_reg ((fd), F_SETLK, F_UNLCK, 0, SEEK_SET, 0)

main (int argc, char **argv)
  int result;
  int fd;

  if (argc != 2)
      fprintf (stderr, "Must pass in a single file to lock\n");
      return 1;

  fd = open (argv[1], O_RDWR);
  if (fd < 0)
      fprintf (stderr, "Failed to open '%s': %s\n", 
               argv[1], strerror (errno));
      return 1;

  result = lock_entire_file (fd);

  if (result < 0)
      fprintf (stderr, "Failed to lock '%s': %s\n",
               argv[1], strerror (errno));
      return 1;

  printf ("Successfully locked '%s', unlocking and exiting\n",

  close (fd);
  return 0;

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