smbd: Remove unused share_mode_stale_pid()
authorVolker Lendecke <vl@samba.org>
Fri, 23 Aug 2019 15:44:25 +0000 (17:44 +0200)
committerJeremy Allison <jra@samba.org>
Tue, 17 Sep 2019 22:49:38 +0000 (22:49 +0000)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/locking/locking.c
source3/locking/proto.h

index cf64a962cd889f35410d028181b4e978590eda9a..e7b8fd3a503425cf7b924a71a296b00f6f8c3fd0 100644 (file)
@@ -756,58 +756,6 @@ bool share_entry_stale_pid(struct share_mode_entry *e)
        return true;
 }
 
-/*
- * In case d->share_modes[i] conflicts with something or otherwise is
- * being used, we need to make sure the corresponding process still
- * exists.
- */
-bool share_mode_stale_pid(struct share_mode_data *d, uint32_t idx)
-{
-       struct share_mode_entry *e;
-       bool stale;
-
-       if (idx > d->num_share_modes) {
-               DBG_WARNING("Asking for index %"PRIu32", "
-                           "only %"PRIu32" around\n",
-                           idx,
-                           d->num_share_modes);
-               return false;
-       }
-       e = &d->share_modes[idx];
-
-       stale = share_entry_stale_pid(e);
-       if (!stale) {
-               return false;
-       }
-       d->modified = true;
-
-       if (d->num_delete_tokens != 0) {
-               uint32_t i;
-
-               for (i=0; i<d->num_share_modes; i++) {
-                       bool valid = !d->share_modes[i].stale;
-                       if (valid) {
-                               break;
-                       }
-               }
-
-               if (i == d->num_share_modes) {
-                       /*
-                        * No valid (non-stale) share mode found, all
-                        * who might have set the delete token are
-                        * gone.
-                        */
-                       TALLOC_FREE(d->delete_tokens);
-                       d->num_delete_tokens = 0;
-               }
-       }
-
-       remove_share_mode_lease(d, e);
-
-       d->modified = true;
-       return true;
-}
-
 void remove_stale_share_mode_entries(struct share_mode_data *d)
 {
        uint32_t i;
@@ -822,6 +770,11 @@ void remove_stale_share_mode_entries(struct share_mode_data *d)
                }
                i += 1;
        }
+
+       if (d->num_share_modes == 0) {
+               TALLOC_FREE(d->delete_tokens);
+               d->num_delete_tokens = 0;
+       }
 }
 
 bool set_share_mode(struct share_mode_lock *lck,
index c08517d8ce1a79219a93ea9a93de2e6ba2079a75..a404fb6530ba9a3f313118610378459093059194 100644 (file)
@@ -170,7 +170,6 @@ void get_file_infos(struct file_id id,
                    struct timespec *write_time);
 bool is_valid_share_mode_entry(const struct share_mode_entry *e);
 bool share_entry_stale_pid(struct share_mode_entry *e);
-bool share_mode_stale_pid(struct share_mode_data *d, uint32_t idx);
 bool set_share_mode(struct share_mode_lock *lck,
                    struct files_struct *fsp,
                    uid_t uid,