f->header->boot_id = boot_id;
f->header->state = STATE_ONLINE;
+
+ __sync_synchronize();
+
return 0;
}
assert(wt >= 0);
assert(wt < _WINDOW_MAX);
+ if (offset + size > (uint64_t) f->last_stat.st_size) {
+ /* Hmm, out of range? Let's refresh the fstat() data
+ * first, before we trust that check. */
+
+ if (fstat(f->fd, &f->last_stat) < 0 ||
+ offset + size > (uint64_t) f->last_stat.st_size)
+ return -EADDRNOTAVAIL;
+ }
+
w = f->windows + wt;
if (_likely_(w->ptr &&
delta = PAGE_ALIGN((DEFAULT_WINDOW_SIZE - size) / 2);
- if (offset < delta)
+ if (delta > offset)
delta = offset;
offset -= delta;
- size += (DEFAULT_WINDOW_SIZE - delta);
+ size = DEFAULT_WINDOW_SIZE;
} else
delta = 0;
- if (offset > (uint64_t) f->last_stat.st_size)
- return -EADDRNOTAVAIL;
-
if (offset + size > (uint64_t) f->last_stat.st_size)
size = PAGE_ALIGN((uint64_t) f->last_stat.st_size - offset);
assert(offset > 0);
assert(o->object.type == OBJECT_ENTRY);
+ __sync_synchronize();
+
/* Link up the entry itself */
r = link_entry_into_array(f,
&f->header->entry_array_offset,
ts->monotonic < le64toh(f->header->tail_entry_monotonic))
return -EINVAL;
- if (ts->realtime < le64toh(f->header->tail_entry_realtime))
- return -EINVAL;
-
items = alloca(sizeof(EntryItem) * n_iovec);
for (i = 0; i < n_iovec; i++) {