diff options
author | Stefan Metzmacher <metze@samba.org> | 2008-02-21 12:20:31 +0100 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2008-02-25 11:50:39 +0100 |
commit | 6cb9c1c61d8087457420a56f5296662417a25bd4 (patch) | |
tree | c895439d6c910b45eff6ce0a6cf457631247698f /source4 | |
parent | 27e322bb4d5a25a2a1ebc5df36690590d86e3afd (diff) | |
download | samba-6cb9c1c61d8087457420a56f5296662417a25bd4.tar.gz samba-6cb9c1c61d8087457420a56f5296662417a25bd4.tar.bz2 samba-6cb9c1c61d8087457420a56f5296662417a25bd4.zip |
opendb: send also the oplock break level on MSG_NTVFS_OPLOCK_BREAK
metze
(This used to be commit 49402007f6e9e02a29792344c088e40d1a9b7acf)
Diffstat (limited to 'source4')
-rw-r--r-- | source4/ntvfs/common/opendb.h | 4 | ||||
-rw-r--r-- | source4/ntvfs/common/opendb_tdb.c | 28 |
2 files changed, 27 insertions, 5 deletions
diff --git a/source4/ntvfs/common/opendb.h b/source4/ntvfs/common/opendb.h index 5472cea418..ccf6db27a0 100644 --- a/source4/ntvfs/common/opendb.h +++ b/source4/ntvfs/common/opendb.h @@ -43,6 +43,10 @@ struct opendb_ops { uint32_t access_mask); }; +struct opendb_oplock_break { + void *file_handle; + uint8_t level; +}; void odb_set_ops(const struct opendb_ops *new_ops); void odb_tdb_init_ops(void); diff --git a/source4/ntvfs/common/opendb_tdb.c b/source4/ntvfs/common/opendb_tdb.c index 469cf28374..25f37f5e26 100644 --- a/source4/ntvfs/common/opendb_tdb.c +++ b/source4/ntvfs/common/opendb_tdb.c @@ -259,12 +259,28 @@ static NTSTATUS odb_push_record(struct odb_lock *lck, struct opendb_file *file) /* send an oplock break to a client */ -static NTSTATUS odb_oplock_break_send(struct odb_context *odb, struct opendb_entry *e) +static NTSTATUS odb_oplock_break_send(struct odb_context *odb, + struct opendb_entry *e, + uint8_t level) { + NTSTATUS status; + struct opendb_oplock_break op_break; + DATA_BLOB blob; + + ZERO_STRUCT(op_break); + /* tell the server handling this open file about the need to send the client a break */ - return messaging_send_ptr(odb->ntvfs_ctx->msg_ctx, e->server, - MSG_NTVFS_OPLOCK_BREAK, e->file_handle); + op_break.file_handle = e->file_handle; + op_break.level = level; + + blob = data_blob_const(&op_break, sizeof(op_break)); + + status = messaging_send(odb->ntvfs_ctx->msg_ctx, e->server, + MSG_NTVFS_OPLOCK_BREAK, &blob); + NT_STATUS_NOT_OK_RETURN(status); + + return NT_STATUS_OK; } /* @@ -318,7 +334,8 @@ static NTSTATUS odb_tdb_open_file(struct odb_lock *lck, void *file_handle, break request and suspending this call until the break is acknowledged or the file is closed */ - odb_oplock_break_send(odb, &file.entries[i]); + odb_oplock_break_send(odb, &file.entries[i], + OPLOCK_BREAK_TO_LEVEL_II/*TODO*/); return NT_STATUS_OPLOCK_NOT_GRANTED; } } @@ -342,7 +359,8 @@ static NTSTATUS odb_tdb_open_file(struct odb_lock *lck, void *file_handle, exclusive oplocks afterwards. */ for (i=0;i<file.num_entries;i++) { if (file.entries[i].oplock_level == OPLOCK_EXCLUSIVE) { - odb_oplock_break_send(odb, &file.entries[i]); + odb_oplock_break_send(odb, &file.entries[i], + OPLOCK_BREAK_TO_NONE/*TODO*/); return NT_STATUS_OPLOCK_NOT_GRANTED; } } |