| 2865 | |
| 2866 | |
| 2867 | void SyntheticClient::foo() |
| 2868 | { |
| 2869 | UserPerm perms = client->pick_my_perms(); |
| 2870 | |
| 2871 | if (1) { |
| 2872 | // make 2 parallel dirs, link/unlink between them. |
| 2873 | char a[100], b[100]; |
| 2874 | client->mkdir("/a", 0755, perms); |
| 2875 | client->mkdir("/b", 0755, perms); |
| 2876 | for (int i=0; i<10; i++) { |
| 2877 | snprintf(a, sizeof(a), "/a/%d", i); |
| 2878 | client->mknod(a, 0644, perms); |
| 2879 | } |
| 2880 | while (1) { |
| 2881 | for (int i=0; i<10; i++) { |
| 2882 | snprintf(a, sizeof(a), "/a/%d", i); |
| 2883 | snprintf(b, sizeof(b), "/b/%d", i); |
| 2884 | client->link(a, b, perms); |
| 2885 | } |
| 2886 | for (int i=0; i<10; i++) { |
| 2887 | snprintf(b, sizeof(b), "/b/%d", i); |
| 2888 | client->unlink(b, perms); |
| 2889 | } |
| 2890 | } |
| 2891 | return; |
| 2892 | } |
| 2893 | if (1) { |
| 2894 | // bug1.cpp |
| 2895 | const char *fn = "blah"; |
| 2896 | char buffer[8192]; |
| 2897 | client->unlink(fn, perms); |
| 2898 | int handle = client->open(fn, O_CREAT|O_RDWR, perms, S_IRWXU); |
| 2899 | ceph_assert(handle>=0); |
| 2900 | int r=client->write(handle,buffer,8192); |
| 2901 | ceph_assert(r>=0); |
| 2902 | r=client->close(handle); |
| 2903 | ceph_assert(r>=0); |
| 2904 | |
| 2905 | handle = client->open(fn, O_RDWR, perms); // open the same file, it must have some data already |
| 2906 | ceph_assert(handle>=0); |
| 2907 | r=client->read(handle,buffer,8192); |
| 2908 | ceph_assert(r==8192); // THIS ASSERTION FAILS with disabled cache |
| 2909 | r=client->close(handle); |
| 2910 | ceph_assert(r>=0); |
| 2911 | |
| 2912 | return; |
| 2913 | } |
| 2914 | if (1) { |
| 2915 | dout(0) << "first" << dendl; |
| 2916 | int fd = client->open("tester", O_WRONLY|O_CREAT, perms); |
| 2917 | client->write(fd, "hi there", 0, 8); |
| 2918 | client->close(fd); |
| 2919 | dout(0) << "sleep" << dendl; |
| 2920 | sleep(10); |
| 2921 | dout(0) << "again" << dendl; |
| 2922 | fd = client->open("tester", O_WRONLY|O_CREAT, perms); |
| 2923 | client->write(fd, "hi there", 0, 8); |
| 2924 | client->close(fd); |