Whamcloud - gitweb
git://git.whamcloud.com
/
fs
/
lustre-release.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
LU-1715 ptlrpc: flock deadlock detection does not work
[fs/lustre-release.git]
/
lustre
/
tests
/
flocks_test.c
diff --git
a/lustre/tests/flocks_test.c
b/lustre/tests/flocks_test.c
index
9450958
..
82f7cfd
100644
(file)
--- a/
lustre/tests/flocks_test.c
+++ b/
lustre/tests/flocks_test.c
@@
-27,7
+27,7
@@
* Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*
* Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*
- * Copyright (c) 2011,
Whamcloud, Inc
.
+ * Copyright (c) 2011,
Intel Corporation
.
*/
/*
* This file is part of Lustre, http://www.lustre.org/
*/
/*
* This file is part of Lustre, http://www.lustre.org/
@@
-132,6
+132,7
@@
int t1(int argc, char *argv[])
int fd;
int mount_with_flock = 0;
int error = 0;
int fd;
int mount_with_flock = 0;
int error = 0;
+ int rc = 0;
if (argc != 5) {
t1_usage();
if (argc != 5) {
t1_usage();
@@
-167,13
+168,19
@@
int t1(int argc, char *argv[])
error = flock(fd, LOCK_EX);
} else {
t1_usage();
error = flock(fd, LOCK_EX);
} else {
t1_usage();
- return EXIT_FAILURE;
+ rc = EXIT_FAILURE;
+ goto out;
}
if (mount_with_flock)
}
if (mount_with_flock)
-
return
((error == 0) ? EXIT_SUCCESS : EXIT_FAILURE);
+
rc =
((error == 0) ? EXIT_SUCCESS : EXIT_FAILURE);
else
else
- return((error == 0) ? EXIT_FAILURE : EXIT_SUCCESS);
+ rc = ((error == 0) ? EXIT_FAILURE : EXIT_SUCCESS);
+
+out:
+ if (fd >= 0)
+ close(fd);
+ return rc;
}
/** ===============================================================
}
/** ===============================================================
@@
-244,7
+251,8
@@
int t2(int argc, char* argv[])
rc = t_fcntl(fd, F_GETFL);
if ((rc & O_APPEND) == 0) {
fprintf(stderr, "error get flag: ret %x\n", rc);
rc = t_fcntl(fd, F_GETFL);
if ((rc & O_APPEND) == 0) {
fprintf(stderr, "error get flag: ret %x\n", rc);
- return EXIT_FAILURE;
+ rc = EXIT_FAILURE;
+ goto out;
}
ta.lock = &lock;
}
ta.lock = &lock;