Whamcloud - gitweb
b=23781 fix another potential obdo leak
authorJohann Lombardi <johann@sun.com>
Mon, 11 Oct 2010 12:12:00 +0000 (14:12 +0200)
committerJohann Lombardi <johann.lombardi@oracle.com>
Mon, 11 Oct 2010 12:12:00 +0000 (14:12 +0200)
i=hongchao

lustre/include/lustre/lustre_idl.h

index 1f13e7b..665ff17 100644 (file)
@@ -2078,13 +2078,19 @@ static inline void lustre_set_wire_obdo(struct obdo *wobdo, struct obdo *lobdo)
 
 static inline void lustre_get_wire_obdo(struct obdo *lobdo, struct obdo *wobdo)
 {
-        obd_flag local_flags = lobdo->o_flags & OBD_FL_LOCAL_MASK;
+        obd_flag local_flags = 0;
+
+        if (lobdo->o_valid & OBD_MD_FLFLAGS)
+                local_flags = lobdo->o_flags & OBD_FL_LOCAL_MASK;
 
         LASSERT(!(wobdo->o_flags & OBD_FL_LOCAL_MASK));
 
         memcpy(lobdo, wobdo, sizeof(*lobdo));
-        lobdo->o_flags &= ~OBD_FL_LOCAL_MASK;
-        lobdo->o_flags |= local_flags;
+        if (local_flags != 0) {
+                lobdo->o_valid |= OBD_MD_FLFLAGS;
+                lobdo->o_flags &= ~OBD_FL_LOCAL_MASK;
+                lobdo->o_flags |= local_flags;
+        }
 }
 
 extern void lustre_swab_obdo (struct obdo *o);