| 14033 | } |
| 14034 | |
| 14035 | std::pair<int, bool> Client::test_dentry_handling(bool can_invalidate) |
| 14036 | { |
| 14037 | std::pair <int, bool> r(0, false); |
| 14038 | |
| 14039 | RWRef_t iref_reader(initialize_state, CLIENT_INITIALIZED); |
| 14040 | if (!iref_reader.is_state_satisfied()) |
| 14041 | return std::make_pair(-ENOTCONN, false); |
| 14042 | |
| 14043 | can_invalidate_dentries = can_invalidate; |
| 14044 | |
| 14045 | /* |
| 14046 | * Force to use the old and slow method to invalidate the dcache |
| 14047 | * if the euid is non-root, or the remount may fail with return |
| 14048 | * code 1 or 32. |
| 14049 | */ |
| 14050 | uid_t euid = geteuid(); |
| 14051 | ldout(cct, 10) << "euid: " << euid << dendl; |
| 14052 | if (euid != 0) { |
| 14053 | can_invalidate_dentries = true; |
| 14054 | } |
| 14055 | |
| 14056 | if (can_invalidate_dentries) { |
| 14057 | ceph_assert(dentry_invalidate_cb); |
| 14058 | ldout(cct, 1) << "using dentry_invalidate_cb" << dendl; |
| 14059 | } else { |
| 14060 | ceph_assert(remount_cb); |
| 14061 | ldout(cct, 1) << "using remount_cb" << dendl; |
| 14062 | r = _do_remount(false); |
| 14063 | } |
| 14064 | |
| 14065 | return r; |
| 14066 | } |
| 14067 | |
| 14068 | int Client::_sync_fs() |
| 14069 | { |
no test coverage detected