From: hongchao.zhang Date: Fri, 10 Dec 2010 12:40:25 +0000 (+0800) Subject: b=23781 fix obdo leak issue X-Git-Tag: 2.0.59.0~35 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=fed70eb27175218596dd9e21c8d68fbb0313f8b9;p=fs%2Flustre-release.git b=23781 fix obdo leak issue in ll_set_attr_raw, if ll_extent_lock call fails, the newly allocated obdo has not been freed before return i=johann i=johann i=dmitry.zoguine --- diff --git a/lustre/include/lustre/lustre_idl.h b/lustre/include/lustre/lustre_idl.h index d832c4b..afdfb25 100644 --- a/lustre/include/lustre/lustre_idl.h +++ b/lustre/include/lustre/lustre_idl.h @@ -2661,13 +2661,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);