All of lore.kernel.org
 help / color / mirror / Atom feed
* NFS Locking Issue - Solaris-Linux
@ 2002-10-22 14:08 Bill Schrier
  2002-10-22 14:52 ` Eff Norwood
  2002-10-22 16:02 ` Daniel Forrest
  0 siblings, 2 replies; 8+ messages in thread
From: Bill Schrier @ 2002-10-22 14:08 UTC (permalink / raw)
  To: nfs; +Cc: it

[-- 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;
}

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2002-10-28 14:27 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-10-22 14:08 NFS Locking Issue - Solaris-Linux Bill Schrier
2002-10-22 14:52 ` 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

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.