From 3d7e34e9af6d6327f9b1877314327e64c8f295c0 Mon Sep 17 00:00:00 2001 From: eeb Date: Tue, 31 Jan 2006 15:16:22 +0000 Subject: [PATCH] * Fixed 2.6.x sk_??? isms (required by zerocopy tcp) * Future protocol version compatibility support.... * consolidated PROTO MAGIC decls in lib-types.h * changed qswlnd's protocol to encapsulate the LNET protocol within its own magic+version tagged packets and added a response when incoming packets have new magic/version to tell peer which version I am. 'portals_compatibility' works as described in the documentation to inter-operate with portals. * Changed block_debug_check() to print EVERY error (it's only called by obdecho so it can't be a DOS vector without root). * Fixed a bug in osc_request: when a single oversize BRW was chopped up, the subsequent RPCs used the 'oa' that had been overwritten by the previous ones. This turned off checking in obdecho. The fix I applied was to restore the original 'oa' from a saved copy on all subsequent RPCs. --- lustre/obdclass/debug.c | 8 ++++---- lustre/osc/osc_request.c | 26 +++++++++++++++++++++++--- 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/lustre/obdclass/debug.c b/lustre/obdclass/debug.c index 9b3b8cc..4024823 100644 --- a/lustre/obdclass/debug.c +++ b/lustre/obdclass/debug.c @@ -151,24 +151,24 @@ int block_debug_check(char *who, void *addr, int end, __u64 off, __u64 id) ne_off = le64_to_cpu (off); id = le64_to_cpu (id); if (memcmp(addr, (char *)&ne_off, LPDS)) { - CERROR("%s: id "LPX64" offset "LPU64" off: "LPX64" != " + CDEBUG(D_ERROR, "%s: id "LPX64" offset "LPU64" off: "LPX64" != " LPX64"\n", who, id, off, *(__u64 *)addr, ne_off); err = -EINVAL; } if (memcmp(addr + LPDS, (char *)&id, LPDS)) { - CERROR("%s: id "LPX64" offset "LPU64" id: "LPX64" != "LPX64"\n", + CDEBUG(D_ERROR, "%s: id "LPX64" offset "LPU64" id: "LPX64" != "LPX64"\n", who, id, off, *(__u64 *)(addr + LPDS), id); err = -EINVAL; } addr += end - LPDS - LPDS; if (memcmp(addr, (char *)&ne_off, LPDS)) { - CERROR("%s: id "LPX64" offset "LPU64" end off: "LPX64" != " + CDEBUG(D_ERROR, "%s: id "LPX64" offset "LPU64" end off: "LPX64" != " LPX64"\n", who, id, off, *(__u64 *)addr, ne_off); err = -EINVAL; } if (memcmp(addr + LPDS, (char *)&id, LPDS)) { - CERROR("%s: id "LPX64" offset "LPU64" end id: "LPX64" != " + CDEBUG(D_ERROR, "%s: id "LPX64" offset "LPU64" end id: "LPX64" != " LPX64"\n", who, id, off, *(__u64 *)(addr + LPDS), id); err = -EINVAL; } diff --git a/lustre/osc/osc_request.c b/lustre/osc/osc_request.c index 43751fb..d08b633 100644 --- a/lustre/osc/osc_request.c +++ b/lustre/osc/osc_request.c @@ -1169,6 +1169,8 @@ static int osc_brw(int cmd, struct obd_export *exp, struct obdo *oa, struct lov_stripe_md *md, obd_count page_count, struct brw_page *pga, struct obd_trans_info *oti) { + struct obdo *saved_oa = NULL; + int rc; ENTRY; if (cmd & OBD_BRW_CHECK) { @@ -1181,9 +1183,10 @@ static int osc_brw(int cmd, struct obd_export *exp, struct obdo *oa, RETURN(0); } + rc = 0; + while (page_count) { obd_count pages_per_brw; - int rc; if (page_count > PTLRPC_MAX_BRW_PAGES) pages_per_brw = PTLRPC_MAX_BRW_PAGES; @@ -1193,15 +1196,32 @@ static int osc_brw(int cmd, struct obd_export *exp, struct obdo *oa, sort_brw_pages(pga, pages_per_brw); pages_per_brw = max_unfragmented_pages(pga, pages_per_brw); + if (saved_oa != NULL) { + /* restore previously saved oa */ + *oa = *saved_oa; + } else if (page_count > pages_per_brw) { + /* save a copy of oa (brw will clobber it) */ + OBD_ALLOC(saved_oa, sizeof(*saved_oa)); + if (saved_oa == NULL) { + CERROR("Can't save oa (ENOMEM)\n"); + RETURN(-ENOMEM); + } + *saved_oa = *oa; + } + rc = osc_brw_internal(cmd, exp, oa, md, pages_per_brw, pga); if (rc != 0) - RETURN(rc); + break; page_count -= pages_per_brw; pga += pages_per_brw; } - RETURN(0); + + if (saved_oa != NULL) + OBD_FREE(saved_oa, sizeof(*saved_oa)); + + RETURN(rc); } static int osc_brw_async(int cmd, struct obd_export *exp, struct obdo *oa, -- 1.8.3.1