diff options
author | Yan, Zheng <zyan@redhat.com> | 2016-02-14 05:06:41 -0500 |
---|---|---|
committer | Ilya Dryomov <idryomov@gmail.com> | 2016-03-04 15:00:37 -0500 |
commit | 5ea5c5e0a7f70b256417d3b6e36bd9851504babd (patch) | |
tree | c71678dee6860e0bce59c737a3ea52f7e310e09f /fs/ceph/caps.c | |
parent | fc77dbd34c5c99bce46d40a2491937c3bcbd10af (diff) |
ceph: initial CEPH_FEATURE_FS_FILE_LAYOUT_V2 support
Add support for the format change of MClientReply/MclientCaps.
Also add code that denies access to inodes with pool_ns layouts.
Signed-off-by: Yan, Zheng <zyan@redhat.com>
Reviewed-by: Sage Weil <sage@redhat.com>
Diffstat (limited to 'fs/ceph/caps.c')
-rw-r--r-- | fs/ceph/caps.c | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c index cdbf8cf3d52c..6fe0ad26a7df 100644 --- a/fs/ceph/caps.c +++ b/fs/ceph/caps.c | |||
@@ -2753,7 +2753,8 @@ static void handle_cap_grant(struct ceph_mds_client *mdsc, | |||
2753 | void *inline_data, int inline_len, | 2753 | void *inline_data, int inline_len, |
2754 | struct ceph_buffer *xattr_buf, | 2754 | struct ceph_buffer *xattr_buf, |
2755 | struct ceph_mds_session *session, | 2755 | struct ceph_mds_session *session, |
2756 | struct ceph_cap *cap, int issued) | 2756 | struct ceph_cap *cap, int issued, |
2757 | u32 pool_ns_len) | ||
2757 | __releases(ci->i_ceph_lock) | 2758 | __releases(ci->i_ceph_lock) |
2758 | __releases(mdsc->snap_rwsem) | 2759 | __releases(mdsc->snap_rwsem) |
2759 | { | 2760 | { |
@@ -2873,6 +2874,8 @@ static void handle_cap_grant(struct ceph_mds_client *mdsc, | |||
2873 | if (newcaps & (CEPH_CAP_ANY_FILE_RD | CEPH_CAP_ANY_FILE_WR)) { | 2874 | if (newcaps & (CEPH_CAP_ANY_FILE_RD | CEPH_CAP_ANY_FILE_WR)) { |
2874 | /* file layout may have changed */ | 2875 | /* file layout may have changed */ |
2875 | ci->i_layout = grant->layout; | 2876 | ci->i_layout = grant->layout; |
2877 | ci->i_pool_ns_len = pool_ns_len; | ||
2878 | |||
2876 | /* size/truncate_seq? */ | 2879 | /* size/truncate_seq? */ |
2877 | queue_trunc = ceph_fill_file_size(inode, issued, | 2880 | queue_trunc = ceph_fill_file_size(inode, issued, |
2878 | le32_to_cpu(grant->truncate_seq), | 2881 | le32_to_cpu(grant->truncate_seq), |
@@ -3411,6 +3414,7 @@ void ceph_handle_caps(struct ceph_mds_session *session, | |||
3411 | u32 inline_len = 0; | 3414 | u32 inline_len = 0; |
3412 | void *snaptrace; | 3415 | void *snaptrace; |
3413 | size_t snaptrace_len; | 3416 | size_t snaptrace_len; |
3417 | u32 pool_ns_len = 0; | ||
3414 | void *p, *end; | 3418 | void *p, *end; |
3415 | 3419 | ||
3416 | dout("handle_caps from mds%d\n", mds); | 3420 | dout("handle_caps from mds%d\n", mds); |
@@ -3463,6 +3467,21 @@ void ceph_handle_caps(struct ceph_mds_session *session, | |||
3463 | p += inline_len; | 3467 | p += inline_len; |
3464 | } | 3468 | } |
3465 | 3469 | ||
3470 | if (le16_to_cpu(msg->hdr.version) >= 8) { | ||
3471 | u64 flush_tid; | ||
3472 | u32 caller_uid, caller_gid; | ||
3473 | u32 osd_epoch_barrier; | ||
3474 | /* version >= 5 */ | ||
3475 | ceph_decode_32_safe(&p, end, osd_epoch_barrier, bad); | ||
3476 | /* version >= 6 */ | ||
3477 | ceph_decode_64_safe(&p, end, flush_tid, bad); | ||
3478 | /* version >= 7 */ | ||
3479 | ceph_decode_32_safe(&p, end, caller_uid, bad); | ||
3480 | ceph_decode_32_safe(&p, end, caller_gid, bad); | ||
3481 | /* version >= 8 */ | ||
3482 | ceph_decode_32_safe(&p, end, pool_ns_len, bad); | ||
3483 | } | ||
3484 | |||
3466 | /* lookup ino */ | 3485 | /* lookup ino */ |
3467 | inode = ceph_find_inode(sb, vino); | 3486 | inode = ceph_find_inode(sb, vino); |
3468 | ci = ceph_inode(inode); | 3487 | ci = ceph_inode(inode); |
@@ -3518,7 +3537,8 @@ void ceph_handle_caps(struct ceph_mds_session *session, | |||
3518 | &cap, &issued); | 3537 | &cap, &issued); |
3519 | handle_cap_grant(mdsc, inode, h, | 3538 | handle_cap_grant(mdsc, inode, h, |
3520 | inline_version, inline_data, inline_len, | 3539 | inline_version, inline_data, inline_len, |
3521 | msg->middle, session, cap, issued); | 3540 | msg->middle, session, cap, issued, |
3541 | pool_ns_len); | ||
3522 | if (realm) | 3542 | if (realm) |
3523 | ceph_put_snap_realm(mdsc, realm); | 3543 | ceph_put_snap_realm(mdsc, realm); |
3524 | goto done_unlocked; | 3544 | goto done_unlocked; |
@@ -3542,7 +3562,8 @@ void ceph_handle_caps(struct ceph_mds_session *session, | |||
3542 | issued |= __ceph_caps_dirty(ci); | 3562 | issued |= __ceph_caps_dirty(ci); |
3543 | handle_cap_grant(mdsc, inode, h, | 3563 | handle_cap_grant(mdsc, inode, h, |
3544 | inline_version, inline_data, inline_len, | 3564 | inline_version, inline_data, inline_len, |
3545 | msg->middle, session, cap, issued); | 3565 | msg->middle, session, cap, issued, |
3566 | pool_ns_len); | ||
3546 | goto done_unlocked; | 3567 | goto done_unlocked; |
3547 | 3568 | ||
3548 | case CEPH_CAP_OP_FLUSH_ACK: | 3569 | case CEPH_CAP_OP_FLUSH_ACK: |