summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2012-01-10 13:56:37 +0100
committerJeremy Allison <jra@samba.org>2012-01-12 23:59:22 +0100
commitcfebba96bdab2097b6115f10b649ec6c23c72519 (patch)
tree3ae01b915dd1d915f2f5a06f84480a756479203b /source3/smbd
parent9cf6d735d43f6f905b19f52d38c93aa30092333d (diff)
downloadsamba-cfebba96bdab2097b6115f10b649ec6c23c72519.tar.gz
samba-cfebba96bdab2097b6115f10b649ec6c23c72519.tar.bz2
samba-cfebba96bdab2097b6115f10b649ec6c23c72519.zip
s3: Put an indirection layer into share_mode_lock
Signed-off-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/close.c20
-rw-r--r--source3/smbd/open.c38
-rw-r--r--source3/smbd/oplock.c6
-rw-r--r--source3/smbd/reply.c4
-rw-r--r--source3/smbd/trans2.c4
5 files changed, 36 insertions, 36 deletions
diff --git a/source3/smbd/close.c b/source3/smbd/close.c
index a07ab4b42c..131f4bf5d1 100644
--- a/source3/smbd/close.c
+++ b/source3/smbd/close.c
@@ -178,8 +178,8 @@ static void notify_deferred_opens(struct smbd_server_connection *sconn,
}
num_deferred = 0;
- for (i=0; i<lck->num_share_modes; i++) {
- if (is_deferred_open_entry(&lck->share_modes[i])) {
+ for (i=0; i<lck->data->num_share_modes; i++) {
+ if (is_deferred_open_entry(&lck->data->share_modes[i])) {
num_deferred += 1;
}
}
@@ -194,8 +194,8 @@ static void notify_deferred_opens(struct smbd_server_connection *sconn,
}
num_deferred = 0;
- for (i=0; i<lck->num_share_modes; i++) {
- struct share_mode_entry *e = &lck->share_modes[i];
+ for (i=0; i<lck->data->num_share_modes; i++) {
+ struct share_mode_entry *e = &lck->data->share_modes[i];
if (is_deferred_open_entry(e)) {
deferred[num_deferred] = *e;
num_deferred += 1;
@@ -359,7 +359,7 @@ static NTSTATUS close_remove_share_mode(files_struct *fsp,
DEBUG(10,("close_remove_share_mode: write time forced "
"for file %s\n",
fsp_str_dbg(fsp)));
- set_close_write_time(fsp, lck->changed_write_time);
+ set_close_write_time(fsp, lck->data->changed_write_time);
} else if (fsp->update_write_time_on_close) {
/* Someone had a pending write. */
if (null_timespec(fsp->close_write_time)) {
@@ -408,8 +408,8 @@ static NTSTATUS close_remove_share_mode(files_struct *fsp,
/* See if others still have the file open via this pathname.
If this is the case, then don't delete. If all opens are
POSIX delete now. */
- for (i=0; i<lck->num_share_modes; i++) {
- struct share_mode_entry *e = &lck->share_modes[i];
+ for (i=0; i<lck->data->num_share_modes; i++) {
+ struct share_mode_entry *e = &lck->data->share_modes[i];
if (is_valid_share_mode_entry(e) &&
e->name_hash == fsp->name_hash) {
if (fsp->posix_open && (e->flags & SHARE_MODE_FLAG_POSIX_OPEN)) {
@@ -619,7 +619,7 @@ static NTSTATUS update_write_time_on_close(struct files_struct *fsp)
if (lck) {
/* Close write times overwrite sticky write times
so we must replace any sticky write time here. */
- if (!null_timespec(lck->changed_write_time)) {
+ if (!null_timespec(lck->data->changed_write_time)) {
(void)set_sticky_write_time(fsp->file_id, fsp->close_write_time);
}
TALLOC_FREE(lck);
@@ -1058,8 +1058,8 @@ static NTSTATUS close_directory(struct smb_request *req, files_struct *fsp,
int i;
/* See if others still have the dir open. If this is the
* case, then don't delete. If all opens are POSIX delete now. */
- for (i=0; i<lck->num_share_modes; i++) {
- struct share_mode_entry *e = &lck->share_modes[i];
+ for (i=0; i<lck->data->num_share_modes; i++) {
+ struct share_mode_entry *e = &lck->data->share_modes[i];
if (is_valid_share_mode_entry(e) &&
e->name_hash == fsp->name_hash) {
if (fsp->posix_open && (e->flags & SHARE_MODE_FLAG_POSIX_OPEN)) {
diff --git a/source3/smbd/open.c b/source3/smbd/open.c
index 46d5d28863..7a85552910 100644
--- a/source3/smbd/open.c
+++ b/source3/smbd/open.c
@@ -987,7 +987,7 @@ static NTSTATUS open_mode_check(connection_struct *conn,
{
int i;
- if(lck->num_share_modes == 0) {
+ if(lck->data->num_share_modes == 0) {
return NT_STATUS_OK;
}
@@ -1010,9 +1010,9 @@ static NTSTATUS open_mode_check(connection_struct *conn,
*/
#if defined(DEVELOPER)
- for(i = 0; i < lck->num_share_modes; i++) {
+ for(i = 0; i < lck->data->num_share_modes; i++) {
validate_my_share_entries(conn->sconn, i,
- &lck->share_modes[i]);
+ &lck->data->share_modes[i]);
}
#endif
@@ -1021,15 +1021,15 @@ static NTSTATUS open_mode_check(connection_struct *conn,
}
/* Now we check the share modes, after any oplock breaks. */
- for(i = 0; i < lck->num_share_modes; i++) {
+ for(i = 0; i < lck->data->num_share_modes; i++) {
- if (!is_valid_share_mode_entry(&lck->share_modes[i])) {
+ if (!is_valid_share_mode_entry(&lck->data->share_modes[i])) {
continue;
}
/* someone else has a share lock on it, check to see if we can
* too */
- if (share_conflict(&lck->share_modes[i],
+ if (share_conflict(&lck->data->share_modes[i],
access_mask, share_access)) {
return NT_STATUS_SHARING_VIOLATION;
}
@@ -1115,43 +1115,43 @@ static void find_oplock_types(files_struct *fsp,
return;
}
- for (i=0; i<lck->num_share_modes; i++) {
- if (!is_valid_share_mode_entry(&lck->share_modes[i])) {
+ for (i=0; i<lck->data->num_share_modes; i++) {
+ if (!is_valid_share_mode_entry(&lck->data->share_modes[i])) {
continue;
}
- if (lck->share_modes[i].op_type == NO_OPLOCK &&
- is_stat_open(lck->share_modes[i].access_mask)) {
+ if (lck->data->share_modes[i].op_type == NO_OPLOCK &&
+ is_stat_open(lck->data->share_modes[i].access_mask)) {
/* We ignore stat opens in the table - they
always have NO_OPLOCK and never get or
cause breaks. JRA. */
continue;
}
- if (BATCH_OPLOCK_TYPE(lck->share_modes[i].op_type)) {
+ if (BATCH_OPLOCK_TYPE(lck->data->share_modes[i].op_type)) {
/* batch - can only be one. */
if (*pp_ex_or_batch || *pp_batch || *got_level2 || *got_no_oplock) {
smb_panic("Bad batch oplock entry.");
}
- *pp_batch = &lck->share_modes[i];
+ *pp_batch = &lck->data->share_modes[i];
}
- if (EXCLUSIVE_OPLOCK_TYPE(lck->share_modes[i].op_type)) {
+ if (EXCLUSIVE_OPLOCK_TYPE(lck->data->share_modes[i].op_type)) {
/* Exclusive or batch - can only be one. */
if (*pp_ex_or_batch || *got_level2 || *got_no_oplock) {
smb_panic("Bad exclusive or batch oplock entry.");
}
- *pp_ex_or_batch = &lck->share_modes[i];
+ *pp_ex_or_batch = &lck->data->share_modes[i];
}
- if (LEVEL_II_OPLOCK_TYPE(lck->share_modes[i].op_type)) {
+ if (LEVEL_II_OPLOCK_TYPE(lck->data->share_modes[i].op_type)) {
if (*pp_batch || *pp_ex_or_batch) {
smb_panic("Bad levelII oplock entry.");
}
*got_level2 = true;
}
- if (lck->share_modes[i].op_type == NO_OPLOCK) {
+ if (lck->data->share_modes[i].op_type == NO_OPLOCK) {
if (*pp_batch || *pp_ex_or_batch) {
smb_panic("Bad no oplock entry.");
}
@@ -1296,8 +1296,8 @@ static void defer_open(struct share_mode_lock *lck,
/* Paranoia check */
- for (i=0; i<lck->num_share_modes; i++) {
- struct share_mode_entry *e = &lck->share_modes[i];
+ for (i=0; i<lck->data->num_share_modes; i++) {
+ struct share_mode_entry *e = &lck->data->share_modes[i];
if (is_deferred_open_entry(e) &&
procid_is_me(&e->pid) &&
@@ -1465,7 +1465,7 @@ static void schedule_defer_open(struct share_mode_lock *lck,
a 1 second delay for share mode conflicts. */
state.delayed_for_oplocks = True;
- state.id = lck->id;
+ state.id = lck->data->id;
if (!request_timed_out(request_time, timeout)) {
defer_open(lck, request_time, timeout, req, &state);
diff --git a/source3/smbd/oplock.c b/source3/smbd/oplock.c
index e1731f1e10..2197c7947f 100644
--- a/source3/smbd/oplock.c
+++ b/source3/smbd/oplock.c
@@ -766,10 +766,10 @@ static void contend_level2_oplocks_begin_default(files_struct *fsp,
}
DEBUG(10,("release_level_2_oplocks_on_change: num_share_modes = %d\n",
- lck->num_share_modes ));
+ lck->data->num_share_modes ));
- for(i = 0; i < lck->num_share_modes; i++) {
- struct share_mode_entry *share_entry = &lck->share_modes[i];
+ for(i = 0; i < lck->data->num_share_modes; i++) {
+ struct share_mode_entry *share_entry = &lck->data->share_modes[i];
char msg[MSG_SMB_SHARE_MODE_ENTRY_SIZE];
if (!is_valid_share_mode_entry(share_entry)) {
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index b8da33549c..5b0f7cf6c8 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -5855,7 +5855,7 @@ static void rename_open_files(connection_struct *conn,
NTSTATUS status;
uint32_t new_name_hash = 0;
- for(fsp = file_find_di_first(conn->sconn, lck->id); fsp;
+ for(fsp = file_find_di_first(conn->sconn, lck->data->id); fsp;
fsp = file_find_di_next(fsp)) {
/* fsp_name is a relative path under the fsp. To change this for other
sharepaths we need to manipulate relative paths. */
@@ -5881,7 +5881,7 @@ static void rename_open_files(connection_struct *conn,
if (!did_rename) {
DEBUG(10, ("rename_open_files: no open files on file_id %s "
- "for %s\n", file_id_string_tos(&lck->id),
+ "for %s\n", file_id_string_tos(&lck->data->id),
smb_fname_str_dbg(smb_fname_dst)));
}
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
index 4e86fbfcdd..ba6bcbbb9e 100644
--- a/source3/smbd/trans2.c
+++ b/source3/smbd/trans2.c
@@ -7585,8 +7585,8 @@ static NTSTATUS smb_posix_unlink(connection_struct *conn,
* don't delete. If all opens are POSIX delete we can set the delete
* on close disposition.
*/
- for (i=0; i<lck->num_share_modes; i++) {
- struct share_mode_entry *e = &lck->share_modes[i];
+ for (i=0; i<lck->data->num_share_modes; i++) {
+ struct share_mode_entry *e = &lck->data->share_modes[i];
if (is_valid_share_mode_entry(e)) {
if (e->flags & SHARE_MODE_FLAG_POSIX_OPEN) {
continue;