summaryrefslogtreecommitdiffstats
path: root/src/mds/SimpleLock.h (follow)
Commit message (Collapse)AuthorAgeFilesLines
* ceph-dencoder: MDS - Add missing typesNitzanMordhai2024-04-101-2/+10
| | | | | | | | | | | | | | | | | Currently, ceph-dencoder lacks certain mds types, preventing us from accurately checking the ceph corpus for encode-decode mismatches. This pull request aims to address this issue by adding the missing types to ceph-dencoder. To successfully incorporate these types into ceph-dencoder, we need to introduce the necessary `dump` and `generate_test_instances` functions that was missing in some types. These functions are essential for proper encode and decode of the added types. This PR will enhance the functionality of ceph-dencoder by including the missing types, enabling a comprehensive analysis of encode-decode consistency. With the addition of these types, we can ensure the robustness and correctness of the ceph corpus. This update will significantly contribute to improving the overall reliability and accuracy of ceph-dencoder. It allows for a more comprehensive assessment of the encode-decode behavior, leading to enhanced data integrity and stability within the ceph ecosystem. Fixes: https://tracker.ceph.com/issues/61788 Signed-off-by: Nitzan Mordechai <nmordech@redhat.com>
* mds: quiescelock as local lock + cap maskingPatrick Donnelly2024-03-201-1/+1
| | | | | Signed-off-by: Patrick Donnelly <pdonnell@redhat.com> Signed-off-by: Leonid Usov <leonid.usov@ibm.com>
* mds: pretty print mutation when dumping lockPatrick Donnelly2024-03-201-22/+1
| | | | | | | | | | | | Now looks like: ... (iquiesce xlock x=1 by request(mds.0:2785 nref=6)) ... instead of: ... (iquiesce xlock x=1 by 0xdeadbeef)) ... Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
* mds: add new inode quiescelockPatrick Donnelly2024-03-201-0/+2
| | | | Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
* mds: use 128 bits for waiters on MDSCacheObjectPatrick Donnelly2024-03-201-5/+20
| | | | | | | | | | | | | | Adding a new inode lock will overflow inode wait bits into the MDSCacheObject wait bits. Make space for the quiescelock. This includes a minor refactor to no longer attempt scoping the set of masks we test in MDSCacheObject::waiting when calling MDSCacheObject::is_waiter_for. This optimization wasn't worth the overhead and would be awkard to keep as std::bitset cannot be used as a key for a std::multimap (easily). Instead, we use the sequence number as a key which helps us to avoid allocating another map whenever we call MDSCacheObject::take_waiting. Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
* mds: make LockType fields constPatrick Donnelly2024-03-201-2/+2
| | | | Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
* mds: use new insert template via printPatrick Donnelly2024-03-201-5/+0
| | | | Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
* ceph: allow xlock state to be LOCK_SYNC when putting itXiubo Li2023-07-041-1/+1
| | | | | | | | When the journal logs are successfully flushed the lockers' state could be LOCK_SYNC during the xlock count is non-zero. Fixes: https://tracker.ceph.com/issues/44565 Signed-off-by: Xiubo Li <xiubli@redhat.com>
* ceph: allow xlock state to be LOCK_PREXLOCK when putting itXiubo Li2023-07-041-0/+1
| | | | | | | | | When the journal logs are successfully flushed the lockers' state could be LOCK_PREXLOCK if the inflight OP need to gather issued caps. Fixes: https://tracker.ceph.com/issues/44565 Signed-off-by: Xiubo Li <xiubli@redhat.com>
* mds: make _need_flush_mdlog() check in both stable and unstable casesXiubo Li2022-03-171-2/+3
| | | | | | lock_state_any is true will ignore the lock state. Signed-off-by: Xiubo Li <xiubli@redhat.com>
* mds,osd: fix clang warnings to prevent unneeded copiesWillem Jan Withagen2020-10-061-1/+1
| | | | | | | /home/jenkins/workspace/ceph-master-compile/src/osd/OSDMap.cc:3901:19: warning: loop variable 'pg' of type 'const std::__1::pair<const pg_t, int>' creates a copy from type 'const std::__1::pair<const pg_t, int>' [-Wrange-loop-construct] for (const auto pg : *primary_temp) ^ Signed-off-by: Willem Jan Withagen <wjw@digiware.nl>
* mds: slave -> peerSage Weil2020-07-141-3/+3
| | | | Signed-off-by: Sage Weil <sage@newdream.net>
* mds: master -> leaderSage Weil2020-07-141-1/+1
| | | | Signed-off-by: Sage Weil <sage@newdream.net>
* Merge pull request #33753 from ukernel/wip-44448Yan, Zheng2020-03-241-1/+1
|\ | | | | mds: fix 'if there is lock cache on dir' check
| * mds: fix 'if there is lock cache on dir' checkYan, Zheng2020-03-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When invalidating lock cache, current code detach lock cache from all its locks immediately. So diri->filelock.is_cached() only tells us if there is active (not being invalidated) lock cache on a dir. But MDCache::path_traverse() and Server::_dir_is_nonempty_unlocked() use diri->filelock.is_cached() to check if there is any lock cache on a dir. This bug can result in processing async requests and normal requests out of order. The fix is detaching lock cache from its locks when lock cache is completely invalidated . Fixes: https://tracker.ceph.com/issues/44448 Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
* | mds: Build target 'common' without using namespace in headersAdam C. Emerson2020-03-071-15/+15
|/ | | | | | | | Part of a changeset to allow building all of 'common' without relying on 'using namespace std' or 'using namespace ceph' at toplevel in headers. Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
* mds: Reorganize class members in SimpleLock headerVarsha Rao2020-01-081-131/+83
| | | | | Fixes: https://tracker.ceph.com/issues/43367 Signed-off-by: Varsha Rao <varao@redhat.com>
* mds: invalidate lock caches if they hold conflicting locksYan, Zheng2019-12-121-5/+16
| | | | | | | | Add a list to SimpleLock, which tracks lock caches which hold locks on SimpleLock itself. When mds want to change lock state, it can find lock caches and invalidate them. Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
* mds: take snaplock and policylock during path traverse.Yan, Zheng2019-12-121-2/+1
| | | | | | | | | | | | | | | | | | | | To take locks in top-down order for a MDRequest, we need to first take snap/policy rdlocks on ancestor inodes of the request's base inode. It's not convenient to use Locker::acquire_locks() to do the job because path to request's base inode can change before all of these locks are rdlocked. This patch introduces Locker::try_rdlock_snap_layout(), which tries taking snap/policy rdlocks on request's base inode and its ancestors all at the same time. MDCache::path_traverse() calls this function at first, then uses Locker::acquire_locks() to take snaplock on components of request's path. This patch also reorders inode locks, put snaplock and policy at the front. Because some requests (such as setattr) may xlock other locks after taking snaplock/policylock. Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
* mds: define operator<(...) for MutationImpl::LockOpYan, Zheng2019-11-091-16/+0
| | | | Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
* mds: remove SimpleLock::replicate_relax()Yan, Zheng2019-03-271-13/+0
| | | | | | | | | | | The function changes lock to SYNC state without checking issued caps. which can cause inconsistent between lock state and issued caps. Besides the function is not very useful because locks except nestlock have SYNC state as default. It's unlikely that unused lock is in LOCK state. Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
* mds: wait for client to release shared cap when re-acquiring xlockYan, Zheng2019-03-011-2/+3
| | | | | | | | MDS may revoke shared cap from xlocker client during 'LOCK_XLOCKDONE -> LOCK_LOCK_XLOCK' state transition. Fixes: http://tracker.ceph.com/issues/38491 Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
* mds: refactor MDSContext inheritancePatrick Donnelly2019-02-021-4/+4
| | | | | | This commit greatly simplifies things. Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
* mds: convert const char ptr to string_viewPatrick Donnelly2019-01-121-21/+39
| | | | | | Trivial refactor. Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
* mds: Use ceph_assert for asserts.Adam C. Emerson2018-08-271-11/+11
| | | | Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
* mds: manage Message lifetime with intrusive_ptrPatrick Donnelly2018-08-151-1/+1
| | | | | | | | | | This change turned out to be far more extensive than I hoped but the end result should prevent all Message-related memory leaks. I believe I fixed several incidentally. Fixes: http://tracker.ceph.com/issues/24306 Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
* mds: use vector for context listsPatrick Donnelly2018-07-261-3/+3
| | | | | | | | | | | | | Commands executed: sed -i 's/\([^:]\)list<MDSInternalContextBase[[:space:]]*\*>/\1MDSInternalContextBase::vec/g' *.cc *.h sed -i 's/std::list<MDSInternalContextBase[[:space:]]*\*>/MDSInternalContextBase::vec/g' *.cc *.h With various incidental fixes. Fixes: http://tracker.ceph.com/issues/25111 Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
* include/memory.h: remove memory.hKefu Chai2018-06-261-1/+0
| | | | | | | | | | | memory.h was introduced back when the shared_ptrs were still in TR1, but we've moved to C++17 now. and the C++ clients should be compiled with a C++11 compatible compiler. so there is no need to have this file anymore. also replace all references of ceph::shared_ptr and ceph::weak_ptr with std::shared_ptr and std::weak_ptr accordingly. Signed-off-by: Kefu Chai <kchai@redhat.com>
* mds: use const_iterator for decodeKefu Chai2018-05-171-3/+3
| | | | Signed-off-by: Kefu Chai <kchai@redhat.com>
* mds: minor refactor of SimpleLockPatrick Donnelly2018-02-081-8/+4
| | | | Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
* mds: move CDentry container members to mempoolPatrick Donnelly2018-02-071-0/+1
| | | | | | Partial-fix: http://tracker.ceph.com/issues/21402 Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
* mds: Use unqualified encode/decodeAdam C. Emerson2018-01-101-8/+11
| | | | | | | This is a portion of Part 1 of the namespace project: using ADL properly in encode and decode so we can use namespaces easily in Ceph. Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
* mds: implement LOCK_XSYN_LOCK and LOCK_XSYN_MIXYan, Zheng2017-11-071-0/+2
| | | | Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
* mds: don't rdlock locks in replica object while auth mds is recoveringYan, Zheng2017-10-191-10/+25
| | | | | | | | | Auth mds may take xlock on the lock and change the object when replaying unsafe requests. To guarantee new requests and replayed unsafe requests (on auth mds) get processed in proper order, we shouldn't rdlock locks in replica object while auth mds of the object is recovering Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
* mds: move ScatterLock::state_flags into SimpleLockYan, Zheng2017-10-191-19/+18
| | | | Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
* mds: cleanup replica_map accessPatrick Donnelly2017-09-131-4/+3
| | | | | | | The gymnastics protecting the map failed as the code evolved. Just expose it normally with a getter. Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
* common/TrackedOp: use explicit ref count, intrusive_ptrSage Weil2017-01-271-1/+4
| | | | | | | | | | | | | | | This is more efficient and more explicit than shared_ptr. It will also allow us to put these in intrusive lists. Note that before we used the shared_ptr OnDelete property only for the live ops and left it off for the history. Here we rename is_tracked to state and explicit note whether we are untracked, live, or history. Also, now that we #include OpRequest in osd_types.h, we have to include the .cc file (and ~OpRequest definition) in libcommon to avoid a link error on all the unit tests etc. Signed-off-by: Sage Weil <sage@redhat.com>
* Merge pull request #11994 from ukernel/wip-17193John Spray2016-11-231-1/+3
|\ | | | | | | | | mds: force client flush snap data before truncating objects Reviewed-by: Greg Farnum <gfarnum@redhat.com>
| * mds: force client flush snap data before truncating objectsYan, Zheng2016-11-151-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Snapshot data get lost if following sequence of events happen - client writes data to a file - make a snapshot - truncate the file - mds truncate file objects using the newest snap context - client flushes snap data using the old snap context OSD first handles MDS's truncate request, it updates object's snap context. When handling client's write request, OSD finds that object's snap context is newer than request's snap context. So it uses the newer one and treats the data as if they were written after the snapshot. The fix is avoid touching file objects while clients may have unflushed snap data. Before truncating file objects, MDS checks if clients may have unflushed snap data. If client have, MDS set filelock to a special unstable state, the state revokes Fb capability. MDS starts truncating file objects after the Fb capability get revoked. Fixes: http://tracker.ceph.com/issues/17193 Signed-off-by: Yan, Zheng <zyan@redhat.com>
* | Merge pull request #11635 from batrick/mds-unique-ptr-20161024John Spray2016-11-231-10/+6
|\ \ | | | | | | | | | | | | mds: more unique_pointer changes Reviewed-by: John Spray <john.spray@redhat.com>
| * | mds: use unique_ptr unstable_bits_t in SimpleLockPatrick Donnelly2016-11-231-10/+6
| |/ | | | | | | Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
* / assert(0) -> ceph_abort()Sage Weil2016-11-221-3/+3
|/ | | | Signed-off-by: Sage Weil <sage@redhat.com>
* mds: move MDSCacheObject related code to seperate filesYan, Zheng2016-10-191-1/+1
| | | | Signed-off-by: Yan, Zheng <zyan@redhat.com>
* mds: avoid unnecessary log flush for unstable locksYan, Zheng2016-07-221-0/+5
| | | | | | we can avoid log flush if unstable locks are caused by revoking caps Signed-off-by: Yan, Zheng <zyan@redhat.com>
* mds: finish lock waiters in the same order that they were added.Yan, Zheng2016-06-011-1/+1
| | | | | | | | Current code first processes lock waiters who have smaller wait mask. Lock waiters who have large wait mask can starve if client keeps sending requests that add waiter with small mask. Signed-off-by: Yan, Zheng <zyan@redhat.com>
* make ctors with one argument explicitDanny Al-Gaaf2016-01-291-1/+1
| | | | | | | Use explicit keyword for constructors with one argument to prevent implicit usage as conversion functions. Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
* mds: add SimpleLock::dumpJohn Spray2015-03-191-0/+7
| | | | Signed-off-by: John Spray <john.spray@redhat.com>
* mds: use compact_map to optimize memory usage of MDSCacheObjectYan, Zheng2015-02-251-2/+2
| | | | | | | | Replica map and waiting list in MDSCacheObject are rarely used and mostly empty. Defining them as compact_map can save 80 bytes for 64 bits program. Signed-off-by: Yan, Zheng <zyan@redhat.com>
* mds: support constness in MDSCacheObjectsJohn Spray2015-01-091-5/+5
| | | | | | | So that one can have const CInode and CDir references from time to time. Signed-off-by: John Spray <john.spray@redhat.com>
* mds: typedefs for rank and gid in MDSMapJohn Spray2014-10-081-6/+7
| | | | | | Make it clearer what these numbers are where they appear. Signed-off-by: John Spray <john.spray@redhat.com>