m->time_warp_seq = in->time_warp_seq;
m->change_attr = in->change_attr;
if (sync)
- m->flags |= CLIENT_CAPS_SYNC;
+ m->flags |= MClientCaps::FLAG_SYNC;
+ if (in->cap_snaps.empty())
+ m->flags |= MClientCaps::FLAG_NO_CAPSNAP;
+ else
+ m->flags |= MClientCaps::FLAG_PENDING_CAPSNAP;
if (flush & CEPH_CAP_FILE_WR) {
m->inline_version = in->inline_version;
snapid_t follows = m->get_snap_follows();
dout(7) << "handle_client_caps "
- << ((m->flags & CLIENT_CAPS_SYNC) ? "sync" : "async")
<< " on " << m->get_ino()
<< " tid " << m->get_client_tid() << " follows " << follows
- << " op " << ceph_cap_op_name(m->get_op()) << dendl;
+ << " op " << ceph_cap_op_name(m->get_op())
+ << " flags 0x" << hex << m->flags << dendl;
if (!mds->is_clientreplay() && !mds->is_active() && !mds->is_stopping()) {
if (!session) {
// released all WR/EXCL caps (the FLUSHSNAP always comes before the cap
// update/release).
if (!head_in->client_need_snapflush.empty()) {
- if ((cap->issued() & CEPH_CAP_ANY_FILE_WR) == 0) {
+ if ((m->flags & MClientCaps::FLAG_NO_CAPSNAP) ||
+ (!(cap->issued() & CEPH_CAP_ANY_FILE_WR) &&
+ !(m->flags & MClientCaps::FLAG_PENDING_CAPSNAP))) {
head_in->auth_pin(this); // prevent subtree frozen
need_unpin = true;
_do_null_snapflush(head_in, client);
}
// filter wanted based on what we could ever give out (given auth/replica status)
- bool need_flush = m->flags & CLIENT_CAPS_SYNC;
+ bool need_flush = m->flags & MClientCaps::FLAG_SYNC;
int new_wanted = m->get_wanted() & head_in->get_caps_allowed_ever();
if (new_wanted != cap->wanted()) {
if (!need_flush && (new_wanted & ~cap->pending())) {
#include "msg/Message.h"
#include "include/ceph_features.h"
-#define CLIENT_CAPS_SYNC (0x1)
-
class MClientCaps : public Message {
static const int HEAD_VERSION = 10;
static const int COMPAT_VERSION = 1;
public:
+ static const unsigned FLAG_SYNC = (1<<0);
+ static const unsigned FLAG_NO_CAPSNAP = (1<<1);
+ static const unsigned FLAG_PENDING_CAPSNAP = (1<<2);
+
struct ceph_mds_caps_head head;
uint64_t size, max_size, truncate_size, change_attr;