Message ID | 20201106040102.13892-2-msys.mizuma@gmail.com |
---|---|
State | New |
Headers | show |
Series | [1/2] file-posix: Use OFD lock only if the filesystem supports the lock | expand |
Am 06.11.2020 um 05:01 hat Masayoshi Mizuma geschrieben: > From: Masayoshi Mizuma <m.mizuma@jp.fujitsu.com> > > Pass the file descriptor of /dev/null to qemu_has_ofd_lock() because > former patch is changed the argument. > > Signed-off-by: Masayoshi Mizuma <m.mizuma@jp.fujitsu.com> > --- > tests/test-image-locking.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/tests/test-image-locking.c b/tests/test-image-locking.c > index ba057bd66c..2b823e1588 100644 > --- a/tests/test-image-locking.c > +++ b/tests/test-image-locking.c > @@ -144,14 +144,19 @@ static void test_set_perm_abort(void) > > int main(int argc, char **argv) > { > + int fd; > + > bdrv_init(); > qemu_init_main_loop(&error_abort); > > g_test_init(&argc, &argv, NULL); > > - if (qemu_has_ofd_lock()) { > + fd = open("/dev/null", O_RDONLY); > + > + if ((fd != -1) && (qemu_has_ofd_lock(fd))) { The parentheses are redundant. > g_test_add_func("/image-locking/basic", test_image_locking_basic); > g_test_add_func("/image-locking/set-perm-abort", test_set_perm_abort); > + close(fd); > } Please merge this with patch 1, otherwise the build will fail with only patch 1 applied (breaks bisectability). Kevin
On Wed, Nov 18, 2020 at 04:44:56PM +0100, Kevin Wolf wrote: > Am 06.11.2020 um 05:01 hat Masayoshi Mizuma geschrieben: > > From: Masayoshi Mizuma <m.mizuma@jp.fujitsu.com> > > > > Pass the file descriptor of /dev/null to qemu_has_ofd_lock() because > > former patch is changed the argument. > > > > Signed-off-by: Masayoshi Mizuma <m.mizuma@jp.fujitsu.com> > > --- > > tests/test-image-locking.c | 7 ++++++- > > 1 file changed, 6 insertions(+), 1 deletion(-) > > > > diff --git a/tests/test-image-locking.c b/tests/test-image-locking.c > > index ba057bd66c..2b823e1588 100644 > > --- a/tests/test-image-locking.c > > +++ b/tests/test-image-locking.c > > @@ -144,14 +144,19 @@ static void test_set_perm_abort(void) > > > > int main(int argc, char **argv) > > { > > + int fd; > > + > > bdrv_init(); > > qemu_init_main_loop(&error_abort); > > > > g_test_init(&argc, &argv, NULL); > > > > - if (qemu_has_ofd_lock()) { > > + fd = open("/dev/null", O_RDONLY); > > + > > + if ((fd != -1) && (qemu_has_ofd_lock(fd))) { > > The parentheses are redundant. > > > g_test_add_func("/image-locking/basic", test_image_locking_basic); > > g_test_add_func("/image-locking/set-perm-abort", test_set_perm_abort); > > + close(fd); > > } > > Please merge this with patch 1, otherwise the build will fail with only > patch 1 applied (breaks bisectability). Got it. I'll merge this to patch 1. Thanks! Masa
diff --git a/tests/test-image-locking.c b/tests/test-image-locking.c index ba057bd66c..2b823e1588 100644 --- a/tests/test-image-locking.c +++ b/tests/test-image-locking.c @@ -144,14 +144,19 @@ static void test_set_perm_abort(void) int main(int argc, char **argv) { + int fd; + bdrv_init(); qemu_init_main_loop(&error_abort); g_test_init(&argc, &argv, NULL); - if (qemu_has_ofd_lock()) { + fd = open("/dev/null", O_RDONLY); + + if ((fd != -1) && (qemu_has_ofd_lock(fd))) { g_test_add_func("/image-locking/basic", test_image_locking_basic); g_test_add_func("/image-locking/set-perm-abort", test_set_perm_abort); + close(fd); } return g_test_run();