Re: Samba and kernel oplocks

Stephen Lee
2002-08-29T17:21:34Z

On Wed, 2002-08-28 at 23:21, Sergey Suleymanov wrote:
> >>>>> Anderson Pereira Ataides writes:
>
> Anderson> I thing problem is not only samba because nfs also have
> Anderson> problem. I have two Linux workstations and when I lock
> Anderson> record in one of them, the other one can't see this lock.
>
> Anderson> Like you I'm waiting for a solution to this problem.
>
> Well, I'm just try locks with samba, and it seems work.
> oplocks = no in smb.conf and this hack to mfs.c
>
> --- src/dosext/mfs/mfs.c.orig Thu Aug 29 10:09:33 2002
> +++ src/dosext/mfs/mfs.c Thu Aug 29 10:08:31 2002
> @@ -3823,11 +3823,16 @@
> the top two bits are set. Shift the top ones by two bits. This
> still allows OLE2 apps to operate, but should stop lockd from
> dieing */
> +#if 0
> if ((larg.l_start & mask) != 0)
> larg.l_start = (larg.l_start & ~mask) | ((larg.l_start & mask) >> 2);
> +#else
> + larg.l_start &= 0x7fffffff;
> +#endif
> ret = fcntl (fd,F_SETLK,&larg);
> Debug0((dbg_fd, "lock fd=%x rc=%x type=%x whence=%x start=%lx, len=%lx\n",
> fd, ret, larg.l_type, larg.l_whence, larg.l_start,larg.l_len));
> + if (ret == -1) SETWORD(&(state->eax), ACCESS_DENIED);
> return ret != -1 ? TRUE : FALSE;
> }
> break;
>
I copied your diff into a file and ran "patch -p0 < diff_file" and got:

patching file src/dosext/mfs/mfs.c
Hunk #1 FAILED at 3823.
1 out of 1 hunk FAILED -- saving rejects to file
src/dosext/mfs/mfs.c.rej

I don't know much about patching but it appears that the prepatch status
of my 1.1.3.2 mfs.c is different compared to yours. The line containing
"the top two bits are set. Shift the top ones by two bits." in my
version of mfs.c resides at line 3789.

Thanks for your help.
Stephen