From 546e39af47ec818c2419c438967861c60f4f2c7b Mon Sep 17 00:00:00 2001 From: pravin Date: Tue, 25 May 2010 19:50:40 +0530 Subject: [PATCH] b=22558 fix mdc_setattr_pack_20() to handle ea == NULL i=sheng.yang i=johann this patch fixes interop setattr function mdc_setattr_pack_20() for command "setfattr -n trusted.lov ." which cause ea == NULL. --- lustre/mdc/mdc_lib.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/lustre/mdc/mdc_lib.c b/lustre/mdc/mdc_lib.c index 68d1206..59ae488 100644 --- a/lustre/mdc/mdc_lib.c +++ b/lustre/mdc/mdc_lib.c @@ -498,6 +498,7 @@ static void mdc_setattr_pack_20(struct ptlrpc_request *req, int offset, { struct mdt_rec_setattr *rec = lustre_msg_buf(req->rq_reqmsg, offset, sizeof(*rec)); + struct lov_user_md *lum = NULL; ENTRY; rec->sa_opcode = REINT_SETATTR; @@ -528,9 +529,15 @@ static void mdc_setattr_pack_20(struct ptlrpc_request *req, int offset, EXIT; return; } - if (ea) - memcpy(lustre_msg_buf(req->rq_reqmsg, offset + 3, ealen), - ea, ealen); + lum = lustre_msg_buf(req->rq_reqmsg, offset + 3, ealen); + if (ea == NULL) { /* Remove LOV EA */ + lum->lmm_magic = LOV_USER_MAGIC_V1; + lum->lmm_stripe_size = 0; + lum->lmm_stripe_count = 0; + lum->lmm_stripe_offset = (typeof(lum->lmm_stripe_offset))(-1); + } else { + memcpy(lum, ea, ealen); + } if (ea2len == 0) { EXIT; -- 1.8.3.1