qemu-e2k/include/qemu
Daniel P. Berrangé b4682a63f8 filemon: fix watch IDs to avoid potential wraparound issues
Watch IDs are allocated from incrementing a int counter against
the QFileMonitor object. In very long life QEMU processes with
a huge amount of USB MTP activity creating & deleting directories
it is just about conceivable that the int counter can wrap
around. This would result in incorrect behaviour of the file
monitor watch APIs due to clashing watch IDs.

Instead of trying to detect this situation, this patch changes
the way watch IDs are allocated. It is turned into an int64_t
variable where the high 32 bits are set from the underlying
inotify "int" ID. This gives an ID that is guaranteed unique
for the directory as a whole, and we can rely on the kernel
to enforce this. QFileMonitor then sets the low 32 bits from
a per-directory counter.

The USB MTP device only sets watches on the directory as a
whole, not files within, so there is no risk of guest
triggered wrap around on the low 32 bits.

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-04-02 13:52:02 +01:00
..
atomic128.h tcg: add early clober modifier in atomic16_cmpxchg on aarch64 2019-02-06 03:38:39 +00:00
atomic.h
base64.h
bcd.h
bitmap.h bitmap: bitmap_count_one_with_offset 2019-03-06 10:49:17 +00:00
bitops.h
bswap.h bswap: Fix accessors syntax in comment 2019-03-06 10:45:06 +01:00
buffer.h
compiler.h
config-file.h
coroutine_int.h
coroutine.h
cpuid.h
crc32c.h
cutils.h
drm.h
envlist.h
error-report.h
event_notifier.h
fifo8.h
fifo32.h
filemonitor.h filemon: fix watch IDs to avoid potential wraparound issues 2019-04-02 13:52:02 +01:00
fprintf-fn.h
futex.h
hbitmap.h
help_option.h
host-utils.h
id.h
int128.h
iov.h block: enhance QEMUIOVector structure 2019-02-22 09:42:13 +00:00
iova-tree.h
jhash.h
job.h
lockable.h
log-for-trace.h
log.h
main-loop.h slirp: replace global polling with per-instance & notifier 2019-02-07 15:49:08 +02:00
memfd.h
mmap-alloc.h
module.h tests: qgraph API for the qtest driver framework 2019-03-07 17:28:24 +01:00
notify.h
option_int.h
option.h
osdep.h hostmem-file: reject invalid pmem file sizes 2019-03-11 10:44:19 -03:00
path.h
pmem.h
processor.h
qdist.h
qht.h
qsp.h
queue.h
range.h
ratelimit.h
rcu_queue.h
rcu.h
readline.h
seqlock.h
sockets.h
stats64.h
sys_membarrier.h
systemd.h
thread-posix.h
thread-win32.h
thread.h
throttle-options.h
throttle.h
timed-average.h
timer.h
typedefs.h net: Introduce announce timer 2019-03-05 11:27:41 +08:00
unicode.h
units.h
uri.h
uuid.h
vfio-helpers.h
win_dump_defs.h
xattr.h
xxhash.h