diff options
author | Yan, Zheng <zheng.z.yan@intel.com> | 2014-04-10 22:18:07 -0400 |
---|---|---|
committer | Yan, Zheng <zheng.z.yan@intel.com> | 2014-06-05 21:29:51 -0400 |
commit | c6bcda6f525129b1df169f77d96a4b0972e1ecb1 (patch) | |
tree | e9c18bf0c22da7e223bf825d91534c004b84d480 | |
parent | 979d4c1895474aafa473f441846dd3b6f7276202 (diff) |
ceph: queue vmtruncate if necessary when handing cap grant/revoke
cap grant/revoke message from non-auth MDS can update inode's size
and truncate_seq/truncate_size. (the message arrives before auth
MDS's cap trunc message)
Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
-rw-r--r-- | fs/ceph/caps.c | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c index c561b628ebce..de39a03f5b71 100644 --- a/fs/ceph/caps.c +++ b/fs/ceph/caps.c | |||
@@ -2418,11 +2418,12 @@ static void handle_cap_grant(struct inode *inode, struct ceph_mds_caps *grant, | |||
2418 | u64 max_size = le64_to_cpu(grant->max_size); | 2418 | u64 max_size = le64_to_cpu(grant->max_size); |
2419 | struct timespec mtime, atime, ctime; | 2419 | struct timespec mtime, atime, ctime; |
2420 | int check_caps = 0; | 2420 | int check_caps = 0; |
2421 | int wake = 0; | 2421 | bool wake = 0; |
2422 | int writeback = 0; | 2422 | bool writeback = 0; |
2423 | int queue_invalidate = 0; | 2423 | bool queue_trunc = 0; |
2424 | int deleted_inode = 0; | 2424 | bool queue_invalidate = 0; |
2425 | int queue_revalidate = 0; | 2425 | bool queue_revalidate = 0; |
2426 | bool deleted_inode = 0; | ||
2426 | 2427 | ||
2427 | dout("handle_cap_grant inode %p cap %p mds%d seq %d %s\n", | 2428 | dout("handle_cap_grant inode %p cap %p mds%d seq %d %s\n", |
2428 | inode, cap, mds, seq, ceph_cap_string(newcaps)); | 2429 | inode, cap, mds, seq, ceph_cap_string(newcaps)); |
@@ -2512,9 +2513,10 @@ static void handle_cap_grant(struct inode *inode, struct ceph_mds_caps *grant, | |||
2512 | queue_revalidate = 1; | 2513 | queue_revalidate = 1; |
2513 | 2514 | ||
2514 | /* size/ctime/mtime/atime? */ | 2515 | /* size/ctime/mtime/atime? */ |
2515 | ceph_fill_file_size(inode, issued, | 2516 | queue_trunc = ceph_fill_file_size(inode, issued, |
2516 | le32_to_cpu(grant->truncate_seq), | 2517 | le32_to_cpu(grant->truncate_seq), |
2517 | le64_to_cpu(grant->truncate_size), size); | 2518 | le64_to_cpu(grant->truncate_size), |
2519 | size); | ||
2518 | ceph_decode_timespec(&mtime, &grant->mtime); | 2520 | ceph_decode_timespec(&mtime, &grant->mtime); |
2519 | ceph_decode_timespec(&atime, &grant->atime); | 2521 | ceph_decode_timespec(&atime, &grant->atime); |
2520 | ceph_decode_timespec(&ctime, &grant->ctime); | 2522 | ceph_decode_timespec(&ctime, &grant->ctime); |
@@ -2595,6 +2597,12 @@ static void handle_cap_grant(struct inode *inode, struct ceph_mds_caps *grant, | |||
2595 | 2597 | ||
2596 | spin_unlock(&ci->i_ceph_lock); | 2598 | spin_unlock(&ci->i_ceph_lock); |
2597 | 2599 | ||
2600 | if (queue_trunc) { | ||
2601 | ceph_queue_vmtruncate(inode); | ||
2602 | ceph_queue_revalidate(inode); | ||
2603 | } else if (queue_revalidate) | ||
2604 | ceph_queue_revalidate(inode); | ||
2605 | |||
2598 | if (writeback) | 2606 | if (writeback) |
2599 | /* | 2607 | /* |
2600 | * queue inode for writeback: we can't actually call | 2608 | * queue inode for writeback: we can't actually call |
@@ -2606,8 +2614,6 @@ static void handle_cap_grant(struct inode *inode, struct ceph_mds_caps *grant, | |||
2606 | ceph_queue_invalidate(inode); | 2614 | ceph_queue_invalidate(inode); |
2607 | if (deleted_inode) | 2615 | if (deleted_inode) |
2608 | invalidate_aliases(inode); | 2616 | invalidate_aliases(inode); |
2609 | if (queue_revalidate) | ||
2610 | ceph_queue_revalidate(inode); | ||
2611 | if (wake) | 2617 | if (wake) |
2612 | wake_up_all(&ci->i_cap_wq); | 2618 | wake_up_all(&ci->i_cap_wq); |
2613 | 2619 | ||