qemu-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-commits] [qemu/qemu] b26c3f: tests: refactor file monitor test to


From: Peter Maydell
Subject: [Qemu-commits] [qemu/qemu] b26c3f: tests: refactor file monitor test to make it more ...
Date: Tue, 02 Apr 2019 07:28:23 -0700

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: b26c3f9cbd784a5f7db68049fd9c49a0a2077734
      
https://github.com/qemu/qemu/commit/b26c3f9cbd784a5f7db68049fd9c49a0a2077734
  Author: Daniel P. Berrangé <address@hidden>
  Date:   2019-04-02 (Tue, 02 Apr 2019)

  Changed paths:
    M tests/test-util-filemonitor.c

  Log Message:
  -----------
  tests: refactor file monitor test to make it more understandable

The current file monitor unit tests are too clever for their own good
making it hard to understand the desired output.

Instead of trying to infer the expected events, explicitly list the
events we expect in the operation sequence.

Instead of dynamically building a matrix of tests, just have one giant
operation sequence that validates all scenarios in a single test.

Reviewed-by: Marc-André Lureau <address@hidden>
Signed-off-by: Daniel P. Berrangé <address@hidden>


  Commit: ff3dc8fefe953fd3650279e064bf63b212c5699a
      
https://github.com/qemu/qemu/commit/ff3dc8fefe953fd3650279e064bf63b212c5699a
  Author: Daniel P. Berrangé <address@hidden>
  Date:   2019-04-02 (Tue, 02 Apr 2019)

  Changed paths:
    M tests/test-util-filemonitor.c
    M util/filemonitor-inotify.c

  Log Message:
  -----------
  filemon: ensure watch IDs are unique to QFileMonitor scope

The watch IDs are mistakenly only unique within the scope of the
directory being monitored. This is not useful for clients which are
monitoring multiple directories. They require watch IDs to be unique
globally within the QFileMonitor scope.

Reviewed-by: Marc-André Lureau <address@hidden>
Tested-by: Bandan Das <address@hidden>
Reviewed-by: Bandan Das <address@hidden>
Signed-off-by: Daniel P. Berrangé <address@hidden>


  Commit: b4682a63f86ed81abcaa543ea6135e17f9e99d01
      
https://github.com/qemu/qemu/commit/b4682a63f86ed81abcaa543ea6135e17f9e99d01
  Author: Daniel P. Berrangé <address@hidden>
  Date:   2019-04-02 (Tue, 02 Apr 2019)

  Changed paths:
    M authz/listfile.c
    M hw/usb/dev-mtp.c
    M include/authz/listfile.h
    M include/qemu/filemonitor.h
    M tests/test-util-filemonitor.c
    M util/filemonitor-inotify.c
    M util/filemonitor-stub.c
    M util/trace-events

  Log Message:
  -----------
  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 <address@hidden>
Signed-off-by: Daniel P. Berrangé <address@hidden>


  Commit: 436960c95946007aca713330e7a488a6f2e0696f
      
https://github.com/qemu/qemu/commit/436960c95946007aca713330e7a488a6f2e0696f
  Author: Peter Maydell <address@hidden>
  Date:   2019-04-02 (Tue, 02 Apr 2019)

  Changed paths:
    M authz/listfile.c
    M hw/usb/dev-mtp.c
    M include/authz/listfile.h
    M include/qemu/filemonitor.h
    M tests/test-util-filemonitor.c
    M util/filemonitor-inotify.c
    M util/filemonitor-stub.c
    M util/trace-events

  Log Message:
  -----------
  Merge remote-tracking branch 
'remotes/berrange/tags/filemon-next-pull-request' into staging

filemon: various fixes / improvements to file monitor for USB MTP

Ensure watch IDs unique within a monitor and avoid integer wraparound
issues when many watches are set & unset over time.

# gpg: Signature made Tue 02 Apr 2019 13:53:40 BST
# gpg:                using RSA key BE86EBB415104FDF
# gpg: Good signature from "Daniel P. Berrange <address@hidden>" [full]
# gpg:                 aka "Daniel P. Berrange <address@hidden>" [full]
# Primary key fingerprint: DAF3 A6FD B26B 6291 2D0E  8E3F BE86 EBB4 1510 4FDF

* remotes/berrange/tags/filemon-next-pull-request:
  filemon: fix watch IDs to avoid potential wraparound issues
  filemon: ensure watch IDs are unique to QFileMonitor scope
  tests: refactor file monitor test to make it more understandable

Signed-off-by: Peter Maydell <address@hidden>


Compare: https://github.com/qemu/qemu/compare/9a363f0bcc65...436960c95946



reply via email to

[Prev in Thread] Current Thread [Next in Thread]