From 41c8a850d66e6323247fcae729b8859168be023c Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Thu, 7 Aug 2008 16:35:11 -0700 Subject: [PATCH] mds: rdlock filelock when opening snapped files --- src/TODO | 6 +----- src/mds/Server.cc | 11 +++++++++++ 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/TODO b/src/TODO index e99c9527bae01..db838a2b44afb 100644 --- a/src/TODO +++ b/src/TODO @@ -21,9 +21,6 @@ big items snaps on mds -- snapserver needs to allocate contiguous snapids - - need to return allocated id with prepare to client.. and handle all the corner cases.. - - cap release probably needs ack by mds. or, mds needs to possibly initiate recovery on import? no, release should pbly just be acked by mds... like it was way back when... bah! - mds server ops @@ -36,9 +33,8 @@ snaps on mds - include snaps for all (primary+remote) parents snaps on osd -- figure out how to fix up rados logging -- snap collections - garbage collection +- efficient recovery of clones userspace client diff --git a/src/mds/Server.cc b/src/mds/Server.cc index e67bdc566a0c1..83e9d9e59d65a 100644 --- a/src/mds/Server.cc +++ b/src/mds/Server.cc @@ -4595,6 +4595,17 @@ void Server::handle_client_open(MDRequest *mdr) return; } } + + // rdlock filelock if snapped. + // this makes us wait for writers to flushsnaps, ensuring we get accurate metadata. + if (mdr->ref_snapid != CEPH_NOSNAP && !cur->is_dir()) { + set rdlocks = mdr->rdlocks; + set wrlocks = mdr->wrlocks; + set xlocks = mdr->xlocks; + rdlocks.insert(&cur->filelock); + if (!mds->locker->acquire_locks(mdr, rdlocks, wrlocks, xlocks)) + return; + } // do it _do_open(mdr, cur); -- 2.39.5