From: Stefan Metzmacher Date: Thu, 23 Feb 2012 13:45:46 +0000 (+0100) Subject: fix race and do a normal close X-Git-Url: http://git.samba.org/?a=commitdiff_plain;ds=sidebyside;h=4f517e41992b38c0dc7da11112569fbc79cda87c;p=metze%2Fsamba%2Fwip.git fix race and do a normal close --- diff --git a/source3/smbd/close.c b/source3/smbd/close.c index 03ee59bc4f40..e96d0f31144c 100644 --- a/source3/smbd/close.c +++ b/source3/smbd/close.c @@ -683,19 +683,50 @@ static NTSTATUS close_normal_file(struct smb_request *req, files_struct *fsp, struct share_mode_lock *lck; lck = get_existing_share_mode_lock(talloc_tos(), fsp->file_id); - if (lck != NULL) { + 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 + + TALLOC_FREE(lck); + + tmp = fd_close(fsp); + status = ntstatus_keeperror(status, tmp); + file_free(req, fsp); + return status; } +#if 0 TALLOC_FREE(lck); tmp = fd_close(fsp); status = ntstatus_keeperror(status, tmp); file_free(req, fsp); return status; +#endif } /*