mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-15 01:01:56 -04:00
staging/lustre/ptlrpc: get rid of lustre 1.8 compatible checksums
Old version of lustre (1.8) calculated RPC checksums differently, but the compat code is no longer important since in-kernel version of lustre is nto compatible with 1.8 lustre servers (that are long deprecated too). Signed-off-by: Oleg Drokin <green@linuxhacker.ru> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
1bca2822b4
commit
0237d9dc94
3 changed files with 0 additions and 49 deletions
|
|
@ -2627,12 +2627,7 @@ __u32 lustre_msg_get_timeout(struct lustre_msg *msg);
|
|||
__u32 lustre_msg_get_service_time(struct lustre_msg *msg);
|
||||
char *lustre_msg_get_jobid(struct lustre_msg *msg);
|
||||
__u32 lustre_msg_get_cksum(struct lustre_msg *msg);
|
||||
#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 7, 50, 0)
|
||||
__u32 lustre_msg_calc_cksum(struct lustre_msg *msg, int compat18);
|
||||
#else
|
||||
# warning "remove checksum compatibility support for b1_8"
|
||||
__u32 lustre_msg_calc_cksum(struct lustre_msg *msg);
|
||||
#endif
|
||||
void lustre_msg_set_handle(struct lustre_msg *msg,
|
||||
struct lustre_handle *handle);
|
||||
void lustre_msg_set_type(struct lustre_msg *msg, __u32 type);
|
||||
|
|
|
|||
|
|
@ -1313,43 +1313,17 @@ __u32 lustre_msg_get_cksum(struct lustre_msg *msg)
|
|||
}
|
||||
}
|
||||
|
||||
#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 7, 50, 0)
|
||||
/*
|
||||
* In 1.6 and 1.8 the checksum was computed only on struct ptlrpc_body as
|
||||
* it was in 1.6 (88 bytes, smaller than the full size in 1.8). It makes
|
||||
* more sense to compute the checksum on the full ptlrpc_body, regardless
|
||||
* of what size it is, but in order to keep interoperability with 1.8 we
|
||||
* can optionally also checksum only the first 88 bytes (caller decides). */
|
||||
# define ptlrpc_body_cksum_size_compat18 88
|
||||
|
||||
__u32 lustre_msg_calc_cksum(struct lustre_msg *msg, int compat18)
|
||||
#else
|
||||
# warning "remove checksum compatibility support for b1_8"
|
||||
__u32 lustre_msg_calc_cksum(struct lustre_msg *msg)
|
||||
#endif
|
||||
{
|
||||
switch (msg->lm_magic) {
|
||||
case LUSTRE_MSG_MAGIC_V2: {
|
||||
struct ptlrpc_body *pb = lustre_msg_ptlrpc_body(msg);
|
||||
#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 7, 50, 0)
|
||||
__u32 crc;
|
||||
unsigned int hsize = 4;
|
||||
__u32 len = compat18 ? ptlrpc_body_cksum_size_compat18 :
|
||||
lustre_msg_buflen(msg, MSG_PTLRPC_BODY_OFF);
|
||||
LASSERTF(pb, "invalid msg %p: no ptlrpc body!\n", msg);
|
||||
cfs_crypto_hash_digest(CFS_HASH_ALG_CRC32, (unsigned char *)pb,
|
||||
len, NULL, 0, (unsigned char *)&crc,
|
||||
&hsize);
|
||||
return crc;
|
||||
#else
|
||||
# warning "remove checksum compatibility support for b1_8"
|
||||
__u32 crc;
|
||||
unsigned int hsize = 4;
|
||||
cfs_crypto_hash_digest(CFS_HASH_ALG_CRC32, (unsigned char *)pb,
|
||||
lustre_msg_buflen(msg, MSG_PTLRPC_BODY_OFF),
|
||||
NULL, 0, (unsigned char *)&crc, &hsize);
|
||||
return crc;
|
||||
#endif
|
||||
}
|
||||
default:
|
||||
CERROR("incorrect message magic: %08x\n", msg->lm_magic);
|
||||
|
|
|
|||
|
|
@ -101,16 +101,7 @@ int null_ctx_verify(struct ptlrpc_cli_ctx *ctx, struct ptlrpc_request *req)
|
|||
|
||||
if (req->rq_early) {
|
||||
cksums = lustre_msg_get_cksum(req->rq_repdata);
|
||||
#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 7, 50, 0)
|
||||
if (lustre_msghdr_get_flags(req->rq_reqmsg) &
|
||||
MSGHDR_CKSUM_INCOMPAT18)
|
||||
cksumc = lustre_msg_calc_cksum(req->rq_repmsg, 0);
|
||||
else
|
||||
cksumc = lustre_msg_calc_cksum(req->rq_repmsg, 1);
|
||||
#else
|
||||
# warning "remove checksum compatibility support for b1_8"
|
||||
cksumc = lustre_msg_calc_cksum(req->rq_repmsg);
|
||||
#endif
|
||||
if (cksumc != cksums) {
|
||||
CDEBUG(D_SEC,
|
||||
"early reply checksum mismatch: %08x != %08x\n",
|
||||
|
|
@ -371,16 +362,7 @@ int null_authorize(struct ptlrpc_request *req)
|
|||
} else {
|
||||
__u32 cksum;
|
||||
|
||||
#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 7, 50, 0)
|
||||
if (lustre_msghdr_get_flags(req->rq_reqmsg) &
|
||||
MSGHDR_CKSUM_INCOMPAT18)
|
||||
cksum = lustre_msg_calc_cksum(rs->rs_repbuf, 0);
|
||||
else
|
||||
cksum = lustre_msg_calc_cksum(rs->rs_repbuf, 1);
|
||||
#else
|
||||
# warning "remove checksum compatibility support for b1_8"
|
||||
cksum = lustre_msg_calc_cksum(rs->rs_repbuf);
|
||||
#endif
|
||||
lustre_msg_set_cksum(rs->rs_repbuf, cksum);
|
||||
req->rq_reply_off = 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue