Issues with Linux kernel oplocks
Ralph Wuerthner
ralphw at de.ibm.com
Wed Jul 24 07:14:46 MDT 2013
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 3.6.next and 4.0.next.
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.
Regards
Ralph
More information about the samba-technical
mailing list