Bugzilla : 23352
Description: Modified value of at_min is not taken into account
+Severity : normal
+Bugzilla : 22660
+Description: lustre grants flock exclusive locks to two fd's in the same process
+
-------------------------------------------------------------------------------
2010-10-29 Oracle, Inc.
struct lustre_handle lockh = {0};
ldlm_policy_data_t flock;
int flags = 0;
- int rc;
+ int rc, rc2 = 0;
ENTRY;
CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu file_lock=%p\n",
&flock, &flags, NULL, 0, NULL, &lockh, 0);
if ((file_lock->fl_flags & FL_FLOCK) &&
(rc == 0 || file_lock->fl_type == F_UNLCK))
- ll_flock_lock_file_wait(file, file_lock, (cmd == F_SETLKW));
+ rc2 = ll_flock_lock_file_wait(file, file_lock, (cmd == F_SETLKW));
#ifdef HAVE_F_OP_FLOCK
if ((file_lock->fl_flags & FL_POSIX) &&
(rc == 0 || file_lock->fl_type == F_UNLCK) &&
!(flags & LDLM_FL_TEST_LOCK))
- posix_lock_file_wait(file, file_lock);
+ rc2 = posix_lock_file_wait(file, file_lock);
#endif
- RETURN(rc);
+ RETURN(rc ? rc : rc2);
}
int ll_file_noflock(struct file *file, int cmd, struct file_lock *file_lock)
return rc;
}
+/** =================================================================
+ * test number 3
+ *
+ * Bug 22660: Two conflicting flocks from same process.
+ */
+int t3(int argc, char *argv[])
+{
+ int fd, fd2;
+ int rc = EXIT_SUCCESS;
+
+ if (argc != 3) {
+ fprintf(stderr, "Usage: ./flock_test 3 filename\n");
+ return EXIT_FAILURE;
+ }
+
+ if ((fd = open(argv[2], O_RDWR)) < 0) {
+ fprintf(stderr, "Couldn't open file: %s\n", argv[1]);
+ return EXIT_FAILURE;
+ }
+ if (flock(fd, LOCK_EX | LOCK_NB) < 0) {
+ perror("first flock failed");
+ rc = EXIT_FAILURE;
+ goto out;
+ }
+ if ((fd2 = open(argv[2], O_RDWR)) < 0) {
+ fprintf(stderr, "Couldn't open file: %s\n", argv[1]);
+ rc = EXIT_FAILURE;
+ goto out;
+ }
+ if (flock(fd2, LOCK_EX | LOCK_NB) >= 0) {
+ fprintf(stderr, "Second flock succeeded - FAIL\n");
+ rc = EXIT_FAILURE;
+ }
+
+ close(fd2);
+out:
+ close(fd);
+ return rc;
+}
+
+
/** ==============================================================
* program entry
*/
case 2:
rc = t2(argc, argv);
break;
+ case 3:
+ rc = t3(argc, argv);
+ break;
default:
fprintf(stderr, "unknow test number %s\n", argv[1]);
break;
}
run_test 105d "flock race (should not freeze) ========"
+test_105e() { # bug 22660
+ [ -z "`mount | grep \"$DIR.*flock\" | grep -v noflock`" ] && \
+ skip "mount w/o flock enabled" && return
+ touch $DIR/$tfile
+ flocks_test 3 $DIR/$tfile
+}
+run_test 105e "Two conflicting flocks from same process ======="
+
test_106() { #bug 10921
mkdir -p $DIR/$tdir
$DIR/$tdir && error "exec $DIR/$tdir succeeded"