Revert "durable open: locking db invalid server_id... TODO retest after rebase"
authorStefan Metzmacher <metze@samba.org>
Thu, 31 May 2012 10:12:53 +0000 (12:12 +0200)
committerStefan Metzmacher <metze@samba.org>
Fri, 1 Jun 2012 09:53:56 +0000 (11:53 +0200)
This reverts commit 8fbca43b788c3dff4e5e5bfb5607e1cf88cdb19a.

source3/lib/serverid.c
source3/lib/util.c
source3/locking/locking.c
source3/smbd/close.c
source3/smbd/open.c

index 5e9125c18defecdafc23f0da8676a027f4b96b4c..48d5b4251a18d842ca2d14c20d5457c4bbdc15a0 100644 (file)
@@ -294,8 +294,8 @@ bool serverids_exist(const struct server_id *ids, int num_ids, bool *results)
 
 #ifdef HAVE_CTDB_CONTROL_CHECK_SRVIDS_DECL
        if (lp_clustering()) {
-//             return ctdb_serverids_exist(messaging_ctdbd_connection(),
-//                                         ids, num_ids, results);
+               return ctdb_serverids_exist(messaging_ctdbd_connection(),
+                                           ids, num_ids, results);
        }
 #endif
        if (!processes_exist(ids, num_ids, results)) {
@@ -319,18 +319,6 @@ bool serverids_exist(const struct server_id *ids, int num_ids, bool *results)
                if (!results[i]) {
                        continue;
                }
-#if 0
-       typedef [public] struct {
-               hyper pid;
-               uint32 task_id;
-               uint32 vnn;
-               hyper unique_id;
-       } server_id;
-#endif
-               if (ids[i].unique_id == UINT64_MAX) {
-                       // bug #8760 :-)
-                       continue;
-               }
 
                serverid_fill_key(&ids[i], &key);
                tdbkey = make_tdb_data((uint8_t *)&key, sizeof(key));
index ac083b9fec38253e7f6e8ca533bee25cd8771452..49cd7719e365fe13ad14a65fc67443dac032d14d 100644 (file)
@@ -724,28 +724,10 @@ bool processes_exist(const struct server_id *pids, int num_pids,
        num_remote_pids = 0;
 
        for (i=0; i<num_pids; i++) {
-               results[i] = false;
-
                if (procid_is_me(&pids[i])) {
                        results[i] = true;
                        continue;
                }
-#if 0
-       typedef [public] struct {
-               hyper pid;
-               uint32 task_id;
-               uint32 vnn;
-               hyper unique_id;
-       } server_id;
-#endif
-               if (pids[i].pid == UINT64_MAX &&
-                   pids[i].task_id == UINT32_MAX &&
-                   pids[i].vnn == UINT32_MAX &&
-                   pids[i].unique_id == UINT64_MAX) {
-                       // bug #8760 :-) :-) ok
-                       results[i] = true;
-                       continue;
-               }
                if (procid_is_local(&pids[i])) {
                        results[i] = ((kill(pids[i].pid,0) == 0) ||
                                      (errno != ESRCH));
index 30f232fe5789e45d15fd4baccd11f0a3ac503488..00a46fa6190e1b1ef8567e1c18c8dc87b2dd6ee6 100644 (file)
@@ -648,19 +648,6 @@ bool share_mode_stale_pid(struct share_mode_data *d, unsigned i)
                return false;
        }
        e = &d->share_modes[i];
-
-       // TODO... is this still correct?
-       if (d->num_share_modes == 1 &&
-           e->pid.pid == UINT64_MAX &&
-           e->pid.task_id == UINT32_MAX &&
-           e->pid.vnn == UINT32_MAX &&
-           e->pid.unique_id == UINT64_MAX) {
-               *e = d->share_modes[d->num_share_modes-1];
-               d->num_share_modes -= 1;
-               d->modified = True;
-               return true;
-       }
-
        if (serverid_exists(&e->pid)) {
                DEBUG(10, ("PID %s (index %u out of %u) still exists\n",
                           procid_str_static(&e->pid), i,
@@ -731,23 +718,6 @@ static void fill_deferred_open_entry(struct share_mode_entry *e,
 static void add_share_mode_entry(struct share_mode_data *d,
                                 const struct share_mode_entry *entry)
 {
-       uint32_t i = 0;
-
-       while (i < d->num_share_modes) {
-               struct share_mode_entry *e = &d->share_modes[i];
-               if (e->pid.pid == UINT64_MAX &&
-                   e->pid.task_id == UINT32_MAX &&
-                   e->pid.vnn == UINT32_MAX &&
-                   e->pid.unique_id == UINT64_MAX) {
-                       *e = d->share_modes[d->num_share_modes-1];
-                       d->num_share_modes -= 1;
-                       d->modified = True;
-                       continue;
-               }
-
-               i += 1;
-       }
-
        ADD_TO_ARRAY(d, struct share_mode_entry, *entry,
                     &d->share_modes, &d->num_share_modes);
        d->modified = True;
@@ -826,7 +796,6 @@ static struct share_mode_entry *find_share_mode_entry(struct share_mode_data *d,
 bool del_share_mode(struct share_mode_lock *lck, files_struct *fsp)
 {
        struct share_mode_entry entry, *e;
-       uint32_t i = 0;
 
        /* Don't care about the pid owner being correct here - just a search. */
        fill_share_mode_entry(&entry, fsp, (uid_t)-1, 0, NO_OPLOCK);
@@ -838,22 +807,6 @@ bool del_share_mode(struct share_mode_lock *lck, files_struct *fsp)
        *e = lck->data->share_modes[lck->data->num_share_modes-1];
        lck->data->num_share_modes -= 1;
        lck->data->modified = True;
-
-       while (i < lck->data->num_share_modes) {
-               e = &lck->data->share_modes[i];
-
-               if (e->pid.pid == UINT64_MAX &&
-                   e->pid.task_id == UINT32_MAX &&
-                   e->pid.vnn == UINT32_MAX &&
-                   e->pid.unique_id == UINT64_MAX) {
-                       *e = lck->data->share_modes[lck->data->num_share_modes-1];
-                       lck->data->num_share_modes -= 1;
-                       continue;
-               }
-
-               i += 1;
-       }
-
        return True;
 }
 
index 2252ce73d075fe5c1d4a7f2643f7a623631818a9..4b7f6945107cd28d4cf50194b623c3e68067cd42 100644 (file)
@@ -688,7 +688,6 @@ static NTSTATUS close_normal_file(struct smb_request *req, files_struct *fsp,
        NTSTATUS status = NT_STATUS_OK;
        NTSTATUS tmp;
        connection_struct *conn = fsp->conn;
-       struct smbd_server_connection *sconn = conn->sconn;
        int ret;
 
        /*
@@ -701,71 +700,6 @@ static NTSTATUS close_normal_file(struct smb_request *req, files_struct *fsp,
                        status, map_nt_error_from_unix(ret));
        }
 
-       if (close_type == SHUTDOWN_CLOSE && fsp->smbXsrv->global->durable) {
-               struct share_mode_lock *lck;
-
-               lck = get_existing_share_mode_lock(talloc_tos(), fsp->file_id);
-               if (lck != NULL && lck->data->num_share_modes == 1) {
-                       lck->data->share_modes[0].pid.pid = UINT64_MAX;
-                       lck->data->share_modes[0].pid.task_id = UINT32_MAX;
-                       lck->data->share_modes[0].pid.vnn = UINT32_MAX;
-                       lck->data->share_modes[0].pid.unique_id = UINT64_MAX; //todo place NTTIME expire timer here
-                       lck->data->modified = true;
-#if 0
-               } else if (lck != NULL) {
-                       uint32_t i;
-
-                       for (i=0; i < lck->data->num_share_modes; i++) {
-                               struct share_mode_entry *e = &lck->data->share_modes[i];
-                               char msg[MSG_SMB_SHARE_MODE_ENTRY_SIZE];
-
-                               if (procid_is_me(&e->pid)) {
-                                       continue;
-                               }
-
-                               share_mode_entry_to_message(msg, e);
-
-                               messaging_send_buf(fsp->conn->sconn->msg_ctx,
-                                                  e->pid,
-                                                  MSG_SMB_BREAK_RESPONSE,
-                                                  (uint8 *)msg,
-                                                  MSG_SMB_SHARE_MODE_ENTRY_SIZE);
-                       }
-               }
-#endif
-
-                       tmp = close_filestruct(fsp);
-                       status = ntstatus_keeperror(status, tmp);
-
-                       if (fsp->oplock_type == LEVEL_II_OPLOCK) {
-                               sconn->oplocks.level_II_open--;
-                       } else if (EXCLUSIVE_OPLOCK_TYPE(fsp->oplock_type)) {
-                               sconn->oplocks.exclusive_open--;
-                       }
-
-                       SMB_ASSERT(sconn->oplocks.exclusive_open>=0);
-                       SMB_ASSERT(sconn->oplocks.level_II_open>=0);
-
-                       TALLOC_FREE(lck);
-
-                       tmp = fd_close(fsp);
-                       status = ntstatus_keeperror(status, tmp);
-                       file_free(req, fsp);
-                       return status;
-               }
-
-               TALLOC_FREE(lck);
-
-#if 0
-               TALLOC_FREE(lck);
-
-               tmp = fd_close(fsp);
-               status = ntstatus_keeperror(status, tmp);
-               file_free(req, fsp);
-               return status;
-#endif
-       }
-
        /*
         * If we're flushing on a close we can get a write
         * error here, we must remember this.
index 4e5415b0d759391bdc39a0da5698b9d5a5707080..9042e90a84a82c7ac71ca6ec0f616d9369024bcf 100644 (file)
@@ -821,10 +821,6 @@ static bool share_conflict(struct share_mode_entry *entry,
                  (unsigned int)entry->share_access,
                  (unsigned int)entry->private_options));
 
-       if (entry->pid.pid == UINT64_MAX) {
-               return false;
-       }
-
        DEBUG(10,("share_conflict: access_mask = 0x%x, share_access = 0x%x\n",
                  (unsigned int)access_mask, (unsigned int)share_access));
 
@@ -1209,11 +1205,6 @@ static bool delay_for_batch_oplocks(files_struct *fsp,
                return false;
        }
 
-       if (batch_entry->pid.pid == UINT64_MAX) {
-               /* TODO: clean up */
-               return false;
-       }
-
        /* Found a batch oplock */
        send_break_message(fsp, batch_entry, mid, oplock_request);
        return true;
@@ -1233,11 +1224,6 @@ static bool delay_for_exclusive_oplocks(files_struct *fsp,
                return false;
        }
 
-       if (ex_entry->pid.pid == UINT64_MAX) {
-               /* TODO: clean up */
-               return false;
-       }
-
        /* Found an exclusive or batch oplock */
 
        delay_it = is_delete_request(fsp) ?