s3: get_share_mode_lock->get_existing_share_mode_lock
authorVolker Lendecke <vl@samba.org>
Sun, 19 Feb 2012 13:23:56 +0000 (14:23 +0100)
committerVolker Lendecke <vl@samba.org>
Sun, 19 Feb 2012 16:44:26 +0000 (17:44 +0100)
source3/locking/locking.c
source3/locking/proto.h
source3/smbd/close.c
source3/smbd/open.c
source3/smbd/oplock.c
source3/smbd/reply.c
source3/smbd/trans2.c

index 7063b54d9cafb219f66075e5038d6e3777dae82e..385db18b956f99f4b5f00ffe3af0e7190c72429e 100644 (file)
@@ -453,8 +453,8 @@ char *share_mode_str(TALLOC_CTX *ctx, int num, const struct share_mode_entry *e)
  counts it internally to allow for nested lock fetches.
 ********************************************************************/
 
-struct share_mode_lock *get_share_mode_lock(TALLOC_CTX *mem_ctx,
-                                           const struct file_id id)
+struct share_mode_lock *get_existing_share_mode_lock(TALLOC_CTX *mem_ctx,
+                                                    const struct file_id id)
 {
        return get_share_mode_lock_fresh(mem_ctx, id, NULL, NULL, NULL);
 }
@@ -953,7 +953,7 @@ bool set_delete_on_close(files_struct *fsp, bool delete_on_close, const struct s
                  delete_on_close ? "Adding" : "Removing", fsp->fnum,
                  fsp_str_dbg(fsp)));
 
-       lck = get_share_mode_lock(talloc_tos(), fsp->file_id);
+       lck = get_existing_share_mode_lock(talloc_tos(), fsp->file_id);
        if (lck == NULL) {
                return False;
        }
@@ -1006,7 +1006,7 @@ bool set_sticky_write_time(struct file_id fileid, struct timespec write_time)
                            convert_timespec_to_time_t(write_time)),
                 file_id_string_tos(&fileid)));
 
-       lck = get_share_mode_lock(talloc_tos(), fileid);
+       lck = get_existing_share_mode_lock(talloc_tos(), fileid);
        if (lck == NULL) {
                return False;
        }
@@ -1029,7 +1029,7 @@ bool set_write_time(struct file_id fileid, struct timespec write_time)
                            convert_timespec_to_time_t(write_time)),
                 file_id_string_tos(&fileid)));
 
-       lck = get_share_mode_lock(talloc_tos(), fileid);
+       lck = get_existing_share_mode_lock(talloc_tos(), fileid);
        if (lck == NULL) {
                return False;
        }
index 25f3d196b83efd3aa4a6b4bf9e5cb797c47d4149..1aa1d5035afb9b6eb7253d7d6bd84f6352aea9e8 100644 (file)
@@ -146,8 +146,8 @@ bool locking_init(void);
 bool locking_init_readonly(void);
 bool locking_end(void);
 char *share_mode_str(TALLOC_CTX *ctx, int num, const struct share_mode_entry *e);
