- char mmap_file[256], mmap_file2[256];
- char *ptr = NULL, *ptr2 = NULL;
- int fd = 0, fd2 = 0, rc = 0;
-
- sprintf(mmap_file, "%s/%s", mnt, "mmap_file6");
- sprintf(mmap_file2, "%s/%s", dir2, "mmap_file6");
- if (unlink(mmap_file) && errno != ENOENT) {
- perror("unlink()");
- return -errno;
- }
-
- fd = open(mmap_file, O_CREAT|O_RDWR, 0600);
- if (fd < 0) {
- perror(mmap_file);
- return -errno;
- }
- if (ftruncate(fd, page_size) < 0) {
- perror("ftruncate()");
- rc = -errno;
- goto out;
- }
-
- fd2 = open(mmap_file2, O_RDWR, 0600);
- if (fd2 < 0) {
- perror(mmap_file2);
- rc = -errno;
- goto out;
- }
-
- ptr = mmap(NULL, page_size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
- if (ptr == MAP_FAILED) {
- perror("mmap()");
- rc = -errno;
- goto out;
- }
-
- ptr2 = mmap(NULL, page_size, PROT_READ|PROT_WRITE, MAP_SHARED, fd2, 0);
- if (ptr2 == MAP_FAILED) {
- perror("mmap()");
- rc = -errno;
- goto out;
- }
-
- rc = cancel_lru_locks("osc");
- if (rc)
- goto out;
-
- memcpy(ptr, "blah", strlen("blah"));
- if (strncmp(ptr, ptr2, strlen("blah"))) {
- fprintf(stderr, "client2 mmap mismatch!\n");
- rc = -EFAULT;
- goto out;
- }
- memcpy(ptr2, "foo", strlen("foo"));
- if (strncmp(ptr, ptr2, strlen("foo"))) {
- fprintf(stderr, "client1 mmap mismatch!\n");
- rc = -EFAULT;
- }
+ char mmap_file[256], mmap_file2[256];
+ char *ptr = NULL, *ptr2 = NULL;
+ int fd = 0, fd2 = 0, rc = 0;
+
+ sprintf(mmap_file, "%s/%s", mnt, "mmap_file6");
+ sprintf(mmap_file2, "%s/%s", dir2, "mmap_file6");
+ if (unlink(mmap_file) && errno != ENOENT) {
+ perror("unlink()");
+ return -errno;
+ }
+
+ fd = open(mmap_file, O_CREAT | O_RDWR, 0600);
+ if (fd < 0) {
+ perror(mmap_file);
+ return -errno;
+ }
+ if (ftruncate(fd, page_size) < 0) {
+ perror("ftruncate()");
+ rc = -errno;
+ goto out;
+ }
+
+ fd2 = open(mmap_file2, O_RDWR, 0600);
+ if (fd2 < 0) {
+ perror(mmap_file2);
+ rc = -errno;
+ goto out;
+ }
+
+ ptr = mmap(NULL, page_size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
+ if (ptr == MAP_FAILED) {
+ perror("mmap()");
+ rc = -errno;
+ goto out;
+ }
+
+ ptr2 = mmap(NULL, page_size, PROT_READ | PROT_WRITE, MAP_SHARED,
+ fd2, 0);
+ if (ptr2 == MAP_FAILED) {
+ perror("mmap()");
+ rc = -errno;
+ goto out;
+ }
+
+ rc = cancel_lru_locks("osc");
+ if (rc)
+ goto out;
+
+ memcpy(ptr, "blah", strlen("blah"));
+ if (strncmp(ptr, ptr2, strlen("blah"))) {
+ fprintf(stderr, "client2 mmap mismatch!\n");
+ rc = -EFAULT;
+ goto out;
+ }
+ memcpy(ptr2, "foo", strlen("foo"));
+ if (strncmp(ptr, ptr2, strlen("foo"))) {
+ fprintf(stderr, "client1 mmap mismatch!\n");
+ rc = -EFAULT;
+ }