4 #include <linux/wait.h>
5 #include <linux/slab.h>
6 #include <linux/sched.h>
63 static int parse_reply_info_in(
void **
p,
void *
end,
98 static int parse_reply_info_trace(
void **p,
void *end,
104 if (info->
head->is_dentry) {
105 err = parse_reply_info_in(p, end, &info->diri, features);
122 *p +=
sizeof(*info->
dlease);
125 if (info->
head->is_target) {
126 err = parse_reply_info_in(p, end, &info->
targeti, features);
138 pr_err(
"problem parsing mds trace %d\n", err);
145 static int parse_reply_info_dir(
void **p,
void *end,
153 if (*p +
sizeof(*info->
dir_dir) > end)
161 num = ceph_decode_32(p);
162 info->
dir_end = ceph_decode_8(p);
195 err = parse_reply_info_in(p, end, &info->
dir_in[i], features);
210 pr_err(
"problem parsing dir contents %d\n", err);
217 static int parse_reply_info_filelock(
void **p,
void *end,
238 static int parse_reply_info_extra(
void **p,
void *end,
243 return parse_reply_info_filelock(p, end, info, features);
245 return parse_reply_info_dir(p, end, info, features);
267 err = parse_reply_info_trace(&p, p+len, info, features);
276 err = parse_reply_info_extra(&p, p+len, info, features);
294 pr_err(
"mds parse_reply err %d\n", err);
307 static const char *session_state_name(
int s)
317 default:
return "???";
324 dout(
"mdsc get_session %p %d -> %d\n", s,
328 dout(
"mdsc get_session %p 0 -- FAIL", s);
335 dout(
"mdsc put_session %p %d -> %d\n", s,
339 s->
s_mdsc->fsc->client->monc.auth->ops->destroy_authorizer(
340 s->
s_mdsc->fsc->client->monc.auth,
357 dout(
"lookup_mds_session %p %d\n", session,
359 get_session(session);
407 INIT_LIST_HEAD(&s->
s_caps);
420 dout(
"register_session mds%d\n", mds);
422 int newmax = 1 << get_count_order(mds+1);
425 dout(
"register_session realloc to %d\n", newmax);
426 sa = kcalloc(newmax,
sizeof(
void *),
GFP_NOFS);
441 ceph_mdsmap_get_addr(mdsc->
mdsmap, mds));
456 dout(
"__unregister_session mds%d %p\n", s->
s_mds, s);
511 put_request_session(req);
529 if (tid < req->r_tid)
531 else if (tid > req->
r_tid)
534 ceph_mdsc_get_request(req);
551 if (new->r_tid < req->
r_tid)
553 else if (new->r_tid > req->
r_tid)
559 rb_link_node(&new->r_node, parent, p);
577 dout(
"__register_request %p tid %lld\n", req, req->
r_tid);
578 ceph_mdsc_get_request(req);
579 __insert_request(mdsc, req);
598 dout(
"__unregister_request %p tid %lld\n", req, req->
r_tid);
613 ceph_mdsc_put_request(req);
655 dout(
"choose_mds using resend_mds mds%d\n",
668 struct dentry *parent = req->
r_dentry->d_parent;
669 struct inode *dir = parent->
d_inode;
671 if (dir->
i_sb != mdsc->
fsc->sb) {
677 struct dentry *
dn = get_nonsnap_parent(parent);
679 dout(
"__choose_mds using nonsnap parent %p\n", inode);
680 }
else if (req->
r_dentry->d_inode) {
691 dout(
"__choose_mds %p is_hash=%d (%d) mode %d\n", inode, (
int)is_hash,
695 ci = ceph_inode(inode);
710 dout(
"choose_mds %p %llx.%llx "
711 "frag %u mds%d (%d/%d)\n",
715 if (ceph_mdsmap_get_state(mdsc->
mdsmap, mds) >=
727 dout(
"choose_mds %p %llx.%llx "
728 "frag %u mds%d (auth)\n",
730 if (ceph_mdsmap_get_state(mdsc->
mdsmap, mds) >=
748 dout(
"choose_mds %p %llx.%llx mds%d (%scap %p)\n",
756 dout(
"choose_mds chose random mds%d\n", mds);
772 pr_err(
"create_session_msg ENOMEM creating msg\n");
775 h = msg->
front.iov_base;
791 int mds = session->
s_mds;
794 mstate = ceph_mdsmap_get_state(mdsc->
mdsmap, mds);
795 dout(
"open_session to mds%d (%s)\n", mds,
813 static void __open_export_target_sessions(
struct ceph_mds_client *mdsc,
818 int i, mds = session->
s_mds;
821 if (mds >= mdsc->
mdsmap->m_max_mds)
823 mi = &mdsc->
mdsmap->m_info[mds];
824 dout(
"open_export_target_sessions for mds%d (%d targets)\n",
831 ts = register_session(mdsc, target);
837 __open_session(mdsc, session);
839 dout(
" mds%d target mds%d %p is %s\n", session->
s_mds,
840 i, ts, session_state_name(ts->
s_state));
849 __open_export_target_sessions(mdsc, session);
896 dout(
"iterate_session_caps %p mds%d\n", session, session->
s_mds);
899 while (p != &session->
s_caps) {
901 inode =
igrab(&cap->
ci->vfs_inode);
918 ret =
cb(inode, cap, arg);
924 dout(
"iterate_session_caps finishing cap %p removal\n",
948 static int remove_session_caps_cb(
struct inode *inode,
struct ceph_cap *cap,
954 dout(
"removing cap %p, ci is %p, inode is %p\n",
958 if (!__ceph_is_any_real_caps(ci)) {
960 ceph_sb_to_client(inode->
i_sb)->mdsc;
963 if (!list_empty(&ci->i_dirty_item)) {
964 pr_info(
" dropping dirty %s state for %p %lld\n",
966 inode, ceph_ino(inode));
968 list_del_init(&ci->i_dirty_item);
972 pr_info(
" dropping dirty+flushing %s state for %p %lld\n",
974 inode, ceph_ino(inode));
981 pr_info(
" dropping dirty data for %p %lld\n",
982 inode, ceph_ino(inode));
1000 dout(
"remove_session_caps on %p\n", session);
1001 iterate_session_caps(session, remove_session_caps_cb,
NULL);
1004 cleanup_cap_releases(session);
1013 static int wake_up_session_cb(
struct inode *inode,
struct ceph_cap *cap,
1031 dout(
"wake_up_session_caps %p mds%d\n", session, session->
s_mds);
1032 iterate_session_caps(session, wake_up_session_cb,
1033 (
void *)(
unsigned long)reconnect);
1055 state = ceph_mdsmap_get_state(mdsc->
mdsmap, session->
s_mds);
1057 dout(
"send_renew_caps ignoring mds%d (%s)\n",
1062 dout(
"send_renew_caps to mds%d (%s)\n", session->
s_mds,
1087 mdsc->
mdsmap->m_session_timeout*
HZ;
1097 dout(
"renewed_caps mds%d ttl now %lu, was %s, now %s\n",
1098 session->
s_mds, session->
s_cap_ttl, was_stale ?
"stale" :
"fresh",
1103 wake_up_session_caps(session, 0);
1114 dout(
"request_close_session mds%d state %s seq %lld\n",
1133 return request_close_session(mdsc, session);
1146 static int trim_caps_cb(
struct inode *inode,
struct ceph_cap *cap,
void *arg)
1150 int used, oissued, mine;
1160 dout(
"trim_caps_cb %p cap %p mine %s oissued %s used %s\n",
1165 if ((used & ~oissued) & mine)
1176 dout(
"trim_caps_cb %p cap %p pruned, count now %d\n",
1195 dout(
"trim_caps mds%d start: %d / %d, trim %d\n",
1197 if (trim_caps > 0) {
1199 iterate_session_caps(session, trim_caps_cb, session);
1200 dout(
"trim_caps mds%d done: %d / %d, trimmed %d\n",
1221 int extra = mdsc->
fsc->mount_options->cap_release_safety;
1224 dout(
"add_cap_releases %p mds%d extra %d\n", session, session->
s_mds,
1233 head = msg->
front.iov_base;
1236 dout(
" partial %p with (%d/%d)\n", msg, num,
1238 extra += CEPH_CAPS_PER_RELEASE -
num;
1248 dout(
"add_cap_releases %p msg %p now %d\n", session, msg,
1249 (
int)msg->
front.iov_len);
1250 head = msg->
front.iov_base;
1252 msg->
front.iov_len =
sizeof(*head);
1259 head = partial->
front.iov_base;
1261 dout(
" queueing partial %p with %d/%d\n", partial, num,
1282 dout(
"check_cap_flush want %lld\n", want_flush_seq);
1284 for (mds = 0; ret && mds < mdsc->
max_sessions; mds++) {
1289 get_session(session);
1302 dout(
"check_cap_flush still flushing %p "
1303 "seq %lld <= %lld to mds%d\n", inode,
1319 dout(
"check_cap_flush ok, flushed thru %lld\n", want_flush_seq);
1331 dout(
"send_cap_releases mds%d\n", session->
s_mds);
1339 dout(
"send_cap_releases mds%d %p\n", session->
s_mds, msg);
1353 dout(
"discard_cap_releases mds%d\n", session->
s_mds);
1359 head = msg->
front.iov_base;
1361 dout(
"discard_cap_releases mds%d %p %u\n", session->
s_mds, msg, num);
1371 head = msg->
front.iov_base;
1373 dout(
"discard_cap_releases mds%d %p %u\n", session->
s_mds, msg,
1377 msg->
front.iov_len =
sizeof(*head);
1406 INIT_LIST_HEAD(&req->
r_wait);
1451 struct dentry *
temp;
1463 for (temp = dentry; !
IS_ROOT(temp);) {
1464 struct inode *inode = temp->
d_inode;
1467 else if (stop_on_nosnap && inode &&
1471 len += 1 + temp->
d_name.len;
1484 for (temp = dentry; !
IS_ROOT(temp) && pos != 0; ) {
1485 struct inode *
inode;
1487 spin_lock(&temp->
d_lock);
1490 dout(
"build_path path+%d: %p SNAPDIR\n",
1492 }
else if (stop_on_nosnap && inode &&
1494 spin_unlock(&temp->
d_lock);
1499 spin_unlock(&temp->
d_lock);
1505 spin_unlock(&temp->
d_lock);
1511 if (pos != 0 || read_seqretry(&
rename_lock, seq)) {
1512 pr_err(
"build_path did not end path lookup where "
1513 "expected, namelen is %d, pos is %d\n", len, pos);
1522 *base = ceph_ino(temp->
d_inode);
1524 dout(
"build_path on %p %d built %llx '%.*s'\n",
1525 dentry, dentry->
d_count, *base, len, path);
1529 static int build_dentry_path(
struct dentry *dentry,
1530 const char **ppath,
int *ppathlen,
u64 *
pino,
1536 *pino = ceph_ino(dentry->
d_parent->d_inode);
1537 *ppath = dentry->
d_name.name;
1538 *ppathlen = dentry->
d_name.len;
1543 return PTR_ERR(path);
1549 static int build_inode_path(
struct inode *inode,
1550 const char **ppath,
int *ppathlen,
u64 *pino,
1553 struct dentry *dentry;
1557 *pino = ceph_ino(inode);
1565 return PTR_ERR(path);
1575 static int set_request_path_attr(
struct inode *rinode,
struct dentry *rdentry,
1576 const char *rpath,
u64 rino,
1577 const char **ppath,
int *pathlen,
1583 r = build_inode_path(rinode, ppath, pathlen, ino, freepath);
1584 dout(
" inode %p %llx.%llx\n", rinode, ceph_ino(rinode),
1586 }
else if (rdentry) {
1587 r = build_dentry_path(rdentry, ppath, pathlen, ino, freepath);
1588 dout(
" dentry %p %llx/%.*s\n", rdentry, *ino, *pathlen,
1590 }
else if (rpath || rino) {
1593 *pathlen =
strlen(rpath);
1594 dout(
" path %.*s\n", *pathlen, rpath);
1609 const char *path1 =
NULL;
1610 const char *path2 =
NULL;
1611 u64 ino1 = 0, ino2 = 0;
1612 int pathlen1 = 0, pathlen2 = 0;
1613 int freepath1 = 0, freepath2 = 0;
1620 req->
r_path1, req->r_ino1.ino,
1621 &path1, &pathlen1, &ino1, &freepath1);
1629 &path2, &pathlen2, &ino2, &freepath2);
1635 len =
sizeof(*head) +
1636 pathlen1 + pathlen2 + 2*(1 +
sizeof(
u32) +
sizeof(
u64));
1655 head = msg->
front.iov_base;
1656 p = msg->
front.iov_base +
sizeof(*head);
1657 end = msg->
front.iov_base + msg->
front.iov_len;
1665 ceph_encode_filepath(&p, end, ino1, path1);
1666 ceph_encode_filepath(&p, end, ino2, path2);
1690 msg->
front.iov_len = p - msg->
front.iov_base;
1700 kfree((
char *)path2);
1703 kfree((
char *)path1);
1742 dout(
"prepare_send_request %p tid %lld %s (attempt %d)\n", req,
1753 rhead = msg->
front.iov_base;
1775 msg = create_request_message(mdsc, req, mds);
1777 req->
r_err = PTR_ERR(msg);
1778 complete_request(mdsc, req);
1779 return PTR_ERR(msg);
1783 rhead = msg->
front.iov_base;
1813 dout(
"do_request timed out\n");
1818 put_request_session(req);
1820 mds = __choose_mds(mdsc, req);
1823 dout(
"do_request no mds or not active, waiting for map\n");
1831 session = register_session(mdsc, mds);
1832 if (IS_ERR(session)) {
1833 err = PTR_ERR(session);
1839 dout(
"do_request mds%d session %p state %s\n", mds, session,
1840 session_state_name(session->
s_state));
1845 __open_session(mdsc, session);
1856 err = __prepare_send_request(mdsc, req, mds);
1869 complete_request(mdsc, req);
1882 list_del_init(&req->
r_wait);
1883 __do_request(mdsc, req);
1896 dout(
"kick_requests mds%d\n", mds);
1903 dout(
" kicking tid %llu\n", req->
r_tid);
1904 __do_request(mdsc, req);
1912 dout(
"submit_request on %p\n", req);
1914 __register_request(mdsc, req,
NULL);
1915 __do_request(mdsc, req);
1929 dout(
"do_request on %p\n", req);
1942 __register_request(mdsc, req, dir);
1943 __do_request(mdsc, req);
1947 __unregister_request(mdsc, req);
1948 dout(
"do_request early error %d\n", err);
1954 dout(
"do_request waiting\n");
1963 dout(
"do_request waited, got %d\n", err);
1969 }
else if (err < 0) {
1970 dout(
"aborted request %lld with %d\n", req->
r_tid, err);
1991 dout(
"do_request %p done, result %d\n", req, err);
2004 dout(
"invalidate_dir_request %p (D_COMPLETE, lease(s))\n", inode);
2031 int mds = session->
s_mds;
2033 if (msg->
front.iov_len <
sizeof(*head)) {
2034 pr_err(
"mdsc_handle_reply got corrupt (short) reply\n");
2042 req = __lookup_request(mdsc, tid);
2044 dout(
"handle_reply on unknown tid %llu\n", tid);
2048 dout(
"handle_reply %p\n", req);
2052 pr_err(
"mdsc_handle_reply got %llu on session mds%d"
2053 " not mds%d\n", tid, session->
s_mds,
2062 pr_warning(
"got a dup %s reply on %llu from mds%d\n",
2063 head->
safe ?
"safe" :
"unsafe", tid, mds);
2068 pr_warning(
"got unsafe after safe on %llu from mds%d\n",
2084 dout(
"got ESTALE on request %llu", req->
r_tid);
2088 dout(
"not using auth, setting for that now");
2090 __do_request(mdsc, req);
2101 dout(
"already using auth");
2104 dout(
"but cap changed, so resending");
2105 __do_request(mdsc, req);
2110 dout(
"have to return ESTALE on request %llu", req->
r_tid);
2116 __unregister_request(mdsc, req);
2127 dout(
"got safe reply %llu, mds%d\n", tid, mds);
2131 if (mdsc->
stopping && !__get_oldest_req(mdsc))
2141 dout(
"handle_reply tid %lld result %d\n", tid, result);
2143 err = parse_reply_info(msg, rinfo, session->
s_con.peer_features);
2148 pr_err(
"mdsc_handle_reply got corrupt reply mds%d(tid:%lld)\n", mds, tid);
2187 dout(
"reply arrived after request %lld was aborted\n", tid);
2195 complete_request(mdsc, req);
2197 ceph_mdsc_put_request(req);
2215 void *p = msg->
front.iov_base;
2216 void *end = p + msg->
front.iov_len;
2219 next_mds = ceph_decode_32(&p);
2220 fwd_seq = ceph_decode_32(&p);
2223 req = __lookup_request(mdsc, tid);
2225 dout(
"forward tid %llu to mds%d - req dne\n", tid, next_mds);
2230 dout(
"forward tid %llu aborted, unregistering\n", tid);
2231 __unregister_request(mdsc, req);
2233 dout(
"forward tid %llu to mds%d - old seq %d <= %d\n",
2234 tid, next_mds, req->
r_num_fwd, fwd_seq);
2237 dout(
"forward tid %llu to mds%d (we resend)\n", tid, next_mds);
2242 put_request_session(req);
2243 __do_request(mdsc, req);
2245 ceph_mdsc_put_request(req);
2251 pr_err(
"mdsc_handle_forward decode error err=%d\n", err);
2263 int mds = session->
s_mds;
2268 if (msg->
front.iov_len !=
sizeof(*h))
2275 __unregister_session(mdsc, session);
2282 dout(
"handle_session mds%d %s %p state %s seq %llu\n",
2284 session_state_name(session->
s_state), seq);
2296 renewed_caps(mdsc, session, 0);
2299 __close_session(mdsc, session);
2304 renewed_caps(mdsc, session, 1);
2310 remove_session_caps(session);
2313 kick_requests(mdsc, mds);
2317 pr_info(
"mds%d caps went stale, renewing\n",
2323 send_renew_caps(mdsc, session);
2331 pr_err(
"mdsc_handle_session bad op %d mds%d\n", op, mds);
2338 __wake_requests(mdsc, &session->
s_waiting);
2344 pr_err(
"mdsc_handle_session corrupt message mds%d len %d\n", mds,
2345 (
int)msg->
front.iov_len);
2360 dout(
"replay_unsafe_requests mds%d\n", session->
s_mds);
2364 err = __prepare_send_request(mdsc, req, session->
s_mds);
2376 static int encode_caps_cb(
struct inode *inode,
struct ceph_cap *cap,
2390 struct dentry *dentry;
2394 dout(
" adding %p ino %llx.%llx cap %p %lld %s\n",
2397 err = ceph_pagelist_encode_64(pagelist, ceph_ino(inode));
2405 err = PTR_ERR(path);
2412 err = ceph_pagelist_encode_string(pagelist, path, pathlen);
2420 if (recon_state->
flock) {
2422 rec.v2.wanted =
cpu_to_le32(__ceph_caps_wanted(ci));
2426 rec.v2.flock_len = 0;
2427 reclen =
sizeof(rec.v2);
2430 rec.v1.wanted =
cpu_to_le32(__ceph_caps_wanted(ci));
2433 ceph_encode_timespec(&rec.v1.mtime, &inode->
i_mtime);
2434 ceph_encode_timespec(&rec.v1.atime, &inode->
i_atime);
2437 reclen =
sizeof(rec.v1);
2441 if (recon_state->
flock) {
2442 int num_fcntl_locks, num_flock_locks;
2450 rec.v2.flock_len = (2*
sizeof(
u32) +
2451 (num_fcntl_locks+num_flock_locks) *
2471 }
while (err == -
ENOSPC);
2501 int mds = session->
s_mds;
2506 pr_info(
"mds%d reconnect start\n", mds);
2510 goto fail_nopagelist;
2511 ceph_pagelist_init(pagelist);
2524 ceph_mdsmap_get_addr(mdsc->
mdsmap, mds));
2527 replay_unsafe_requests(mdsc, session);
2531 dout(
"session %p state %s\n", session,
2532 session_state_name(session->
s_state));
2535 discard_cap_releases(mdsc, session);
2538 err = ceph_pagelist_encode_32(pagelist, session->
s_nr_caps);
2544 err = iterate_session_caps(session, encode_caps_cb, &recon_state);
2558 dout(
" adding snap realm %llx seq %lld parent %llx\n",
2569 if (recon_state.
flock)
2578 __wake_requests(mdsc, &session->
s_waiting);
2585 ceph_msg_put(reply);
2592 pr_err(
"error %d preparing reconnect for mds%d\n", err, mds);
2608 int oldstate, newstate;
2611 dout(
"check_new_map new %u old %u\n",
2618 oldstate = ceph_mdsmap_get_state(oldmap, i);
2619 newstate = ceph_mdsmap_get_state(newmap, i);
2621 dout(
"check_new_map mds%d state %s%s -> %s%s (session %s)\n",
2623 ceph_mdsmap_is_laggy(oldmap, i) ?
" (laggy)" :
"",
2625 ceph_mdsmap_is_laggy(newmap, i) ?
" (laggy)" :
"",
2626 session_state_name(s->
s_state));
2629 memcmp(ceph_mdsmap_get_addr(oldmap, i),
2630 ceph_mdsmap_get_addr(newmap, i),
2636 __unregister_session(mdsc, s);
2648 kick_requests(mdsc, i);
2649 }
else if (oldstate == newstate) {
2659 send_mds_reconnect(mdsc, s);
2671 kick_requests(mdsc, i);
2673 wake_up_session_caps(s, 1);
2681 if (!ceph_mdsmap_is_laggy(newmap, i))
2686 dout(
" connecting to export targets of laggy mds%d\n",
2688 __open_export_target_sessions(mdsc, s);
2715 struct inode *
inode;
2716 struct dentry *parent, *dentry;
2718 int mds = session->
s_mds;
2725 dout(
"handle_lease from mds%d\n", mds);
2728 if (msg->
front.iov_len <
sizeof(*h) +
sizeof(
u32))
2733 dname.name = (
void *)h +
sizeof(*h) +
sizeof(
u32);
2734 dname.len = msg->
front.iov_len -
sizeof(*h) -
sizeof(
u32);
2742 inode = ceph_find_inode(sb, vino);
2743 dout(
"handle_lease %s, ino %llx %p %.*s\n",
2745 dname.len, dname.name);
2746 if (inode ==
NULL) {
2747 dout(
"handle_lease no inode %llx\n", vino.ino);
2754 dout(
"no parent dentry on inode %p\n", inode);
2764 spin_lock(&dentry->
d_lock);
2765 di = ceph_dentry(dentry);
2769 if (ceph_seq_cmp(di->
lease_seq, seq) > 0)
2792 spin_unlock(&dentry->
d_lock);
2810 pr_err(
"corrupt lease message\n");
2815 struct inode *inode,
2816 struct dentry *dentry,
char action,
2821 int len =
sizeof(*lease) +
sizeof(
u32);
2824 dout(
"lease_send_msg inode %p dentry %p %s to mds%d\n",
2826 dnamelen = dentry->
d_name.len;
2832 lease = msg->
front.iov_base;
2838 memcpy((
void *)(lease + 1) + 4, dentry->
d_name.name, dnamelen);
2855 struct dentry *dentry)
2865 spin_lock(&dentry->
d_lock);
2866 di = ceph_dentry(dentry);
2871 dout(
"lease_release inode %p dentry %p -- "
2874 spin_unlock(&dentry->
d_lock);
2882 spin_unlock(&dentry->
d_lock);
2884 dout(
"lease_release inode %p dentry %p to mds%d\n",
2885 inode, dentry, session->
s_mds);
2898 dout(
"drop_leases\n");
2933 dout(
"mdsc delayed_work\n");
2937 renew_interval = mdsc->
mdsmap->m_session_timeout >> 2;
2948 dout(
"resending session close request for mds%d\n",
2950 request_close_session(mdsc, s);
2969 send_renew_caps(mdsc, s);
2983 schedule_delayed(mdsc);
3044 if (__get_oldest_req(mdsc)) {
3047 dout(
"wait_requests waiting for requests\n");
3049 fsc->
client->options->mount_timeout *
HZ);
3053 while ((req = __get_oldest_req(mdsc))) {
3054 dout(
"wait_requests timed out on tid %llu\n",
3056 __unregister_request(mdsc, req);
3060 dout(
"wait_requests done\n");
3069 dout(
"pre_umount\n");
3074 wait_requests(mdsc);
3092 dout(
"wait_unsafe_requests want %lld\n", want_tid);
3094 req = __get_oldest_req(mdsc);
3095 while (req && req->
r_tid <= want_tid) {
3104 ceph_mdsc_get_request(req);
3106 ceph_mdsc_get_request(nextreq);
3108 dout(
"wait_unsafe_requests wait on %llu (want %llu)\n",
3109 req->
r_tid, want_tid);
3112 ceph_mdsc_put_request(req);
3117 ceph_mdsc_put_request(nextreq);
3120 ceph_mdsc_put_request(nextreq);
3125 dout(
"wait_unsafe_requests done\n");
3130 u64 want_tid, want_flush;
3140 dout(
"sync want tid %lld flush_seq %lld\n", want_tid, want_flush);
3144 wait_unsafe_requests(mdsc, want_tid);
3176 dout(
"close_sessions\n");
3186 __close_session(mdsc, session);
3193 dout(
"waiting for sessions to close\n");
3201 session = get_session(mdsc->
sessions[i]);
3202 __unregister_session(mdsc, session);
3205 remove_session_caps(session);
3235 dout(
"mdsc_destroy %p\n", mdsc);
3236 ceph_mdsc_stop(mdsc);
3243 dout(
"mdsc_destroy %p done\n", mdsc);
3254 void *p = msg->
front.iov_base;
3255 void *end = p + msg->
front.iov_len;
3261 ceph_decode_copy(&p, &fsid,
sizeof(fsid));
3264 epoch = ceph_decode_32(&p);
3265 maplen = ceph_decode_32(&p);
3266 dout(
"handle_map epoch %u len %d\n", epoch, (
int)maplen);
3271 if (mdsc->
mdsmap && epoch <= mdsc->mdsmap->m_epoch) {
3272 dout(
"handle_map epoch %u <= our %u\n",
3273 epoch, mdsc->
mdsmap->m_epoch);
3279 if (IS_ERR(newmap)) {
3280 err = PTR_ERR(newmap);
3288 check_new_map(mdsc, newmap, oldmap);
3293 mdsc->
fsc->sb->s_maxbytes = mdsc->
mdsmap->m_max_file_size;
3298 schedule_delayed(mdsc);
3304 pr_err(
"error decoding mdsmap %d\n", err);
3312 if (get_session(s)) {
3316 dout(
"mdsc con_get %p FAIL\n", s);
3338 send_mds_reconnect(mdsc, s);
3348 if (__verify_registered_session(mdsc, s) < 0) {
3359 handle_session(s, msg);
3362 handle_reply(s, msg);
3365 handle_forward(mdsc, s, msg);
3374 handle_lease(mdsc, s, msg);
3378 pr_err(
"received unknown message type %d %s\n", type,
3394 int *
proto,
int force_new)
3402 if (ac->
ops && ac->
ops->destroy_authorizer)
3410 return ERR_PTR(ret);
3418 static int verify_authorizer_reply(
struct ceph_connection *con,
int len)
3424 return ac->
ops->verify_authorizer_reply(ac, s->
s_auth.authorizer, len);
3433 if (ac->
ops->invalidate_authorizer)