s3: [3/3]: Fix a delete on close divergence from windows and the associated torture...
authorTim Prouty <tprouty@samba.org>
Sun, 7 Dec 2008 00:08:35 +0000 (16:08 -0800)
committerTim Prouty <tprouty@samba.org>
Wed, 10 Dec 2008 02:06:49 +0000 (18:06 -0800)
This third patch cleans up by removing all of the code that is made
obsolete by the first patch.  It should cause no functional changes.

source3/include/proto.h
source3/include/smb.h
source3/locking/locking.c
source3/modules/onefs_open.c
source3/smbd/open.c
source3/smbd/reply.c

index d0ad361701e694674dceef748c1aa4a133ec90ed..2ba01b30ed05a8c89fe0a8fa91413f42b3fa4802 100644 (file)
@@ -3455,7 +3455,7 @@ bool is_valid_share_mode_entry(const struct share_mode_entry *e);
 bool is_deferred_open_entry(const struct share_mode_entry *e);
 bool is_unused_share_mode_entry(const struct share_mode_entry *e);
 void set_share_mode(struct share_mode_lock *lck, files_struct *fsp,
-                       uid_t uid, uint16 mid, uint16 op_type, bool initial_delete_on_close_allowed);
+                   uid_t uid, uint16 mid, uint16 op_type);
 void add_deferred_open(struct share_mode_lock *lck, uint16 mid,
                       struct timeval request_time,
                       struct file_id id);
@@ -3465,11 +3465,9 @@ bool remove_share_oplock(struct share_mode_lock *lck, files_struct *fsp);
 bool downgrade_share_oplock(struct share_mode_lock *lck, files_struct *fsp);
 NTSTATUS can_set_delete_on_close(files_struct *fsp, bool delete_on_close,
                                 uint32 dosmode);
-bool can_set_initial_delete_on_close(const struct share_mode_lock *lck);
 void set_delete_on_close_token(struct share_mode_lock *lck, UNIX_USER_TOKEN *tok);
 void set_delete_on_close_lck(struct share_mode_lock *lck, bool delete_on_close, UNIX_USER_TOKEN *tok);
 bool set_delete_on_close(files_struct *fsp, bool delete_on_close, UNIX_USER_TOKEN *tok);
