b4682a63f8
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> |
||
---|---|---|
.. | ||
atomic128.h | ||
atomic.h | ||
base64.h | ||
bcd.h | ||
bitmap.h | ||
bitops.h | ||
bswap.h | ||
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 | ||
fprintf-fn.h | ||
futex.h | ||
hbitmap.h | ||
help_option.h | ||
host-utils.h | ||
id.h | ||
int128.h | ||
iov.h | ||
iova-tree.h | ||
jhash.h | ||
job.h | ||
lockable.h | ||
log-for-trace.h | ||
log.h | ||
main-loop.h | ||
memfd.h | ||
mmap-alloc.h | ||
module.h | ||
notify.h | ||
option_int.h | ||
option.h | ||
osdep.h | ||
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 | ||
unicode.h | ||
units.h | ||
uri.h | ||
uuid.h | ||
vfio-helpers.h | ||
win_dump_defs.h | ||
xattr.h | ||
xxhash.h |