[Samba] Debug file_new then open_file_ntcreate fails with doesn't exist

Matthew Schumacher
2021-07-20T19:43:10Z

On 7/16/21 2:25 PM, Jeremy Allison wrote:
> On Fri, Jul 16, 2021 at 01:44:17PM -0700, Matthew Schumacher via samba
> wrote:
>> On 7/16/21 12:12 PM, Jeremy Allison wrote:
>>>>
>>>> Anybody see this before or thoughts on work arounds?? I'm
running
>>>> the latest stable samba 4.14.6 in AD mode.
>>>
>>> We haven't seen that, it looks strange. I take it there's
no
>>> other application running that could race and delete ?
>>>
>>> Can you check the recently release 4.15.rc1 to see if it's
>>> something that got fixed ? There have been *lots* of changes
>>> in the pathname area between 4.14.x -> 4.15.rc1.
>> <snip>
> Oh hang on a minute. Look at that create_disposition = 0x1.
>
> This means:
>
> #define FILE_OPEN 1????????????????? /* File exists open. File not
> exist fail. */
>
> So smbd is doing the right thing here. To create
> a new file, create_disposition must be one of either:
>
> #define FILE_CREATE 2?????????????????? /* File exists fail. File not
> exist create. */
> #define FILE_OPEN_IF 3????????????????? /* File exists open. File not
> exist create. */
> #define FILE_OVERWRITE_IF 5???????????? /* File exists overwrite. File
> not exist create. */

Hi Jermey,

Thanks for looking at this.

After fighting with it more, what I thought was the problem (some race
condition with a file being read right after creation) didn't end up
being the issue.? I noticed that whenever I restarted the linux server
it would work again which is super odd because restarting samba wouldn't
do anything to resolve it.? Given that the only thing that really
changes with a reboot is handled by the kernel, I decided to upgrade the
kernel from 4.19.171 to 5.10.52 thinking that the issue might be in the
kernel.? Sure enough, the issue goes away.

Do you by chance know of any kernel issues that could cause this? I'm
not sure what I would be looking for in a kernel changelog that would
affect samba like this.

schu