From 1f7433ab310594708467fa4daa416b55cc5f0f0d Mon Sep 17 00:00:00 2001 From: sage Date: Thu, 5 May 2005 18:35:53 +0000 Subject: [PATCH] crap git-svn-id: https://ceph.svn.sf.net/svnroot/ceph@207 29311d96-e01e-0410-9327-a35deaab8ce9 --- ceph/TODO | 4 ++++ ceph/mds/MDCache.cc | 13 +++++++++---- ceph/mds/MDS.cc | 8 +++++++- ceph/mds/MDS.h | 7 ++++--- 4 files changed, 24 insertions(+), 8 deletions(-) diff --git a/ceph/TODO b/ceph/TODO index a013d156e2b81..d07af856d63e6 100644 --- a/ceph/TODO +++ b/ceph/TODO @@ -1,6 +1,10 @@ SAGE: +- path_Traverse + - fix noperm crap + - clean up xlock interaction + - foreign renames /- how to limit xlock collateral/chatter! - test it! diff --git a/ceph/mds/MDCache.cc b/ceph/mds/MDCache.cc index 3964dea0c5db7..3ecf4fb54ccda 100644 --- a/ceph/mds/MDCache.cc +++ b/ceph/mds/MDCache.cc @@ -829,7 +829,8 @@ int MDCache::path_traverse(filepath& origpath, set symlinks_resolved; // keep a list of symlinks we touch to avoid loops bool noperm = false; - if (onfail == MDS_TRAVERSE_DISCOVER) noperm = true; + if (onfail == MDS_TRAVERSE_DISCOVER || + onfail == MDS_TRAVERSE_DISCOVERXLOCK) noperm = true; // root CInode *cur = get_root(); @@ -917,8 +918,11 @@ int MDCache::path_traverse(filepath& origpath, // dentry CDentry *dn = cur->dir->lookup(path[depth]); - // xlocked by me? - if (dn && !dn->inode && dn->xlockedby == req) { // hack? + // xlocked and null? + if (onfail == MDS_TRAVERSE_DISCOVERXLOCK && + dn && !dn->inode && dn->is_xlockedbyme(req) && + depth == path.depth()-1) { + dout(10) << "traverse: hit null xlocked dentry at tail of traverse, succeeding" << endl; trace.push_back(dn); break; // done! } @@ -1009,7 +1013,8 @@ int MDCache::path_traverse(filepath& origpath, } else { // not mine. - if (onfail == MDS_TRAVERSE_DISCOVER) { + if (onfail == MDS_TRAVERSE_DISCOVER || + onfail == MDS_TRAVERSE_DISCOVERXLOCK) { // discover filepath want = path.postfixpath(depth); diff --git a/ceph/mds/MDS.cc b/ceph/mds/MDS.cc index 663e8b40c9fea..9c7bd8a5e00d8 100644 --- a/ceph/mds/MDS.cc +++ b/ceph/mds/MDS.cc @@ -1372,9 +1372,15 @@ void MDS::handle_client_rename(MClientRequest *req, C_MDS_RenameTraverseDst *onfinish = new C_MDS_RenameTraverseDst(this, req, ref, srcdiri, srcdir, srcdn, destpath); Context *ondelay = new C_MDS_RetryRequest(this, req, ref); + /* + * use DISCOVERXLOCK mode: + * the dest may not exist, and may be xlocked from a remote host + * we want to succeed if we find the xlocked dentry + * ?? + */ mdcache->path_traverse(destpath, onfinish->trace, false, req, ondelay, - MDS_TRAVERSE_DISCOVER, + MDS_TRAVERSE_DISCOVERXLOCK, onfinish); } diff --git a/ceph/mds/MDS.h b/ceph/mds/MDS.h index f265f7bac89ba..5333cf4ce6ade 100644 --- a/ceph/mds/MDS.h +++ b/ceph/mds/MDS.h @@ -31,9 +31,10 @@ typedef __uint64_t object_t; -#define MDS_TRAVERSE_FORWARD 1 -#define MDS_TRAVERSE_DISCOVER 2 // skips permissions checks etc. -#define MDS_TRAVERSE_FAIL 3 +#define MDS_TRAVERSE_FORWARD 1 +#define MDS_TRAVERSE_DISCOVER 2 // skips permissions checks etc. +#define MDS_TRAVERSE_DISCOVERXLOCK 3 // succeeds on (foreign?) null, xlocked dentries. +#define MDS_TRAVERSE_FAIL 4 class filepath; -- 2.39.5