From 2fc57c9a2ce3a266534dd20e6fed4883e052c557 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 8 Jun 2004 16:14:31 +0000 Subject: r1085: Now it's had some proper user testing, merge in the deferred open fix. I'm still doing more testing, but it fixes a behaviour that we've been wrong on ever since the start of Samba. Jeremy. (This used to be commit 894cc6d16296b934c112786eec896846156aee5d) --- source3/include/local.h | 3 +++ source3/include/smb.h | 62 ++++++++++++++++++++++++++++++++++--------------- 2 files changed, 46 insertions(+), 19 deletions(-) (limited to 'source3/include') diff --git a/source3/include/local.h b/source3/include/local.h index 540365047a..ee8d672553 100644 --- a/source3/include/local.h +++ b/source3/include/local.h @@ -230,4 +230,7 @@ /* size of listen() backlog in smbd */ #define SMBD_LISTEN_BACKLOG 50 +/* Number of microseconds to wait before a sharing violation. */ +#define SHARING_VIOLATION_USEC_WAIT 950000 + #endif diff --git a/source3/include/smb.h b/source3/include/smb.h index 54a69d1433..9100701e21 100644 --- a/source3/include/smb.h +++ b/source3/include/smb.h @@ -584,6 +584,24 @@ struct interface struct in_addr nmask; }; +/* struct used by share mode violation error processing */ +typedef struct { + pid_t pid; + uint16 mid; + struct timeval time; + SMB_DEV_T dev; + SMB_INO_T inode; + uint16 port; +} deferred_open_entry; + +/* Internal message queue for deferred opens. */ +struct pending_message_list { + struct pending_message_list *next, *prev; + struct timeval msg_time; /* The timeout time */ + DATA_BLOB buf; + DATA_BLOB private_data; +}; + /* struct returned by get_share_modes */ typedef struct { pid_t pid; @@ -663,28 +681,14 @@ struct locking_key { SMB_INO_T inode; }; -struct locking_data { - union { - int num_share_mode_entries; - share_mode_entry dummy; /* Needed for alignment. */ - } u; - /* the following two entries are implicit - share_mode_entry modes[num_share_mode_entries]; - char file_name[]; - */ -}; - - /* the following are used by loadparm for option lists */ -typedef enum -{ - P_BOOL,P_BOOLREV,P_CHAR,P_INTEGER,P_OCTAL,P_LIST, - P_STRING,P_USTRING,P_GSTRING,P_UGSTRING,P_ENUM,P_SEP +typedef enum { + P_BOOL,P_BOOLREV,P_CHAR,P_INTEGER,P_OCTAL,P_LIST, + P_STRING,P_USTRING,P_GSTRING,P_UGSTRING,P_ENUM,P_SEP } parm_type; -typedef enum -{ - P_LOCAL,P_GLOBAL,P_SEPARATOR,P_NONE +typedef enum { + P_LOCAL,P_GLOBAL,P_SEPARATOR,P_NONE } parm_class; /* passed to br lock code */ @@ -1410,6 +1414,7 @@ extern int chain_size; #define EXCLUSIVE_OPLOCK 1 #define BATCH_OPLOCK 2 #define LEVEL_II_OPLOCK 4 +#define INTERNAL_OPEN_ONLY 8 #define EXCLUSIVE_OPLOCK_TYPE(lck) ((lck) & (EXCLUSIVE_OPLOCK|BATCH_OPLOCK)) #define BATCH_OPLOCK_TYPE(lck) ((lck) & BATCH_OPLOCK) @@ -1461,6 +1466,25 @@ extern int chain_size; #define LEVEL_II_OPLOCK_BREAK_CMD 0x3 #define ASYNC_LEVEL_II_OPLOCK_BREAK_CMD 0x4 +/* Add the "deferred open" message. */ +#define RETRY_DEFERRED_OPEN_CMD 0x5 + +/* + * And the message format for it. Keep the same message length. + * + * 0 2 2+pid 2+pid+dev 2+pid+dev+ino + * +----+--------+-------+--------+---------+ + * | cmd| pid | dev | inode | mid | + * +----+--------+-------+--------+---------+ + */ + +#define DEFERRED_OPEN_CMD_OFFSET 0 +#define DEFERRED_OPEN_PID_OFFSET 2 /* pid we're *sending* from. */ +#define DEFERRED_OPEN_DEV_OFFSET (DEFERRED_OPEN_PID_OFFSET + sizeof(pid_t)) +#define DEFERRED_OPEN_INODE_OFFSET (DEFERRED_OPEN_DEV_OFFSET + sizeof(SMB_DEV_T)) +#define DEFERRED_OPEN_MID_OFFSET (DEFERRED_OPEN_INODE_OFFSET + sizeof(SMB_INO_T)) +#define DEFERRED_OPEN_MSG_LEN OPLOCK_BREAK_MSG_LEN + /* * Capabilities abstracted for different systems. */ -- cgit