Commit 8189eda7 authored by Andrew Vagin's avatar Andrew Vagin Committed by Pavel Emelyanov

zdtm/file_locks1: compare devices in addition to inodes

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: 's avatarAndrew Vagin <avagin@openvz.org>
Signed-off-by: 's avatarAndrey Vagin <avagin@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 439de67a
...@@ -21,6 +21,7 @@ char file0[PATH_MAX]; ...@@ -21,6 +21,7 @@ char file0[PATH_MAX];
char file1[PATH_MAX]; char file1[PATH_MAX];
char file2[PATH_MAX]; char file2[PATH_MAX];
unsigned int inodes[3]; unsigned int inodes[3];
dev_t dev;
static int open_all_files(int *fd_0, int *fd_1, int *fd_2) 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) ...@@ -37,6 +38,7 @@ static int open_all_files(int *fd_0, int *fd_1, int *fd_2)
fstat(*fd_0, &buf); fstat(*fd_0, &buf);
inodes[0] = buf.st_ino; inodes[0] = buf.st_ino;
dev = buf.st_dev;
*fd_1 = open(file1, O_RDWR | O_CREAT | O_EXCL, 0666); *fd_1 = open(file1, O_RDWR | O_CREAT | O_EXCL, 0666);
if (*fd_1 < 0) { if (*fd_1 < 0) {
...@@ -103,7 +105,7 @@ static int check_file_locks() ...@@ -103,7 +105,7 @@ static int check_file_locks()
break; 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; continue;
if (!strcmp(fl_flag, "FLOCK") && !strcmp(fl_type, "ADVISORY")) { if (!strcmp(fl_flag, "FLOCK") && !strcmp(fl_type, "ADVISORY")) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment