From 77869d9c85803654d35ecde7af2e54690fdec292 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 13 May 2008 07:39:42 -0700 Subject: [PATCH] mds: eliminate OP_CREATE; make open O_TRUNC|O_CREAT retry behave --- src/TODO | 2 -- src/include/ceph_fs.h | 1 - src/mds/Server.cc | 17 ++++++++++------- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/TODO b/src/TODO index a3c8d024bdaba..88d0c292d8b64 100644 --- a/src/TODO +++ b/src/TODO @@ -25,14 +25,12 @@ userspace client - also needs cope with mds failures kernel client -- direct mds requests intelligently - flush caps on sync, fsync, etc. - do we need to block? - timeout mds session close on umount - deal with CAP_RDCACHE properly: invalidate cache pages? - what happens after reconnect when we get successful reply but no trace (!) on e.g. rename, unlink, link, open+O_CREAT, etc... - fallback in each case (in ceph_unlink, _rename, etc.) when reply has no trace? - - what about open(O_WR or O_CREAT)? pbly needs fix in mds... tho it's racey now... - procfs/debugfs - adjust granular debug levels too - should we be using debugfs? diff --git a/src/include/ceph_fs.h b/src/include/ceph_fs.h index 0853d276f6aaf..e2f21de01897d 100644 --- a/src/include/ceph_fs.h +++ b/src/include/ceph_fs.h @@ -483,7 +483,6 @@ enum { CEPH_MDS_OP_RMDIR = 0x01221, CEPH_MDS_OP_SYMLINK = 0x01222, - CEPH_MDS_OP_CREATE = 0x10301, CEPH_MDS_OP_OPEN = 0x10302, CEPH_MDS_OP_TRUNCATE = 0x11303, CEPH_MDS_OP_LTRUNCATE = 0x01303, diff --git a/src/mds/Server.cc b/src/mds/Server.cc index 060f385739894..c5a5e0b847f5f 100644 --- a/src/mds/Server.cc +++ b/src/mds/Server.cc @@ -683,7 +683,8 @@ void Server::handle_client_request(MClientRequest *req) } // retry? - if (req->get_retry_attempt()) { + if (req->get_retry_attempt() && + req->get_op() != CEPH_MDS_OP_OPEN) { assert(session); if (session->have_completed_request(req->get_reqid().tid)) { dout(5) << "already completed " << req->get_reqid() << dendl; @@ -758,12 +759,12 @@ void Server::dispatch_client_request(MDRequest *mdr) // funky. case CEPH_MDS_OP_OPEN: - if ((req->head.args.open.flags & O_CREAT) == 0) { + if ((req->head.args.open.flags & O_CREAT) && + !(req->get_retry_attempt() && + mdr->session->have_completed_request(req->get_reqid().tid))) + handle_client_openc(mdr); + else handle_client_open(mdr); - break; - } - case CEPH_MDS_OP_CREATE: - handle_client_openc(mdr); break; // namespace. @@ -3988,7 +3989,9 @@ void Server::handle_client_open(MDRequest *mdr) // hmm, check permissions or something. // O_TRUNC - if (flags & O_TRUNC) { + if ((flags & O_TRUNC) && + !(req->get_retry_attempt() && + mdr->session->have_completed_request(req->get_reqid().tid))) { assert(cur->is_auth()); // xlock file size -- 2.39.5