Skip to content

Commit

Permalink
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel…
Browse files Browse the repository at this point in the history
…/git/sage/ceph-client

Pull Ceph fixes from Sage Weil:
 "These are both fixes to the new and improved keepalive2 behavior"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client:
  libceph: advertise support for keepalive2
  libceph: don't access invalid memory in keepalive2 path
  • Loading branch information
Linus Torvalds committed Sep 17, 2015
2 parents 2e5735f + 335c258 commit 8e64a73
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
1 change: 1 addition & 0 deletions include/linux/ceph/ceph_features.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ static inline u64 ceph_sanitize_features(u64 features)
CEPH_FEATURE_OSDMAP_ENC | \
CEPH_FEATURE_CRUSH_TUNABLES3 | \
CEPH_FEATURE_OSD_PRIMARY_AFFINITY | \
CEPH_FEATURE_MSGR_KEEPALIVE2 | \
CEPH_FEATURE_CRUSH_V4)

#define CEPH_FEATURES_REQUIRED_DEFAULT \
Expand Down
4 changes: 3 additions & 1 deletion include/linux/ceph/messenger.h
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,8 @@ struct ceph_connection {
bool out_kvec_is_msg; /* kvec refers to out_msg */
int out_more; /* there is more data after the kvecs */
__le64 out_temp_ack; /* for writing an ack */
struct ceph_timespec out_temp_keepalive2; /* for writing keepalive2
stamp */

/* message in temps */
struct ceph_msg_header in_hdr;
Expand All @@ -248,7 +250,7 @@ struct ceph_connection {
int in_base_pos; /* bytes read */
__le64 in_temp_ack; /* for reading an ack */

struct timespec last_keepalive_ack;
struct timespec last_keepalive_ack; /* keepalive2 ack stamp */

struct delayed_work work; /* send|recv work */
unsigned long delay; /* current delay interval */
Expand Down
9 changes: 5 additions & 4 deletions net/ceph/messenger.c
Original file line number Diff line number Diff line change
Expand Up @@ -1353,11 +1353,12 @@ static void prepare_write_keepalive(struct ceph_connection *con)
dout("prepare_write_keepalive %p\n", con);
con_out_kvec_reset(con);
if (con->peer_features & CEPH_FEATURE_MSGR_KEEPALIVE2) {
struct timespec ts = CURRENT_TIME;
struct ceph_timespec ceph_ts;
ceph_encode_timespec(&ceph_ts, &ts);
struct timespec now = CURRENT_TIME;

con_out_kvec_add(con, sizeof(tag_keepalive2), &tag_keepalive2);
con_out_kvec_add(con, sizeof(ceph_ts), &ceph_ts);
ceph_encode_timespec(&con->out_temp_keepalive2, &now);
con_out_kvec_add(con, sizeof(con->out_temp_keepalive2),
&con->out_temp_keepalive2);
} else {
con_out_kvec_add(con, sizeof(tag_keepalive), &tag_keepalive);
}
Expand Down

0 comments on commit 8e64a73

Please sign in to comment.