-bool set_allow_initial_delete_on_close(struct share_mode_lock *lck, files_struct *fsp, bool delete_on_close);
 bool set_sticky_write_time(struct file_id fileid, struct timespec write_time);
 bool set_write_time(struct file_id fileid, struct timespec write_time);
 int share_mode_forall(void (*fn)(const struct share_mode_entry *, const char *,
index 39673e1ff75dded299f034fe02d703cf93006cd9..112b4e0f91c1e6fa33b1548829e76315e7d52459 100644 (file)
@@ -710,7 +710,6 @@ struct pending_message_list {
 };
 
 #define SHARE_MODE_FLAG_POSIX_OPEN     0x1
-#define SHARE_MODE_ALLOW_INITIAL_DELETE_ON_CLOSE      0x2
 
 /* struct returned by get_share_modes */
 struct share_mode_entry {
index 33717f1bb98c112a3f9a23bbafba6583c5e8fce7..a70f9d20feb69d7921f1ec418e8bf8241aaaed07 100644 (file)
@@ -1067,13 +1067,10 @@ static void add_share_mode_entry(struct share_mode_lock *lck,
 }
 
 void set_share_mode(struct share_mode_lock *lck, files_struct *fsp,
-                       uid_t uid, uint16 mid, uint16 op_type, bool initial_delete_on_close_allowed)
+                   uid_t uid, uint16 mid, uint16 op_type)
 {
        struct share_mode_entry entry;
        fill_share_mode_entry(&entry, fsp, uid, mid, op_type);
-       if (initial_delete_on_close_allowed) {
-               entry.flags |= SHARE_MODE_ALLOW_INITIAL_DELETE_ON_CLOSE;
-       }
        add_share_mode_entry(lck, &entry);
 }
 
@@ -1271,22 +1268,6 @@ NTSTATUS can_set_delete_on_close(files_struct *fsp, bool delete_on_close,
        return NT_STATUS_OK;
 }
 
-/****************************************************************************
- Do we have an open file handle that created this entry ?
-****************************************************************************/
-
-bool can_set_initial_delete_on_close(const struct share_mode_lock *lck)
-{
-       int i;
-
-       for (i=0; i<lck->num_share_modes; i++) {
-               if (lck->share_modes[i].flags & SHARE_MODE_ALLOW_INITIAL_DELETE_ON_CLOSE) {
-                       return True;
-               }
-       }
-       return False;
-}
-
 /*************************************************************************
  Return a talloced copy of a UNIX_USER_TOKEN. NULL on fail.
  (Should this be in locking.c.... ?).
@@ -1380,31 +1361,6 @@ bool set_delete_on_close(files_struct *fsp, bool delete_on_close, UNIX_USER_TOKE
        return True;
 }
 
-/****************************************************************************
- Sets the allow initial delete on close flag for this share mode.
-****************************************************************************/
-
-bool set_allow_initial_delete_on_close(struct share_mode_lock *lck, files_struct *fsp, bool delete_on_close)
-{
-       struct share_mode_entry entry, *e;
-
-       /* 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);
-
-       e = find_share_mode_entry(lck, &entry);
-       if (e == NULL) {
-               return False;
-       }
-
-       if (delete_on_close) {
-               e->flags |= SHARE_MODE_ALLOW_INITIAL_DELETE_ON_CLOSE;
-       } else {
-               e->flags &= ~SHARE_MODE_ALLOW_INITIAL_DELETE_ON_CLOSE;
-       }
-       lck->modified = True;
-       return True;
-}
-
 bool set_sticky_write_time(struct file_id fileid, struct timespec write_time)
 {
        struct share_mode_lock *lck;
index bda5e7e91a5d8123e176debab493038e51a23f5d..d0310d017486c8982919ce2348146d93326621f2 100644 (file)
@@ -1182,7 +1182,7 @@ NTSTATUS onefs_open_file_ntcreate(connection_struct *conn,
        }
 
        set_share_mode(lck, fsp, conn->server_info->utok.uid, 0,
-                      fsp->oplock_type, true);
+                      fsp->oplock_type);
 
        /* Handle strange delete on close create semantics. */
        if (create_options & FILE_DELETE_ON_CLOSE) {
@@ -1521,8 +1521,7 @@ static NTSTATUS onefs_open_directory(connection_struct *conn,
                return NT_STATUS_DELETE_PENDING;
        }
 
-       set_share_mode(lck, fsp, conn->server_info->utok.uid, 0, NO_OPLOCK,
-                      true);
+       set_share_mode(lck, fsp, conn->server_info->utok.uid, 0, NO_OPLOCK);
 
        /*
         * For directories the delete on close bit at open time seems
index 8882e5438b8edbf469fad6e298d07f53ef733278..77ad1664ef0300bed60937163145fe44c0279553 100644 (file)
@@ -1981,7 +1981,7 @@ static NTSTATUS open_file_ntcreate(connection_struct *conn,
        }
 
        set_share_mode(lck, fsp, conn->server_info->utok.uid, 0,
-                      fsp->oplock_type, new_file_created);
+                      fsp->oplock_type);
 
        /* Handle strange delete on close create semantics. */
        if (create_options & FILE_DELETE_ON_CLOSE) {
@@ -2419,8 +2419,7 @@ static NTSTATUS open_directory(connection_struct *conn,
                return status;
        }
 
-       set_share_mode(lck, fsp, conn->server_info->utok.uid, 0, NO_OPLOCK,
-                      True);
+       set_share_mode(lck, fsp, conn->server_info->utok.uid, 0, NO_OPLOCK);
 
        /* For directories the delete on close bit at open time seems
           always to be honored on close... See test 19 in Samba4 BASE-DELETE. */
index 00c744ce1a797a01df528c73cf80a345c30ffc64..9f7a1896b83f9be20ecbbd481671814b57e513a1 100644 (file)
@@ -5583,8 +5583,6 @@ NTSTATUS rename_internals_fsp(connection_struct *conn,
                 * depends on these semantics. JRA.
                 */
 
-               set_allow_initial_delete_on_close(lck, fsp, True);
-
                if (create_options & FILE_DELETE_ON_CLOSE) {
                        status = can_set_delete_on_close(fsp, True, 0);