Subject: Re: kern/30303: Unlocking already-unlocked file on smbfs returns EBUSY
To: None <jdolecek@netbsd.org, gnats-admin@netbsd.org,>
From: Jaromir Dolecek <jdolecek@NetBSD.org>
List: netbsd-bugs
Date: 06/12/2005 15:31:01
The following reply was made to PR kern/30303; it has been noted by GNATS.

From: Jaromir Dolecek <jdolecek@NetBSD.org>
To: gnats-bugs@NetBSD.org
Cc: kern-bug-people@NetBSD.org, gnats-admin@NetBSD.org,
	netbsd-bugs@NetBSD.org
Subject: Re: kern/30303: Unlocking already-unlocked file on smbfs returns EBUSY
Date: Sun, 12 Jun 2005 17:25:27 +0200

 > 	This is apparently due to smb_maperror() in
 > sys/netsmb/smb_subr.c mapping the ERRnotlocked returned by the SMB
 > server to EBUSY, then that getting passed back up to flock()'s caller.
 
 This is right :)
 
 Can you try this patch?
 
 Index: smb_subr.c
 ===================================================================
 RCS file: /cvsroot/src/sys/netsmb/smb_subr.c,v
 retrieving revision 1.21
 diff -u -p -r1.21 smb_subr.c
 --- smb_subr.c	26 Feb 2005 22:39:50 -0000	1.21
 +++ smb_subr.c	12 Jun 2005 15:24:26 -0000
 @@ -241,7 +241,8 @@ smb_maperror(int eclass, int eno)
  		    case ERRquota:
  			return EDQUOT;
  		    case ERRnotlocked:
 -			return EBUSY;
 +			/* it's okay to try to unlock already unlocked file */
 +			return 0;
  		    case NT_STATUS_NOTIFY_ENUM_DIR:
  			return EMSGSIZE;
  		}
 
 Jaromir
 -- 
 Jaromir Dolecek <jdolecek@NetBSD.org>            http://www.NetBSD.cz/
 -=- We can walk our road together if our goals are all the same;     -=-
 -=- We can run alone and free if we pursue a different aim.          -=-