zsh-workers
 help / color / mirror / code / Atom feed
From: Vincent Lefevre <vincent@vinc17.org>
To: martin f krafft <madduck@debian.org>,
	482525@bugs.debian.org, zsh-workers@sunsite.dk
Subject: Re: Bug#482525: failure to fcntl-lock history file, takes ages to create interactive session
Date: Sat, 24 May 2008 00:30:34 +0200	[thread overview]
Message-ID: <20080523223034.GM7056@prunille.vinc17.org> (raw)
In-Reply-To: <20080523132408.GA8806@scru.org>

[-- Attachment #1: Type: text/plain, Size: 992 bytes --]

On 2008-05-23 13:24:08 +0000, Clint Adams wrote:
> On Fri, May 23, 2008 at 11:46:36AM +0200, martin f krafft wrote:
> > This repeats a number of times before it finally moves on. Complete
> > strace is attached. Search for "EIO".
> 
> Out of curiosity, does the same thing happen if you use -o nolock on
> the client?

Don't you mean -o nohistfcntllock?

I've attached a small program to test whether fcntl lock is working.

Usage: tfcntl <file> <sleeptime>

It will lock the file <file> for <sleeptime> seconds. You can execute
it with <sleeptime> = 1. If you don't get the prompt after 1 second,
then there's a problem. I've already seen such problems in the past
(the NFS server needed to be rebooted), which affected other software
using fcntl lock, e.g. mail software.

-- 
Vincent Lefèvre <vincent@vinc17.org> - Web: <http://www.vinc17.org/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/>
Work: CR INRIA - computer arithmetic / Arenaire project (LIP, ENS-Lyon)

[-- Attachment #2: tfcntl.c --]
[-- Type: text/plain, Size: 880 bytes --]

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>

int main (int argc, char *argv[])
{
  FILE *f;
  int fd;
  struct flock lck;

  if (argc != 3)
  {
    fprintf (stderr, "Usage: tfcntl <file> <sleeptime>\n");
    exit (1);
  }

  f = fopen (argv[1], "r+b");
  if (f == NULL)
  {
    fprintf (stderr, "tfcntl: can't open file %s\n", argv[1]);
    perror ("tfnctl");
    exit (2);
  }
  fd = fileno (f);

  memset (&lck, 0, sizeof (struct flock));
  lck.l_type = F_WRLCK;
  lck.l_whence = SEEK_SET;
  if (fcntl (fd, F_SETLK, &lck) == -1)
  {
    fprintf (stderr, "tfcntl: lock failed (errno = %d)\n", errno);
    perror ("tfnctl");
    exit (3);
  }

  sleep(atoi(argv[2]));

  memset (&lck, 0, sizeof (struct flock));
  lck.l_type = F_UNLCK;
  lck.l_whence = SEEK_SET;
  fcntl (fd, F_SETLK, &lck);

  return 0;
}

  reply	other threads:[~2008-05-23 22:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20080523094636.GA3814@piper.oerlikon.madduck.net>
2008-05-23 13:24 ` Clint Adams
2008-05-23 22:30   ` Vincent Lefevre [this message]
2008-05-24  2:56     ` Clint Adams
2008-05-27  8:32       ` martin f krafft

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=20080523223034.GM7056@prunille.vinc17.org \
    --to=vincent@vinc17.org \
    --cc=482525@bugs.debian.org \
    --cc=madduck@debian.org \
    --cc=zsh-workers@sunsite.dk \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

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).