FW: Sporadic permission denied error in Samba 4.3 and 4.4, 4.2 OK

Youzhong Yang Youzhong.Yang at mathworks.com
Wed Nov 9 20:03:40 UTC 2016

Hi Jeremy,

Thanks for your attention. I understand that without reproduction, it's hard for you guys to find the root cause, so I've tried my best to reproduce it without using our application, but so far there's no success.

I've somehow traced down to the place where NT_STATUS_SHARING_VIOLATION is returned:

source3/smbd/open.c - around line #2941:
	if ((req != NULL) &&
		    fsp, oplock_request, lease, lck,
		    create_disposition, first_open_attempt)) {
		schedule_defer_open(lck, fsp->file_id, request_time, req);
		/* debug output */
		DEBUG(0,("%s %s\n", smb_fname_str_dbg(smb_fname), nt_errstr(NT_STATUS_SHARING_VIOLATION)));

One sample log output when Windows client complained with error message "Cannot open file: permission denied.":

[2016/11/08 14:08:08.544131,  0, pid=29719] ../source3/smbd/open.c:2960(open_file_ntcreate)
  482450_r000_win64_smoke_t/w s/482450_r000_win64_12/matlab/test/tools/bpd_make.m NT_STATUS_SHARING_VIOLATION
[2016/11/08 14:09:08.544283,  0, pid=29719] ../source3/smbd/open.c:2960(open_file_ntcreate)
  482450_r000_win64_smoke_t/w s/482450_r000_win64_12/matlab/test/tools/bpd_make.m NT_STATUS_SHARING_VIOLATION

As you can see, the time difference between the above two debug lines is exactly 60 seconds.

I think the issue is related to lease break and deferred opening, but I don't know how to trace it down further. I hope you could point me to the right direction for further debugging and tracing.

I will keep trying the reproduction of the issue and let you know how it goes.



-----Original Message-----
From: Jeremy Allison [mailto:jra at samba.org] 
Sent: Friday, November 04, 2016 2:21 PM
To: Youzhong Yang <Youzhong.Yang at mathworks.com>
Cc: samba-technical at lists.samba.org
Subject: Re: FW: Sporadic permission denied error in Samba 4.3 and 4.4, 4.2 OK

On Fri, Nov 04, 2016 at 02:44:43PM +0000, Youzhong Yang wrote:
> Got a bounce back, so resending the e-mail.
> From: Youzhong Yang
> Sent: Friday, November 04, 2016 10:39 AM
> To: samba-technical at samba.org
> Cc: Jeremy Allison <jra at samba.org>
> Subject: Sporadic permission denied error in Samba 4.3 and 4.4, 4.2 OK
> Hi Samba gurus,
> We've been using Samba 4.2 in our production environment for more than one year and it's very stable and reliable.
> There's no more fix going into 4.2 so we know it's time to upgrade, 
> but unfortunately it turns out 4.3 and 4.4 (we haven't tried 4.5) have 
> some kind of issues that bothered me quite a bit - our application sporadically complained about 'permission denied'. I switched back and forth between 4.2 and higher version, clearly 4.2 works well, and 4.3/4.4 doesn't.
> I put a debug output at the end of create_file_default(), the error code I saw is NT_STATUS_SHARING_VIOLATION, here is one example:
> [2016/11/03 20:23:55.180173,  0, pid=38541, class=open] ../source3/smbd/open.c:5170(create_file_default)
>   create_file: access_mask = 0x120089 file_attributes = 0x80, 
> share_access = 0x3, create_disposition = 0x1 create_options = 0x40 
> oplock_request = 0x100 private_flags = 0x0 fname = 
> 480289_r000_win64_smoke_t/w 
> s/480289_r000_win64_5/matlab/toolbox/matlab/testframework/core/+matlab
> /+unittest/+internal/+qualifications/QualificationFailedException.m 
> To my understanding, NT_STATUS_SHARING_VIOLATION does not necessarily mean the Windows client will get a 'permission denied' error.
> I am still trying very hard to reproduce this issue without using our application, so far no luck.
> I am stuck right now, please shed some light on the issue if you would.

Hi Youzhong,

Can you give us more info on what might trigger this problem ?
I know your environment is very complex, but the description above isn't enough to go on.

I'm happy to work closely with you on this if you can get something that might be repeatable.



More information about the samba-technical mailing list