From fbdcf2663b56007a438ac4f0d8d82436b1bfe688 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 11 Jul 2006 18:01:26 +0000 Subject: r16945: Sync trunk -> 3.0 for 3.0.24 code. Still need to do the upper layer directories but this is what everyone is waiting for.... Jeremy. (This used to be commit 9dafb7f48ca3e7af956b0a7d1720c2546fc4cfb8) --- source3/include/locking.h | 88 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 source3/include/locking.h (limited to 'source3/include/locking.h') diff --git a/source3/include/locking.h b/source3/include/locking.h new file mode 100644 index 0000000000..983d59a853 --- /dev/null +++ b/source3/include/locking.h @@ -0,0 +1,88 @@ +/* + Unix SMB/CIFS implementation. + SMB parameters and setup, plus a whole lot more. + + Copyright (C) Jeremy Allison 2006 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef _LOCKING_H +#define _LOCKING_H + +/* passed to br lock code - the UNLOCK_LOCK should never be stored into the tdb + and is used in calculating POSIX unlock ranges only. */ + +enum brl_type {READ_LOCK, WRITE_LOCK, PENDING_LOCK, UNLOCK_LOCK}; +enum brl_flavour {WINDOWS_LOCK = 0, POSIX_LOCK = 1}; + +/* This contains elements that differentiate locks. The smbpid is a + client supplied pid, and is essentially the locking context for + this client */ + +struct lock_context { + uint32 smbpid; + uint16 tid; + struct process_id pid; +}; + +/* The key used in the brlock database. */ + +struct lock_key { + SMB_DEV_T device; + SMB_INO_T inode; +}; + +struct byte_range_lock { + files_struct *fsp; + unsigned int num_locks; + BOOL modified; + struct lock_key key; + void *lock_data; +}; + +#define BRLOCK_FN_CAST() \ + void (*)(SMB_DEV_T dev, SMB_INO_T ino, struct process_id pid, \ + enum brl_type lock_type, \ + enum brl_flavour lock_flav, \ + br_off start, br_off size) + +#define BRLOCK_FN(fn) \ + void (*fn)(SMB_DEV_T dev, SMB_INO_T ino, struct process_id pid, \ + enum brl_type lock_type, \ + enum brl_flavour lock_flav, \ + br_off start, br_off size) + +#define LOCKING_FN_CAST() \ + void (*)(struct share_mode_entry *, const char *, const char *) + +#define LOCKING_FN(fn) \ + void (*fn)(struct share_mode_entry *, const char *, const char *) + +/* Internal structure in brlock.tdb. + The data in brlock records is an unsorted linear array of these + records. It is unnecessary to store the count as tdb provides the + size of the record */ + +struct lock_struct { + struct lock_context context; + br_off start; + br_off size; + uint16 fnum; + enum brl_type lock_type; + enum brl_flavour lock_flav; +}; + +#endif /* _LOCKING_H_ */ -- cgit From e1da1fcf12164f50f3462c90f0bb785d18c59b0b Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 17 Jul 2006 21:09:02 +0000 Subject: r17098: Samba3 now cleanly passes Samba4 RAW-LOCK torture test. Phew - that was painful :-). But what it means is that we now implement lock cancels and I can add lock cancels into POSIX lock handling which will fix the fast/slow system call issue with cifsfs ! Jeremy. (This used to be commit f1a9cf075b87c76c032d19da0168424c90f6cb3c) --- source3/include/locking.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'source3/include/locking.h') diff --git a/source3/include/locking.h b/source3/include/locking.h index 983d59a853..8eabb305f7 100644 --- a/source3/include/locking.h +++ b/source3/include/locking.h @@ -45,8 +45,10 @@ struct lock_key { SMB_INO_T inode; }; +struct files_struct; + struct byte_range_lock { - files_struct *fsp; + struct files_struct *fsp; unsigned int num_locks; BOOL modified; struct lock_key key; -- cgit From e0c68d0a1d591e4285746a8af70040448752a735 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Fri, 21 Jul 2006 14:13:30 +0000 Subject: r17177: Get rid of a global variable by adding a private data pointer to share_mode_forall(). Volker (This used to be commit f97f6cedffdc4d10afcac90a163b93a801acf514) --- source3/include/locking.h | 6 ------ 1 file changed, 6 deletions(-) (limited to 'source3/include/locking.h') diff --git a/source3/include/locking.h b/source3/include/locking.h index 8eabb305f7..9e70411fa6 100644 --- a/source3/include/locking.h +++ b/source3/include/locking.h @@ -67,12 +67,6 @@ struct byte_range_lock { enum brl_flavour lock_flav, \ br_off start, br_off size) -#define LOCKING_FN_CAST() \ - void (*)(struct share_mode_entry *, const char *, const char *) - -#define LOCKING_FN(fn) \ - void (*fn)(struct share_mode_entry *, const char *, const char *) - /* Internal structure in brlock.tdb. The data in brlock records is an unsorted linear array of these records. It is unnecessary to store the count as tdb provides the -- cgit From 2c6030415e0b1f421ea6e85fe6ffe7389ee7a941 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Sat, 29 Jul 2006 19:14:24 +0000 Subject: r17314: Optimisation for POSIX locking. If we're downgrading a POSIX lock (applying a read-lock) and we overlap pending read locks then send them an unlock message, we may have allowed them to proceed. Jeremy. (This used to be commit a7a0b6ba50f4cf7c5a0a29809fdff9e1266a29e7) --- source3/include/locking.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'source3/include/locking.h') diff --git a/source3/include/locking.h b/source3/include/locking.h index 9e70411fa6..a09e7d1aff 100644 --- a/source3/include/locking.h +++ b/source3/include/locking.h @@ -23,11 +23,15 @@ #define _LOCKING_H /* passed to br lock code - the UNLOCK_LOCK should never be stored into the tdb - and is used in calculating POSIX unlock ranges only. */ + and is used in calculating POSIX unlock ranges only. We differentiate between + PENDING read and write locks to allow posix lock downgrades to trigger a lock + re-evaluation. */ -enum brl_type {READ_LOCK, WRITE_LOCK, PENDING_LOCK, UNLOCK_LOCK}; +enum brl_type {READ_LOCK, WRITE_LOCK, PENDING_READ_LOCK, PENDING_WRITE_LOCK, UNLOCK_LOCK}; enum brl_flavour {WINDOWS_LOCK = 0, POSIX_LOCK = 1}; +#define IS_PENDING_LOCK(type) ((type) == PENDING_READ_LOCK || (type) == PENDING_WRITE_LOCK) + /* This contains elements that differentiate locks. The smbpid is a client supplied pid, and is essentially the locking context for this client */ -- cgit From 49001a5b1b07e9a24e5f7efa0dfd880772bdb435 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 31 Jul 2006 20:58:02 +0000 Subject: r17346: Add optimisation vl needs for the cluster code where we don't get the chainlock when getting the byte range lock record read-only. Jeremy. (This used to be commit fcd798ca0c1b76adb2bcda4a99c40c7aacb0addb) --- source3/include/locking.h | 1 + 1 file changed, 1 insertion(+) (limited to 'source3/include/locking.h') diff --git a/source3/include/locking.h b/source3/include/locking.h index a09e7d1aff..4b3b10d736 100644 --- a/source3/include/locking.h +++ b/source3/include/locking.h @@ -55,6 +55,7 @@ struct byte_range_lock { struct files_struct *fsp; unsigned int num_locks; BOOL modified; + BOOL read_only; struct lock_key key; void *lock_data; }; -- cgit From 1bcee2679d66f98932d800d6c88b70aeb7691b82 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 5 May 2007 20:43:06 +0000 Subject: r22688: Change lock_data in struct byte_range_lock from void * to struct lock_struct * (This used to be commit 8e0e278961ebf2fa4301874d522636699ace1b9b) --- source3/include/locking.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/include/locking.h') diff --git a/source3/include/locking.h b/source3/include/locking.h index 4b3b10d736..a62b461c10 100644 --- a/source3/include/locking.h +++ b/source3/include/locking.h @@ -57,7 +57,7 @@ struct byte_range_lock { BOOL modified; BOOL read_only; struct lock_key key; - void *lock_data; + struct lock_struct *lock_data; }; #define BRLOCK_FN_CAST() \ -- cgit From e6383f47629368d9dd4e803f17566a24e9d7359e Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Mon, 7 May 2007 09:35:35 +0000 Subject: r22736: Start to merge the low-hanging fruit from the now 7000-line cluster patch. This changes "struct process_id" to "struct server_id", keeping both is just too much hassle. No functional change (I hope ;-)) Volker (This used to be commit 0ad4b1226c9d91b72136310d3bbb640d2c5d67b8) --- source3/include/locking.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source3/include/locking.h') diff --git a/source3/include/locking.h b/source3/include/locking.h index a62b461c10..cc4d83fdcd 100644 --- a/source3/include/locking.h +++ b/source3/include/locking.h @@ -39,7 +39,7 @@ enum brl_flavour {WINDOWS_LOCK = 0, POSIX_LOCK = 1}; struct lock_context { uint32 smbpid; uint16 tid; - struct process_id pid; + struct server_id pid; }; /* The key used in the brlock database. */ @@ -61,13 +61,13 @@ struct byte_range_lock { }; #define BRLOCK_FN_CAST() \ - void (*)(SMB_DEV_T dev, SMB_INO_T ino, struct process_id pid, \ + void (*)(SMB_DEV_T dev, SMB_INO_T ino, struct server_id pid, \ enum brl_type lock_type, \ enum brl_flavour lock_flav, \ br_off start, br_off size) #define BRLOCK_FN(fn) \ - void (*fn)(SMB_DEV_T dev, SMB_INO_T ino, struct process_id pid, \ + void (*fn)(SMB_DEV_T dev, SMB_INO_T ino, struct server_id pid, \ enum brl_type lock_type, \ enum brl_flavour lock_flav, \ br_off start, br_off size) -- cgit From 40a3b796ceac468b887b981422680a8139142a07 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 27 May 2007 10:35:14 +0000 Subject: r23165: Convert brlock.tdb to dbwrap (This used to be commit 84f9885cf8cc57dcf3c2738d6b245de314890a41) --- source3/include/locking.h | 1 + 1 file changed, 1 insertion(+) (limited to 'source3/include/locking.h') diff --git a/source3/include/locking.h b/source3/include/locking.h index cc4d83fdcd..e675755839 100644 --- a/source3/include/locking.h +++ b/source3/include/locking.h @@ -58,6 +58,7 @@ struct byte_range_lock { BOOL read_only; struct lock_key key; struct lock_struct *lock_data; + struct db_record *record; }; #define BRLOCK_FN_CAST() \ -- cgit From e8156439f24137b5418baad20a7f00f6949cfe29 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Tue, 29 May 2007 09:30:34 +0000 Subject: r23183: Check in a change made by Tridge: This replaces the internal explicit dev/ino file id representation by a "struct file_id". This is necessary as cluster file systems and NFS don't necessarily assign the same device number to the shared file system. With this structure in place we can now easily add different schemes to map a file to a unique 64-bit device node. Jeremy, you might note that I did not change the external interface of smb_share_modes.c. Volker (This used to be commit 9b10dbbd5de8813fc15ebbb6be9b18010ffe8139) --- source3/include/locking.h | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'source3/include/locking.h') diff --git a/source3/include/locking.h b/source3/include/locking.h index e675755839..f02d817133 100644 --- a/source3/include/locking.h +++ b/source3/include/locking.h @@ -42,33 +42,34 @@ struct lock_context { struct server_id pid; }; -/* The key used in the brlock database. */ +struct files_struct; -struct lock_key { - SMB_DEV_T device; - SMB_INO_T inode; +struct file_id { + /* we don't use SMB_DEV_T and SMB_INO_T as we want a fixed size here, + and we may be using file system specific code to fill in something + other than a dev_t for the device */ + uint64_t devid; + uint64_t inode; }; -struct files_struct; - struct byte_range_lock { struct files_struct *fsp; unsigned int num_locks; BOOL modified; BOOL read_only; - struct lock_key key; + struct file_id key; struct lock_struct *lock_data; struct db_record *record; }; #define BRLOCK_FN_CAST() \ - void (*)(SMB_DEV_T dev, SMB_INO_T ino, struct server_id pid, \ + void (*)(struct file_id id, struct server_id pid, \ enum brl_type lock_type, \ enum brl_flavour lock_flav, \ br_off start, br_off size) #define BRLOCK_FN(fn) \ - void (*fn)(SMB_DEV_T dev, SMB_INO_T ino, struct server_id pid, \ + void (*fn)(struct file_id id, struct server_id pid, \ enum brl_type lock_type, \ enum brl_flavour lock_flav, \ br_off start, br_off size) -- cgit From d3ed91d9e1f3ba9f3d5093b3607dd563b37c27ed Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Tue, 29 May 2007 13:26:44 +0000 Subject: r23195: Add void *private_data to brl_forall (This used to be commit c91b2bdc160d76bf0b0770fe7f92cbc7124d6c3c) --- source3/include/locking.h | 12 ------------ 1 file changed, 12 deletions(-) (limited to 'source3/include/locking.h') diff --git a/source3/include/locking.h b/source3/include/locking.h index f02d817133..d61b5fe1e4 100644 --- a/source3/include/locking.h +++ b/source3/include/locking.h @@ -62,18 +62,6 @@ struct byte_range_lock { struct db_record *record; }; -#define BRLOCK_FN_CAST() \ - void (*)(struct file_id id, struct server_id pid, \ - enum brl_type lock_type, \ - enum brl_flavour lock_flav, \ - br_off start, br_off size) - -#define BRLOCK_FN(fn) \ - void (*fn)(struct file_id id, struct server_id pid, \ - enum brl_type lock_type, \ - enum brl_flavour lock_flav, \ - br_off start, br_off size) - /* Internal structure in brlock.tdb. The data in brlock records is an unsorted linear array of these records. It is unnecessary to store the count as tdb provides the -- cgit From d824b98f80ba186030cbb70b3a1e5daf80469ecd Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 9 Jul 2007 19:25:36 +0000 Subject: r23779: Change from v2 or later to v3 or later. Jeremy. (This used to be commit 407e6e695b8366369b7c76af1ff76869b45347b3) --- source3/include/locking.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/include/locking.h') diff --git a/source3/include/locking.h b/source3/include/locking.h index d61b5fe1e4..aea976bf9c 100644 --- a/source3/include/locking.h +++ b/source3/include/locking.h @@ -6,7 +6,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, -- cgit From 5e54558c6dea67b56bbfaba5698f3a434d3dffb6 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 10 Jul 2007 00:52:41 +0000 Subject: r23784: use the GPLv3 boilerplate as recommended by the FSF and the license text (This used to be commit b0132e94fc5fef936aa766fb99a306b3628e9f07) --- source3/include/locking.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'source3/include/locking.h') diff --git a/source3/include/locking.h b/source3/include/locking.h index aea976bf9c..35d9f48467 100644 --- a/source3/include/locking.h +++ b/source3/include/locking.h @@ -15,8 +15,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with this program. If not, see . */ #ifndef _LOCKING_H -- cgit From 30191d1a5704ad2b158386b511558972d539ce47 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 18 Oct 2007 17:40:25 -0700 Subject: RIP BOOL. Convert BOOL -> bool. I found a few interesting bugs in various places whilst doing this (places that assumed BOOL == int). I also need to fix the Samba4 pidl generation (next checkin). Jeremy. (This used to be commit f35a266b3cbb3e5fa6a86be60f34fe340a3ca71f) --- source3/include/locking.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/include/locking.h') diff --git a/source3/include/locking.h b/source3/include/locking.h index 35d9f48467..b2b7236721 100644 --- a/source3/include/locking.h +++ b/source3/include/locking.h @@ -54,8 +54,8 @@ struct file_id { struct byte_range_lock { struct files_struct *fsp; unsigned int num_locks; - BOOL modified; - BOOL read_only; + bool modified; + bool read_only; struct file_id key; struct lock_struct *lock_data; struct db_record *record; -- cgit