insert_trace * * insert a trace from a MDS reply into the cache. */
| 1750 | * insert a trace from a MDS reply into the cache. |
| 1751 | */ |
| 1752 | Inode* Client::insert_trace(MetaRequest *request, MetaSession *session) |
| 1753 | { |
| 1754 | auto& reply = request->reply; |
| 1755 | int op = request->get_op(); |
| 1756 | |
| 1757 | ldout(cct, 10) << "insert_trace from " << request->sent_stamp << " mds." << session->mds_num |
| 1758 | << " is_target=" << (int)reply->head.is_target |
| 1759 | << " is_dentry=" << (int)reply->head.is_dentry |
| 1760 | << dendl; |
| 1761 | |
| 1762 | auto p = reply->get_trace_bl().cbegin(); |
| 1763 | if (request->got_unsafe) { |
| 1764 | ldout(cct, 10) << "insert_trace -- already got unsafe; ignoring" << dendl; |
| 1765 | ceph_assert(p.end()); |
| 1766 | return NULL; |
| 1767 | } |
| 1768 | |
| 1769 | if (p.end()) { |
| 1770 | ldout(cct, 10) << "insert_trace -- no trace" << dendl; |
| 1771 | |
| 1772 | Dentry *d = request->dentry(); |
| 1773 | if (d) { |
| 1774 | Inode *diri = d->dir->parent_inode; |
| 1775 | clear_dir_complete_and_ordered(diri, true); |
| 1776 | } |
| 1777 | |
| 1778 | if (d && reply->get_result() == 0) { |
| 1779 | if (op == CEPH_MDS_OP_RENAME) { |
| 1780 | // rename |
| 1781 | Dentry *od = request->old_dentry(); |
| 1782 | ldout(cct, 10) << " unlinking rename src dn " << od << " for traceless reply" << dendl; |
| 1783 | ceph_assert(od); |
| 1784 | unlink(od, true, true); // keep dir, dentry |
| 1785 | } else if (op == CEPH_MDS_OP_RMDIR || |
| 1786 | op == CEPH_MDS_OP_UNLINK) { |
| 1787 | // unlink, rmdir |
| 1788 | ldout(cct, 10) << " unlinking unlink/rmdir dn " << d << " for traceless reply" << dendl; |
| 1789 | unlink(d, true, true); // keep dir, dentry |
| 1790 | } |
| 1791 | } |
| 1792 | return NULL; |
| 1793 | } |
| 1794 | |
| 1795 | ConnectionRef con = request->reply->get_connection(); |
| 1796 | uint64_t features; |
| 1797 | if (session->mds_features.test(CEPHFS_FEATURE_REPLY_ENCODING)) { |
| 1798 | features = (uint64_t)-1; |
| 1799 | } |
| 1800 | else { |
| 1801 | features = con->get_features(); |
| 1802 | } |
| 1803 | ldout(cct, 10) << " features 0x" << hex << features << dec << dendl; |
| 1804 | |
| 1805 | // snap trace |
| 1806 | SnapRealm *realm = NULL; |
| 1807 | if (reply->snapbl.length()) |
| 1808 | update_snap_trace(session, reply->snapbl, &realm); |
| 1809 |
nothing calls this directly
no test coverage detected