All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bill Schrier <wschrier@neolinear.com>
To: nfs@lists.sourceforge.net
Cc: it@neolinear.com
Subject: NFS Locking Issue - Solaris-Linux
Date: Tue, 22 Oct 2002 10:08:12 -0400	[thread overview]
Message-ID: <3DB55BCC.447F0C32@neolinear.com> (raw)

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

We've been having a bit of trouble finding a solution to a problem we've
been having between our Solaris machines and our Raidzone machine
running Redhat (kernel 2.4.18-12smp).  I would appreciate any input on
this subject as it is basically keeping us from effectively using the
storage space we have in the Raidzone box.

The problem arises when we try to lock any file shared from the Redhat
machine from any of our Solaris machines.  This happens regardless of
the Solaris kernel version - 2.6, 8, and multiple kernel patch levels
within those OS versions.  However, with a clean install of Redhat, we
are able to successfully lock shared files - it is just this Raidzone
machine.

One major restriction is that we will be unable to recompile the kernel
on the Raidzone machine due to the extra drivers that Raidzone builds
into the kernel.  We are assuming that since we are able to successfully
lock files on other Redhat machines that it is a configuration issue,
but we've been unable to find what setting is causing the problem, and
Raidzone Technical Support has likewise been unable to locate any
differences - though they have stated that they are unable to duplicate
the problem.

I've attached a quick C program that one of our engineers here has
written to test the file locking, in case it is of any help.

Thanks in advance for any suggestions on this issue.

William Schrier

--
William J. Schrier              Phone: 412.968.5780 x151
Neolinear, Inc.                 Fax:   412.968.5788
583 Epsilon Drive               Email: wschrier@neolinear.com
Pittsburgh, PA  15238



[-- Attachment #2: lockit.cc --]
[-- Type: text/plain, Size: 1329 bytes --]


#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
len)
{
  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)

int 
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",
  argv[1]);

  close (fd);
  
  return 0;
}

             reply	other threads:[~2002-10-22 14:09 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-22 14:08 Bill Schrier [this message]
2002-10-22 14:52 ` NFS Locking Issue - Solaris-Linux Eff Norwood
2002-10-22 15:21   ` Bill Schrier
2002-10-23 16:21     ` Scott McDermott
2002-10-22 16:02 ` Daniel Forrest
2002-10-23 18:52   ` Bill Schrier
2002-10-25 17:53     ` Daniel Forrest
2002-10-28 14:25       ` Bill Schrier

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=3DB55BCC.447F0C32@neolinear.com \
    --to=wschrier@neolinear.com \
    --cc=it@neolinear.com \
    --cc=nfs@lists.sourceforge.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.