Whamcloud - gitweb
b=22558 fix mdc_setattr_pack_20() to handle ea == NULL
authorpravin <Pravin.Shelar@Sun.COM>
Tue, 25 May 2010 14:20:40 +0000 (19:50 +0530)
committerJohann Lombardi <johann@sun.com>
Tue, 25 May 2010 16:09:59 +0000 (18:09 +0200)
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

index 68d1206..59ae488 100644 (file)
@@ -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;