]> Pileus Git - ~andy/linux/blobdiff - fs/ceph/caps.c
ceph: Don't update i_max_size when handling non-auth cap
[~andy/linux] / fs / ceph / caps.c
index 620daad201dbc8905f09359b8237a542be1f311e..8072aefc427cef7486f24905150c081c3bd9534f 100644 (file)
@@ -236,8 +236,10 @@ static struct ceph_cap *get_cap(struct ceph_mds_client *mdsc,
        if (!ctx) {
                cap = kmem_cache_alloc(ceph_cap_cachep, GFP_NOFS);
                if (cap) {
+                       spin_lock(&mdsc->caps_list_lock);
                        mdsc->caps_use_count++;
                        mdsc->caps_total_count++;
+                       spin_unlock(&mdsc->caps_list_lock);
                }
                return cap;
        }
@@ -1005,7 +1007,7 @@ static void __queue_cap_release(struct ceph_mds_session *session,
 
        BUG_ON(msg->front.iov_len + sizeof(*item) > PAGE_CACHE_SIZE);
        head = msg->front.iov_base;
-       head->num = cpu_to_le32(le32_to_cpu(head->num) + 1);
+       le32_add_cpu(&head->num, 1);
        item = msg->front.iov_base + msg->front.iov_len;
        item->ino = cpu_to_le64(ino);
        item->cap_id = cpu_to_le64(cap_id);
@@ -2388,7 +2390,7 @@ static void handle_cap_grant(struct inode *inode, struct ceph_mds_caps *grant,
                            &atime);
 
        /* max size increase? */
-       if (max_size != ci->i_max_size) {
+       if (ci->i_auth_cap == cap && max_size != ci->i_max_size) {
                dout("max_size %lld -> %llu\n", ci->i_max_size, max_size);
                ci->i_max_size = max_size;
                if (max_size >= ci->i_wanted_max_size) {