]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
kclient: fix xattrs cap message
authorYehuda Sadeh <yehuda@hq.newdream.net>
Thu, 16 Apr 2009 22:45:14 +0000 (15:45 -0700)
committerYehuda Sadeh <yehuda@hq.newdream.net>
Thu, 16 Apr 2009 22:45:14 +0000 (15:45 -0700)
src/include/ceph_fs.h
src/kernel/caps.c
src/messages/MClientCaps.h

index 8f94807d7076a6fb6ad732c45934b526d709c3d6..0fd2de5beaaff24a6fd157f7015eefda3277b828 100644 (file)
@@ -1075,10 +1075,6 @@ struct ceph_mds_caps {
        struct ceph_timespec mtime, atime, ctime;
        struct ceph_file_layout layout;
        __le32 time_warp_seq;
-
-       /* xattrs */
-       __le32 xattrs_blob_size;
-       char xattrs_blob[0];
 } __attribute__ ((packed));
 
 struct ceph_mds_cap_release {
index c825891e726e92aad92d5fd9a87b1e97b8090e25..736e800dd7140b73bcf3a72e9ffb9803200362f7 100644 (file)
@@ -699,13 +699,14 @@ static void send_cap_msg(struct ceph_mds_client *mdsc, u64 ino, u64 cid, int op,
                         struct timespec *mtime, struct timespec *atime,
                         u64 time_warp_seq,
                         uid_t uid, gid_t gid, mode_t mode,
+                        u64 xattr_version,
                         void *xattrs_blob, int xattrs_blob_size,
                         u64 follows, int mds)
 {
        struct ceph_mds_caps *fc;
        struct ceph_msg *msg;
 
-       dout(10, "send_cap_msg %s %llx %llx caps %s wanted %s dirty %s"
+       dout(0, "send_cap_msg %s %llx %llx caps %s wanted %s dirty %s"
             " seq %llu/%llu follows %lld size %llu\n", ceph_cap_op_name(op),
             cid, ino, ceph_cap_string(caps), ceph_cap_string(wanted),
             ceph_cap_string(dirty),
@@ -741,10 +742,13 @@ static void send_cap_msg(struct ceph_mds_client *mdsc, u64 ino, u64 cid, int op,
        fc->gid = cpu_to_le32(gid);
        fc->mode = cpu_to_le32(mode);
 
-       fc->xattrs_blob_size = xattrs_blob_size;
+       fc->xattr_version = xattr_version;
        if (xattrs_blob) {
-               dout(0, "sending xattrs blob size=%d\n", xattrs_blob_size);
-               memcpy(&fc->xattrs_blob[0],  xattrs_blob, xattrs_blob_size);
+               char *dst = (char *)fc;
+               dst += sizeof(*fc);
+
+               fc->xattr_len = xattrs_blob_size;
+               memcpy(dst,  xattrs_blob, xattrs_blob_size);
        }
 
        ceph_send_msg_mds(mdsc, msg, mds);
@@ -836,6 +840,7 @@ static void __send_cap(struct ceph_mds_client *mdsc, struct ceph_cap *cap,
        int mds = cap->session->s_mds;
        void *xattrs_blob = NULL;
        int xattrs_blob_size;
+       u64 xattr_version = 0;
 
        dout(10, "__send_cap cap %p session %p %s -> %s (revoking %s)\n",
             cap, cap->session,
@@ -887,6 +892,7 @@ static void __send_cap(struct ceph_mds_client *mdsc, struct ceph_cap *cap,
                __ceph_build_xattrs_blob(ci, &xattrs_blob, &xattrs_blob_size);
                ci->i_xattrs.prealloc_blob = 0;
                ci->i_xattrs.prealloc_size = 0;
+               xattr_version = ci->i_xattrs.version + 1;
        }
 
        spin_unlock(&inode->i_lock);
@@ -901,6 +907,7 @@ static void __send_cap(struct ceph_mds_client *mdsc, struct ceph_cap *cap,
                     op, keep, want, flushing, seq, mseq,
                     size, max_size, &mtime, &atime, time_warp_seq,
                     uid, gid, mode,
+                    xattr_version,
                     xattrs_blob, xattrs_blob_size,
                     follows, mds);
 
@@ -992,7 +999,7 @@ retry:
                             &capsnap->mtime, &capsnap->atime,
                             capsnap->time_warp_seq,
                             capsnap->uid, capsnap->gid, capsnap->mode,
-                            NULL, 0,
+                            0, NULL, 0,
                             capsnap->follows, mds);
 
                next_follows = capsnap->follows + 1;
index c1221af0bf4ceca0146a56b698774109ab17a731..35250d21eae568264eea3c1d772a271b228d1bd7 100644 (file)
@@ -127,6 +127,7 @@ class MClientCaps : public Message {
     bufferlist::iterator p = payload.begin();
     ::decode(head, p);
     ::decode_nohead(head.snap_trace_len, snapbl, p);
+    cout << "decoding xattr size=" << head.xattr_len << std::endl;
     ::decode_nohead(head.xattr_len, xattrbl, p);
   }
   void encode_payload() {