[CRIU] [PATCH] zdtm/file_locks1: compare devices in addition to inodes
Andrey Vagin
avagin at openvz.org
Mon Aug 24 11:07:16 PDT 2015
From: Andrew Vagin <avagin at openvz.org>
You can see two equal inode numbers with differen devices and
it was a reason why the test failed.
4: C: 12491/12495/12496
4: c: 1: POSIX ADVISORY WRITE 0 fc:03:12468 0 EOF
4: c: 2: POSIX ADVISORY READ 0 fc:03:12421 0 EOF
4: c: 3: POSIX ADVISORY WRITE 0 00:14:16285 0 EOF
4: c: 4: FLOCK MSNFS READ 4 fc:03:12496 0 EOF
4: c: 5: FLOCK ADVISORY WRITE 4 fc:03:12495 0 EOF
4: c: 6: FLOCK ADVISORY READ 4 fc:03:12491 0 EOF
4: c: 7: POSIX ADVISORY WRITE 0 00:14:16280 0 EOF
4: c: 8: POSIX ADVISORY WRITE 0 00:14:12677 0 EOF
4: c: 9: FLOCK ADVISORY WRITE 0 00:14:12520 0 EOF
4: c: 10: FLOCK ADVISORY WRITE 0 00:14:12495 0 EOF
Signed-off-by: Andrew Vagin <avagin at openvz.org>
Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
test/zdtm/live/static/file_locks01.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/test/zdtm/live/static/file_locks01.c b/test/zdtm/live/static/file_locks01.c
index 4ff46d8..1bdff9a 100644
--- a/test/zdtm/live/static/file_locks01.c
+++ b/test/zdtm/live/static/file_locks01.c
@@ -21,6 +21,7 @@ char file0[PATH_MAX];
char file1[PATH_MAX];
char file2[PATH_MAX];
unsigned int inodes[3];
+dev_t dev;
static int open_all_files(int *fd_0, int *fd_1, int *fd_2)
{
@@ -37,6 +38,7 @@ static int open_all_files(int *fd_0, int *fd_1, int *fd_2)
fstat(*fd_0, &buf);
inodes[0] = buf.st_ino;
+ dev = buf.st_dev;
*fd_1 = open(file1, O_RDWR | O_CREAT | O_EXCL, 0666);
if (*fd_1 < 0) {
@@ -103,7 +105,7 @@ static int check_file_locks()
break;
}
- if (i_no != inodes[0] && i_no != inodes[1] && i_no != inodes[2])
+ if (i_no != inodes[0] && i_no != inodes[1] && i_no != inodes[2] && makedev(maj, min) != dev)
continue;
if (!strcmp(fl_flag, "FLOCK") && !strcmp(fl_type, "ADVISORY")) {
--
2.1.0
More information about the CRIU
mailing list