-struct share_mode_lock *get_share_mode_lock(TALLOC_CTX *mem_ctx,
-                                           const struct file_id id);
+struct share_mode_lock *get_existing_share_mode_lock(TALLOC_CTX *mem_ctx,
+                                                    const struct file_id id);
 struct share_mode_lock *get_share_mode_lock_fresh(
        TALLOC_CTX *mem_ctx,
        const struct file_id id,
index 42e88d82ea3691f7a7b3b4ff53aa8dc0ba681450..1a123b49c8ac21ae70926873e6285285eaac5eb4 100644 (file)
@@ -347,7 +347,7 @@ static NTSTATUS close_remove_share_mode(files_struct *fsp,
         * This prevents race conditions with the file being created. JRA.
         */
 
-       lck = get_share_mode_lock(talloc_tos(), fsp->file_id);
+       lck = get_existing_share_mode_lock(talloc_tos(), fsp->file_id);
        if (lck == NULL) {
                DEBUG(0, ("close_remove_share_mode: Could not get share mode "
                          "lock for file %s\n", fsp_str_dbg(fsp)));
@@ -615,7 +615,7 @@ static NTSTATUS update_write_time_on_close(struct files_struct *fsp)
         * must update it in the open file db too. */
        (void)set_write_time(fsp->file_id, fsp->close_write_time);
 
-       lck = get_share_mode_lock(talloc_tos(), fsp->file_id);
+       lck = get_existing_share_mode_lock(talloc_tos(), fsp->file_id);
        if (lck) {
                /* Close write times overwrite sticky write times
                   so we must replace any sticky write time here. */
@@ -1017,7 +1017,7 @@ static NTSTATUS close_directory(struct smb_request *req, files_struct *fsp,
         * reference to a directory also.
         */
 
-       lck = get_share_mode_lock(talloc_tos(), fsp->file_id);
+       lck = get_existing_share_mode_lock(talloc_tos(), fsp->file_id);
        if (lck == NULL) {
                DEBUG(0, ("close_directory: Could not get share mode lock for "
                          "%s\n", fsp_str_dbg(fsp)));
index daa9bb9188469f4c02c070fcdd0182508cb7401f..ed3ef90f1691d92884d17c23fac39b37e214c627 100644 (file)
@@ -1594,7 +1594,8 @@ NTSTATUS smbd_calculate_access_mask(connection_struct *conn,
 void remove_deferred_open_entry(struct file_id id, uint64_t mid,
                                struct server_id pid)
 {
-       struct share_mode_lock *lck = get_share_mode_lock(talloc_tos(), id);
+       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;
index 0c4155d9d68ae77eff522a9a075a44c6db94796b..f760171c3a273636deb42fb31ec6d39352b36e9e 100644 (file)
@@ -162,7 +162,7 @@ bool remove_oplock(files_struct *fsp)
        struct share_mode_lock *lck;
 
        /* Remove the oplock flag from the sharemode. */
-       lck = get_share_mode_lock(talloc_tos(), fsp->file_id);
+       lck = get_existing_share_mode_lock(talloc_tos(), fsp->file_id);
        if (lck == NULL) {
                DEBUG(0,("remove_oplock: failed to lock share entry for "
                         "file %s\n", fsp_str_dbg(fsp)));
@@ -188,7 +188,7 @@ bool downgrade_oplock(files_struct *fsp)
        bool ret;
        struct share_mode_lock *lck;
 
-       lck = get_share_mode_lock(talloc_tos(), fsp->file_id);
+       lck = get_existing_share_mode_lock(talloc_tos(), fsp->file_id);
        if (lck == NULL) {
                DEBUG(0,("downgrade_oplock: failed to lock share entry for "
                         "file %s\n", fsp_str_dbg(fsp)));
@@ -804,7 +804,7 @@ static void do_break_to_none(struct tevent_req *req)
                DEBUG(1, ("tevent_wakeup_recv failed\n"));
                goto done;
        }
-       lck = get_share_mode_lock(talloc_tos(), state->id);
+       lck = get_existing_share_mode_lock(talloc_tos(), state->id);
        if (lck == NULL) {
                DEBUG(1, ("release_level_2_oplocks_on_change: failed to lock "
                          "share mode entry for file %s.\n",
index b026d34c671559e328463bde6391471a77321ce2..eebd77d3efa7df7dbcca191e63c84045c2bf7325 100644 (file)
@@ -6205,7 +6205,7 @@ NTSTATUS rename_internals_fsp(connection_struct *conn,
                status = NT_STATUS_ACCESS_DENIED;
        }
 
-       lck = get_share_mode_lock(talloc_tos(), fsp->file_id);
+       lck = get_existing_share_mode_lock(talloc_tos(), fsp->file_id);
 
        /*
         * We have the file open ourselves, so not being able to get the
index 336e76e481afb687cafdf3bdd5ee2323d0ba0044..d2eff4d8f5dcc80f9aac58a91a63af56980e9bd0 100644 (file)
@@ -7565,7 +7565,7 @@ static NTSTATUS smb_posix_unlink(connection_struct *conn,
         * non-POSIX opens return SHARING_VIOLATION.
         */
 
-       lck = get_share_mode_lock(talloc_tos(), fsp->file_id);
+       lck = get_existing_share_mode_lock(talloc_tos(), fsp->file_id);
        if (lck == NULL) {
                DEBUG(0, ("smb_posix_unlink: Could not get share mode "
                          "lock for file %s\n", fsp_str_dbg(fsp)));