From a3531314dd6c7da05e4b35cc84a8c3a0addaa0a4 Mon Sep 17 00:00:00 2001 From: Zack Kirsch Date: Mon, 9 Feb 2009 21:54:51 -0800 Subject: OneFS implementation of BRL VFS ops: * Much of the beginning should look familiar, as I re-used the OneFS oplock callback record concept. This was necessary to keep our own state around - it really only consists of a lock state, per asynchronous lock that is currently unsatisfied. The onefs_cbrl_callback_records map to BLRs by the id. * There are 4 states an async lock can be in. NONE means there is no async currently out for the lock, as opposed to ASYNC. DONE means we've locked *every* lock (keep in mind a request can ask for multiple locks at a time.) ERROR is an error. * onefs_cbrl_async_success: The lock_num is incremented, and the state changed, so that when process_blocking_lock_queue is run, we will try the *next* lock, rather than the same one again. * onefs_brl_lock_windows() has some complicated logic: * We do a no-op if we're passed a BLR and the matching state is ASYNC -- this means Samba is trying to get the same lock twice, and we just need to wait longer, so we return an error. * PENDING lock calls happen when the lock is being queued on the BLQ -- we do async in this case. * We also do async in the case that we're passed a BLR, but the lock is not pending. This is an async lock being probed by process_blocking_lock_queue. * We do a sync lock for any normal first request of a lock. * Failure is returned, but it doesn't go to the client unless the lock has actually timed out. --- source3/modules/onefs.h | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'source3/modules/onefs.h') diff --git a/source3/modules/onefs.h b/source3/modules/onefs.h index b88719f3a2..57194960fa 100644 --- a/source3/modules/onefs.h +++ b/source3/modules/onefs.h @@ -180,6 +180,22 @@ NTSTATUS onefs_streaminfo(vfs_handle_struct *handle, int onefs_vtimes_streams(vfs_handle_struct *handle, const char *fname, int flags, struct timespec times[3]); +NTSTATUS onefs_brl_lock_windows(vfs_handle_struct *handle, + struct byte_range_lock *br_lck, + struct lock_struct *plock, + bool blocking_lock, + struct blocking_lock_record *blr); + +bool onefs_brl_unlock_windows(vfs_handle_struct *handle, + struct messaging_context *msg_ctx, + struct byte_range_lock *br_lck, + const struct lock_struct *plock); + +bool onefs_brl_cancel_windows(vfs_handle_struct *handle, + struct byte_range_lock *br_lck, + struct lock_struct *plock, + struct blocking_lock_record *blr); + NTSTATUS onefs_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp, uint32 security_info, SEC_DESC **ppdesc); @@ -188,6 +204,7 @@ NTSTATUS onefs_get_nt_acl(vfs_handle_struct *handle, const char* name, NTSTATUS onefs_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp, uint32 security_info_sent, SEC_DESC *psd); + /* * Utility functions */ @@ -217,6 +234,4 @@ int onefs_sys_create_file(connection_struct *conn, uint32_t ntfs_flags, int *granted_oplock); - - #endif /* _ONEFS_H */ -- cgit