diff options
Diffstat (limited to 'fs/ceph/caps.c')
-rw-r--r-- | fs/ceph/caps.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c index 3251e9cc6401..a1d9bb30c1bf 100644 --- a/fs/ceph/caps.c +++ b/fs/ceph/caps.c | |||
@@ -236,8 +236,10 @@ static struct ceph_cap *get_cap(struct ceph_mds_client *mdsc, | |||
236 | if (!ctx) { | 236 | if (!ctx) { |
237 | cap = kmem_cache_alloc(ceph_cap_cachep, GFP_NOFS); | 237 | cap = kmem_cache_alloc(ceph_cap_cachep, GFP_NOFS); |
238 | if (cap) { | 238 | if (cap) { |
239 | spin_lock(&mdsc->caps_list_lock); | ||
239 | mdsc->caps_use_count++; | 240 | mdsc->caps_use_count++; |
240 | mdsc->caps_total_count++; | 241 | mdsc->caps_total_count++; |
242 | spin_unlock(&mdsc->caps_list_lock); | ||
241 | } | 243 | } |
242 | return cap; | 244 | return cap; |
243 | } | 245 | } |
@@ -1349,11 +1351,15 @@ int __ceph_mark_dirty_caps(struct ceph_inode_info *ci, int mask) | |||
1349 | if (!ci->i_head_snapc) | 1351 | if (!ci->i_head_snapc) |
1350 | ci->i_head_snapc = ceph_get_snap_context( | 1352 | ci->i_head_snapc = ceph_get_snap_context( |
1351 | ci->i_snap_realm->cached_context); | 1353 | ci->i_snap_realm->cached_context); |
1352 | dout(" inode %p now dirty snapc %p\n", &ci->vfs_inode, | 1354 | dout(" inode %p now dirty snapc %p auth cap %p\n", |
1353 | ci->i_head_snapc); | 1355 | &ci->vfs_inode, ci->i_head_snapc, ci->i_auth_cap); |
1354 | BUG_ON(!list_empty(&ci->i_dirty_item)); | 1356 | BUG_ON(!list_empty(&ci->i_dirty_item)); |
1355 | spin_lock(&mdsc->cap_dirty_lock); | 1357 | spin_lock(&mdsc->cap_dirty_lock); |
1356 | list_add(&ci->i_dirty_item, &mdsc->cap_dirty); | 1358 | if (ci->i_auth_cap) |
1359 | list_add(&ci->i_dirty_item, &mdsc->cap_dirty); | ||
1360 | else | ||
1361 | list_add(&ci->i_dirty_item, | ||
1362 | &mdsc->cap_dirty_migrating); | ||
1357 | spin_unlock(&mdsc->cap_dirty_lock); | 1363 | spin_unlock(&mdsc->cap_dirty_lock); |
1358 | if (ci->i_flushing_caps == 0) { | 1364 | if (ci->i_flushing_caps == 0) { |
1359 | ihold(inode); | 1365 | ihold(inode); |
@@ -2388,7 +2394,7 @@ static void handle_cap_grant(struct inode *inode, struct ceph_mds_caps *grant, | |||
2388 | &atime); | 2394 | &atime); |
2389 | 2395 | ||
2390 | /* max size increase? */ | 2396 | /* max size increase? */ |
2391 | if (max_size != ci->i_max_size) { | 2397 | if (ci->i_auth_cap == cap && max_size != ci->i_max_size) { |
2392 | dout("max_size %lld -> %llu\n", ci->i_max_size, max_size); | 2398 | dout("max_size %lld -> %llu\n", ci->i_max_size, max_size); |
2393 | ci->i_max_size = max_size; | 2399 | ci->i_max_size = max_size; |
2394 | if (max_size >= ci->i_wanted_max_size) { | 2400 | if (max_size >= ci->i_wanted_max_size) { |
@@ -2745,6 +2751,7 @@ static void handle_cap_import(struct ceph_mds_client *mdsc, | |||
2745 | 2751 | ||
2746 | /* make sure we re-request max_size, if necessary */ | 2752 | /* make sure we re-request max_size, if necessary */ |
2747 | spin_lock(&ci->i_ceph_lock); | 2753 | spin_lock(&ci->i_ceph_lock); |
2754 | ci->i_wanted_max_size = 0; /* reset */ | ||
2748 | ci->i_requested_max_size = 0; | 2755 | ci->i_requested_max_size = 0; |
2749 | spin_unlock(&ci->i_ceph_lock); | 2756 | spin_unlock(&ci->i_ceph_lock); |
2750 | } | 2757 | } |
@@ -2840,8 +2847,6 @@ void ceph_handle_caps(struct ceph_mds_session *session, | |||
2840 | case CEPH_CAP_OP_IMPORT: | 2847 | case CEPH_CAP_OP_IMPORT: |
2841 | handle_cap_import(mdsc, inode, h, session, | 2848 | handle_cap_import(mdsc, inode, h, session, |
2842 | snaptrace, snaptrace_len); | 2849 | snaptrace, snaptrace_len); |
2843 | ceph_check_caps(ceph_inode(inode), 0, session); | ||
2844 | goto done_unlocked; | ||
2845 | } | 2850 | } |
2846 | 2851 | ||
2847 | /* the rest require a cap */ | 2852 | /* the rest require a cap */ |
@@ -2858,6 +2863,7 @@ void ceph_handle_caps(struct ceph_mds_session *session, | |||
2858 | switch (op) { | 2863 | switch (op) { |
2859 | case CEPH_CAP_OP_REVOKE: | 2864 | case CEPH_CAP_OP_REVOKE: |
2860 | case CEPH_CAP_OP_GRANT: | 2865 | case CEPH_CAP_OP_GRANT: |
2866 | case CEPH_CAP_OP_IMPORT: | ||
2861 | handle_cap_grant(inode, h, session, cap, msg->middle); | 2867 | handle_cap_grant(inode, h, session, cap, msg->middle); |
2862 | goto done_unlocked; | 2868 | goto done_unlocked; |
2863 | 2869 | ||