In a cluster and with changed messaging it can happen that messages are
scheduled after new SMB requests. This re-ordering breaks a few notify tests.
This starts the infrastructure to add timestamps to notify events, so that they
can be sorted before they are sent out. The timestamp will be the current local
time of notify_fname, that's all we can do.
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
#include "smbd/globals.h"
#include "../librpc/gen_ndr/ndr_notify.h"
#include "smbd/globals.h"
#include "../librpc/gen_ndr/ndr_notify.h"
+struct notify_change_event {
+ struct timespec when;
+ uint32_t action;
+ const char *name;
+};
+
struct notify_change_buf {
/*
* If no requests are pending, changes are queued here. Simple array,
struct notify_change_buf {
/*
* If no requests are pending, changes are queued here. Simple array,
* asked we just return NT_STATUS_OK without specific changes.
*/
int num_changes;
* asked we just return NT_STATUS_OK without specific changes.
*/
int num_changes;
- struct notify_change *changes;
+ struct notify_change_event *changes;
/*
* If no changes are around requests are queued here. Using a linked
/*
* If no changes are around requests are queued here. Using a linked
-static bool notify_change_record_identical(struct notify_change *c1,
- struct notify_change *c2)
+static bool notify_change_record_identical(struct notify_change_event *c1,
+ struct notify_change_event *c2)
{
/* Note this is deliberately case sensitive. */
if (c1->action == c2->action &&
{
/* Note this is deliberately case sensitive. */
if (c1->action == c2->action &&
static bool notify_marshall_changes(int num_changes,
uint32 max_offset,
static bool notify_marshall_changes(int num_changes,
uint32 max_offset,
- struct notify_change *changes,
+ struct notify_change_event *changes,
DATA_BLOB *final_blob)
{
int i;
DATA_BLOB *final_blob)
{
int i;
for (i=0; i<num_changes; i++) {
enum ndr_err_code ndr_err;
for (i=0; i<num_changes; i++) {
enum ndr_err_code ndr_err;
- struct notify_change *c;
+ struct notify_change_event *c;
struct FILE_NOTIFY_INFORMATION m;
DATA_BLOB blob;
struct FILE_NOTIFY_INFORMATION m;
DATA_BLOB blob;
static void notify_fsp(files_struct *fsp, uint32 action, const char *name)
{
static void notify_fsp(files_struct *fsp, uint32 action, const char *name)
{
- struct notify_change *change, *changes;
+ struct notify_change_event *change, *changes;
char *tmp;
if (fsp->notify == NULL) {
char *tmp;
if (fsp->notify == NULL) {
if (!(changes = talloc_realloc(
fsp->notify, fsp->notify->changes,
if (!(changes = talloc_realloc(
fsp->notify, fsp->notify->changes,
- struct notify_change, fsp->notify->num_changes+1))) {
+ struct notify_change_event,
+ fsp->notify->num_changes+1))) {
DEBUG(0, ("talloc_realloc failed\n"));
return;
}
DEBUG(0, ("talloc_realloc failed\n"));
return;
}