| 201 | } |
| 202 | ~RemountTest() override {} |
| 203 | void *entry() override { |
| 204 | #if defined(__linux__) |
| 205 | bool can_invalidate_dentries = g_conf().get_val<bool>( |
| 206 | "client_try_dentry_invalidate"); |
| 207 | uint64_t max_retries = g_conf().get_val<uint64_t>( |
| 208 | "client_max_retries_on_remount_failure"); |
| 209 | std::pair<int, bool> test_result; |
| 210 | uint64_t i = 0; |
| 211 | int tr = 0; |
| 212 | do { |
| 213 | test_result = client->test_dentry_handling(can_invalidate_dentries); |
| 214 | tr = test_result.first; |
| 215 | if (tr) { |
| 216 | sleep(1); |
| 217 | } |
| 218 | } while (++i < max_retries && tr); |
| 219 | |
| 220 | bool abort_on_failure = test_result.second; |
| 221 | bool client_die_on_failed_dentry_invalidate = g_conf().get_val<bool>( |
| 222 | "client_die_on_failed_dentry_invalidate"); |
| 223 | if (tr != 0 && client_die_on_failed_dentry_invalidate) { |
| 224 | cerr << "ceph-fuse[" << getpid() |
| 225 | << "]: fuse failed dentry invalidate/remount test with error " |
| 226 | << cpp_strerror(tr) << ", stopping" << std::endl; |
| 227 | |
| 228 | char buf[5050]; |
| 229 | string mountpoint = cfuse->get_mount_point(); |
| 230 | snprintf(buf, sizeof(buf), "fusermount -u -z %s", mountpoint.c_str()); |
| 231 | int umount_r = system(buf); |
| 232 | if (umount_r) { |
| 233 | if (umount_r != -1) { |
| 234 | if (WIFEXITED(umount_r)) { |
| 235 | umount_r = WEXITSTATUS(umount_r); |
| 236 | cerr << "got error " << umount_r |
| 237 | << " when unmounting Ceph on failed remount test!" << std::endl; |
| 238 | } else { |
| 239 | cerr << "attempt to umount on failed remount test failed (on a signal?)" << std::endl; |
| 240 | } |
| 241 | } else { |
| 242 | cerr << "system() invocation failed during remount test" << std::endl; |
| 243 | } |
| 244 | } |
| 245 | } |
| 246 | if(abort_on_failure) { |
| 247 | ceph_abort(); |
| 248 | } |
| 249 | return reinterpret_cast<void*>(tr); |
| 250 | #else |
| 251 | return reinterpret_cast<void*>(0); |
| 252 | #endif |
| 253 | } |
| 254 | } tester; |
| 255 | |
| 256 |
nothing calls this directly
no test coverage detected