[comp.sys.sun] fcntl/F_RSETLK crashing 4.1 Sparcs ?? lockd problem ??

eric@picard.sbi.com (Eric Ho) (01/23/91)

Have anyone out there seen fcntl() calls with F_RSETLK crashing 4.1
Sparc's ?  I've seen this under vanilla 4.1 as well as 4.1 with the lockd
patch [i.e.  patch id 100075 or something like that -- that patch replaces
ufs_lockf.o, klm_lockmgr.o and rpc.lockd].

Here are ~20 lines of code that can crash a 4.1 Sparc.

Note that the file, /holodeck/eric/yoyo is nfs-mounted from a fileserver.
I hand mounted it rw,soft,intr.  I tried the code on most 4.1 Sparcs that
has local disks -- don't know what happen for other archs or with diskless
clients though.  It crashes the system during the fcntl() call.

==========================================
#include <stdio.h>
#include <fcntl.h>

int lock_val;
#define READLOCK_FILE(fd1) \
	{					\
	  struct flock flock;			\
	  flock.l_type = F_RDLCK;		\
	  flock.l_whence = 0;			\
	  flock.l_start = flock.l_len = 0L;	\
	  lock_val = fcntl (fd1, F_RSETLK, &flock);	\
	}
main()
{
  int fd;
  /*  Make sure that /holodeck is nfs-mounted */
  fd = open("/holodeck/eric/yoyo",O_RDONLY,0000644);
  printf("fd = %d\n",fd);  fflush(stdout);
  READLOCK_FILE(fd);
  printf("lock_val = %d\n",lock_val);  fflush(stdout);
  close(fd);
}
==========================================

The strange thing is that if I use F_SETLK instead of F_RSETLK then
everything went ok.  So I pressume that there is still some kernel bugs
related to rpc.lockd.

Any pointers much appreciated.

+ Eric Ho                          Email: eric@sbi.com
+ Salomon Brothers, Inc.  [SISS]   Phone: (212) 855-3003