Issues with Linux kernel oplocks

Daniel Gan-Levi DANIELG at
Mon Jul 29 06:52:35 MDT 2013

Hi Ralph,
I can confirm that your patch fixes an issue we were having with Samba 4
not releasing oplocks to Ganesha.


From:	Ralph Wuerthner <ralphw at>
To:	Jeremy Allison <jra at>,
Cc:	Samba Technical <samba-technical at>
Date:	25-07-13 04:22 PM
Subject:	Re: Issues with Linux kernel oplocks
Sent by:	samba-technical-bounces at

On 24/07/13 15:14, Ralph Wuerthner wrote:
> On 23/07/13 23:53, Jeremy Allison wrote:
>> On Tue, Jul 23, 2013 at 02:12:28PM -0700, Jeremy Allison wrote:
>> Ok Ralph, can you test this fix to see if it addresses
>> your issue ? It should apply cleanly to 3.6.x and 4.0.x.
>> If it works for you then we'll raise a bug and get it
>> into and
> Hi Jeremy,
> in my initial posting I forgot to mention that our underlying file
> system is GPFS and we are not using fcntl() to request a lease, instead
> we call a GPFS specific function (gpfs_set_lease). Internally GPFS is
> still using the kernel lease infrastructure but that specific function
> is required to be able to notify other cluster nodes about the lease.
> That's why we do not use linux_setlease() at all and I had to apply the
> following patch to make it work with our application:
> diff --git a/source3/modules/vfs_gpfs.c b/source3/modules/vfs_gpfs.c
> index a4ed473..9cf0c04 100644
> --- a/source3/modules/vfs_gpfs.c
> +++ b/source3/modules/vfs_gpfs.c
> @@ -107,7 +107,9 @@ static int vfs_gpfs_setlease(vfs_handle_struct
> *handle, files_struct *fsp,
>          START_PROFILE(syscall_linux_setlease);
>          if (config->leases) {
> +               become_root();
>                  ret = set_gpfs_lease(fsp->fh->fd,leasetype);
> +               unbecome_root();
>          }
>          END_PROFILE(syscall_linux_setlease);
> I tested above patch and now everything is working as expected.
> To debug the issue a colleague prepared a systemtap script to take a
> closer look at what's happening inside the kernel and with my patch
> applied we now see that the lock owner is root:
> send_sigio_to_task:task:0xffff8802c9d9f540
> send_sigio_to_task:fown euid:0
> send_sigio_to_task:fown uid:0
> send_sigio_to_task:cred suid:0
> send_sigio_to_task:cred uid:0
> Without the patch we used to get
> send_sigio_to_task:task:0xffff8802a649caa0
> send_sigio_to_task:fown euid:11000500
> send_sigio_to_task:fown uid:11000500
> send_sigio_to_task:cred suid:0
> send_sigio_to_task:cred uid:0
> I also tested your patch on a ext2 file system and the results are the
> same - so please go ahead and proceed with your patch.


Please see attached patch which fixes the Linux kernel oplocks issue for
environments using GPFS.


[attachment "0001-s3-vfs_gpfs-make-sure-lease-owner-is-root.patch" deleted
by Daniel Gan-Levi/Israel/IBM]

More information about the samba-technical mailing list