From: Vicente Cheng Date: Wed, 5 Jul 2017 10:50:34 +0000 (+0800) Subject: mds: misc cleanup X-Git-Tag: v12.1.2~178^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=e4d9353106578f7587538f05ff3bf8fb3c1dbb07;p=ceph.git mds: misc cleanup Signed-off-by: Vicente Cheng --- diff --git a/src/mds/Server.cc b/src/mds/Server.cc index d65b3c9d9aa1..2fe2184e4fe2 100644 --- a/src/mds/Server.cc +++ b/src/mds/Server.cc @@ -3410,7 +3410,9 @@ void Server::handle_client_openc(MDRequestRef& mdr) return; } - if (!(req->head.args.open.flags & CEPH_O_EXCL)) { + bool excl = req->head.args.open.flags & CEPH_O_EXCL; + + if (!excl) { int r = mdcache->path_traverse(mdr, NULL, NULL, req->get_filepath(), &mdr->dn[0], NULL, MDS_TRAVERSE_FORWARD); if (r > 0) return; @@ -3430,10 +3432,8 @@ void Server::handle_client_openc(MDRequestRef& mdr) } return; } - // r == -ENOENT } - bool excl = (req->head.args.open.flags & CEPH_O_EXCL); set rdlocks, wrlocks, xlocks; file_layout_t *dir_layout = NULL; CDentry *dn = rdlock_path_xlock_dentry(mdr, 0, rdlocks, wrlocks, xlocks, @@ -3491,6 +3491,7 @@ void Server::handle_client_openc(MDRequestRef& mdr) return; } + // created null dn. CDir *dir = dn->get_dir(); CInode *diri = dir->get_inode(); rdlocks.insert(&diri->authlock); @@ -3515,8 +3516,6 @@ void Server::handle_client_openc(MDRequestRef& mdr) return; } - // created null dn. - // create inode. SnapRealm *realm = diri->find_snaprealm(); // use directory's realm; inode isn't attached yet. snapid_t follows = realm->get_newest_seq(); diff --git a/src/mon/MDSMonitor.cc b/src/mon/MDSMonitor.cc index 608e1aeedc3e..2bf7681814ea 100644 --- a/src/mon/MDSMonitor.cc +++ b/src/mon/MDSMonitor.cc @@ -537,9 +537,8 @@ bool MDSMonitor::prepare_beacon(MonOpRequestRef op) if (leaderinfo && (leaderinfo->rank >= 0)) { auto fscid = pending_fsmap.mds_roles.at(leaderinfo->global_id); auto fs = pending_fsmap.get_filesystem(fscid); - bool followable = fs->mds_map.is_followable(leaderinfo->rank); - pending_fsmap.modify_daemon(gid, [fscid, leaderinfo, followable]( + pending_fsmap.modify_daemon(gid, [fscid, leaderinfo]( MDSMap::mds_info_t *info) { info->standby_for_rank = leaderinfo->rank; info->standby_for_fscid = fscid; @@ -883,11 +882,11 @@ bool MDSMonitor::preprocess_command(MonOpRequestRef op) } else { mdsmap->print(ds); r = 0; - } - if (r == 0) { - rdata.append(ds); - ss << "dumped fsmap epoch " << p->get_epoch(); } + + rdata.append(ds); + ss << "dumped fsmap epoch " << p->get_epoch(); + if (p != &fsmap) { delete p; } @@ -922,11 +921,11 @@ bool MDSMonitor::preprocess_command(MonOpRequestRef op) } else { p->print(ds); r = 0; - } - if (r == 0) { - rdata.append(ds); - ss << "dumped fsmap epoch " << p->get_epoch(); } + + rdata.append(ds); + ss << "dumped fsmap epoch " << p->get_epoch(); + if (p != &fsmap) delete p; }