summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2013-04-26 15:05:50 +0200
committerJeremy Allison <jra@samba.org>2013-04-26 15:17:22 -0700
commita7e803485d0255fa7fa92970ee535e1e2c9a29a1 (patch)
treeb7af058f744b040fee3d91bb6e3582e44b9ea8de /source3/smbd
parent8da5a0f1e33a85281610700b58b534bc985894f0 (diff)
downloadsamba-a7e803485d0255fa7fa92970ee535e1e2c9a29a1.tar.gz
samba-a7e803485d0255fa7fa92970ee535e1e2c9a29a1.tar.bz2
samba-a7e803485d0255fa7fa92970ee535e1e2c9a29a1.zip
smbd: We don't use DEFERRED_OPEN_ENTRY anymore
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/close.c85
-rw-r--r--source3/smbd/open.c63
-rw-r--r--source3/smbd/proto.h2
-rw-r--r--source3/smbd/smb2_create.c2
4 files changed, 0 insertions, 152 deletions
diff --git a/source3/smbd/close.c b/source3/smbd/close.c
index b7b8d4092a..94ec7897e7 100644
--- a/source3/smbd/close.c
+++ b/source3/smbd/close.c
@@ -165,88 +165,6 @@ static int compare_share_mode_times(const void *p1, const void *p2)
}
/****************************************************************************
- If any deferred opens are waiting on this close, notify them.
-****************************************************************************/
-
-static void notify_deferred_opens(struct smbd_server_connection *sconn,
- struct share_mode_lock *lck)
-{
- struct server_id self = messaging_server_id(sconn->msg_ctx);
- uint32_t i, num_deferred;
- struct share_mode_entry *deferred;
-
- if (!should_notify_deferred_opens(sconn)) {
- return;
- }
-
- num_deferred = 0;
- 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)) {
- continue;
- }
- if (share_mode_stale_pid(lck->data, i)) {
- continue;
- }
- num_deferred += 1;
- }
- if (num_deferred == 0) {
- return;
- }
-
- deferred = talloc_array(talloc_tos(), struct share_mode_entry,
- num_deferred);
- if (deferred == NULL) {
- return;
- }
-
- num_deferred = 0;
- 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;
- }
- }
-
- /*
- * We need to sort the notifications by initial request time. Imagine
- * two opens come in asyncronously, both conflicting with the open we
- * just close here. If we don't sort the notifications, the one that
- * came in last might get the response before the one that came in
- * first. This is demonstrated with the smbtorture4 raw.mux test.
- *
- * As long as we had the UNUSED_SHARE_MODE_ENTRY, we happened to
- * survive this particular test. Without UNUSED_SHARE_MODE_ENTRY, we
- * shuffle the share mode entries around a bit, so that we do not
- * survive raw.mux anymore.
- *
- * We could have kept the ordering in del_share_mode, but as the
- * ordering was never formalized I think it is better to do it here
- * where it is necessary.
- */
-
- qsort(deferred, num_deferred, sizeof(struct share_mode_entry),
- compare_share_mode_times);
-
- for (i=0; i<num_deferred; i++) {
- struct share_mode_entry *e = &deferred[i];
-
- if (serverid_equal(&self, &e->pid)) {
- /*
- * We need to notify ourself to retry the open. Do
- * this by finding the queued SMB record, moving it to
- * the head of the queue and changing the wait time to
- * zero.
- */
- schedule_deferred_open_message_smb(sconn, e->op_mid);
- }
- }
- TALLOC_FREE(deferred);
-}
-
-/****************************************************************************
Delete all streams
****************************************************************************/
@@ -431,9 +349,6 @@ static NTSTATUS close_remove_share_mode(files_struct *fsp,
}
}
- /* Notify any deferred opens waiting on this close. */
- notify_deferred_opens(conn->sconn, lck);
-
/*
* NT can set delete_on_close of the last open
* reference to a file.
diff --git a/source3/smbd/open.c b/source3/smbd/open.c
index 4442cfce01..eff36f002c 100644
--- a/source3/smbd/open.c
+++ b/source3/smbd/open.c
@@ -1025,16 +1025,6 @@ static void validate_my_share_entries(struct smbd_server_connection *sconn,
return;
}
- if (is_deferred_open_entry(share_entry) &&
- !open_was_deferred(sconn, share_entry->op_mid))
- {
- char *str = talloc_asprintf(talloc_tos(),
- "Got a deferred entry without a request: "
- "PANIC: %s\n",
- share_mode_str(talloc_tos(), num, share_entry));
- smb_panic(str);
- }
-
if (!is_valid_share_mode_entry(share_entry)) {
return;
}
@@ -1048,10 +1038,6 @@ static void validate_my_share_entries(struct smbd_server_connection *sconn,
"share entry with an open file\n");
}
- if (is_deferred_open_entry(share_entry)) {
- goto panic;
- }
-
if ((share_entry->op_type == NO_OPLOCK) &&
(fsp->oplock_type == FAKE_LEVEL_II_OPLOCK))
{
@@ -1475,30 +1461,6 @@ static void defer_open(struct share_mode_lock *lck,
struct smb_request *req,
struct deferred_open_record *state)
{
- struct server_id self = messaging_server_id(req->sconn->msg_ctx);
-
- /* Paranoia check */
-
- if (lck) {
- int 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) &&
- serverid_equal(&self, &e->pid) &&
- (e->op_mid == req->mid)) {
- DEBUG(0, ("Trying to defer an already deferred "
- "request: mid=%llu, exiting\n",
- (unsigned long long)req->mid));
- TALLOC_FREE(lck);
- exit_server("attempt to defer a deferred request");
- }
- }
- }
-
- /* End paranoia check */
-
DEBUG(10,("defer_open_sharing_error: time [%u.%06u] adding deferred "
"open entry for mid %llu\n",
(unsigned int)request_time.tv_sec,
@@ -1867,19 +1829,6 @@ NTSTATUS smbd_calculate_access_mask(connection_struct *conn,
Remove the deferred open entry under lock.
****************************************************************************/
-void remove_deferred_open_entry(struct file_id id, uint64_t mid,
- struct server_id pid)
-{
- struct share_mode_lock *lck = get_existing_share_mode_lock(
- talloc_tos(), id);
- if (lck == NULL) {
- DEBUG(0, ("could not get share mode lock\n"));
- return;
- }
- del_deferred_open_entry(lck, mid, pid);
- TALLOC_FREE(lck);
-}
-
/****************************************************************************
Return true if this is a state pointer to an asynchronous create.
****************************************************************************/
@@ -2115,12 +2064,6 @@ static NTSTATUS open_file_ntcreate(connection_struct *conn,
if (is_deferred_open_async(ptr)) {
SET_STAT_INVALID(smb_fname->st);
file_existed = false;
- } else {
- struct deferred_open_record *state = (struct deferred_open_record *)ptr;
- /* Remove the deferred open entry under lock. */
- remove_deferred_open_entry(
- state->id, req->mid,
- messaging_server_id(req->sconn->msg_ctx));
}
/* Ensure we don't reprocess this message. */
@@ -2833,12 +2776,6 @@ static NTSTATUS open_file_ntcreate(connection_struct *conn,
(unsigned int)new_unx_mode));
}
- /* If this is a successful open, we must remove any deferred open
- * records. */
- if (req != NULL) {
- del_deferred_open_entry(lck, req->mid,
- messaging_server_id(req->sconn->msg_ctx));
- }
TALLOC_FREE(lck);
return NT_STATUS_OK;
diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h
index 46c914810b..38707d50ff 100644
--- a/source3/smbd/proto.h
+++ b/source3/smbd/proto.h
@@ -620,8 +620,6 @@ NTSTATUS change_dir_owner_to_parent(connection_struct *conn,
const char *fname,
SMB_STRUCT_STAT *psbuf);
bool is_stat_open(uint32 access_mask);
-void remove_deferred_open_entry(struct file_id id, uint64_t mid,
- struct server_id pid);
bool is_deferred_open_async(const void *ptr);
NTSTATUS open_file_fchmod(connection_struct *conn,
struct smb_filename *smb_fname,
diff --git a/source3/smbd/smb2_create.c b/source3/smbd/smb2_create.c
index 2173a0dd64..60ba73926d 100644
--- a/source3/smbd/smb2_create.c
+++ b/source3/smbd/smb2_create.c
@@ -1361,8 +1361,6 @@ static bool smbd_smb2_create_cancel(struct tevent_req *req)
return false;
}
- remove_deferred_open_entry(state->id, mid,
- messaging_server_id(smb2req->sconn->msg_ctx));
remove_deferred_open_message_smb2_internal(smb2req, mid);
tevent_req_defer_callback(req, smb2req->sconn->ev_ctx);