Whamcloud - gitweb
LU-2214 lod: fix tricky iterator methods
[fs/lustre-release.git] / lustre / lmv / lmv_intent.c
index 7e35465..d3caecb 100644 (file)
@@ -1,6 +1,4 @@
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
+/*
  * GPL HEADER START
  *
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  * GPL HEADER END
  */
 /*
- * Copyright  2008 Sun Microsystems, Inc. All rights reserved
+ * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
+ *
+ * Copyright (c) 2011, 2012, Whamcloud, Inc.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
  * Lustre is a trademark of Sun Microsystems, Inc.
  */
 
-#ifndef EXPORT_SYMTAB
-# define EXPORT_SYMTAB
-#endif
 #define DEBUG_SUBSYSTEM S_LMV
 #ifdef __KERNEL__
 #include <linux/slab.h>
 #include <asm/div64.h>
 #include <linux/seq_file.h>
 #include <linux/namei.h>
-# ifndef HAVE_VFS_INTENT_PATCHES
-# include <linux/lustre_intent.h>
-# endif
+#include <linux/lustre_intent.h>
 #else
 #include <liblustre.h>
 #endif
 
-#include <lustre/lustre_idl.h>
 #include <obd_support.h>
+#include <lustre/lustre_idl.h>
 #include <lustre_lib.h>
 #include <lustre_net.h>
 #include <lustre_dlm.h>
@@ -529,7 +524,7 @@ int lmv_intent_lock(struct obd_export *exp, struct md_op_data *op_data,
         if (rc)
                 RETURN(rc);
 
-        if (it->it_op & (IT_LOOKUP | IT_GETATTR))
+        if (it->it_op & (IT_LOOKUP | IT_GETATTR | IT_LAYOUT))
                 rc = lmv_intent_lookup(exp, op_data, lmm, lmmsize, it,
                                        flags, reqp, cb_blocking,
                                        extra_lock_flags);
@@ -552,7 +547,7 @@ int lmv_revalidate_slaves(struct obd_export *exp, struct ptlrpc_request **reqp,
         int                     master_lockm = 0;
         struct lustre_handle   *lockh = NULL;
         struct ptlrpc_request  *mreq = *reqp;
-        struct lustre_handle    master_lockh;
+        struct lustre_handle    master_lockh = { 0 };
         struct md_op_data      *op_data;
         struct ldlm_lock       *lock;
         unsigned long           size = 0;
@@ -582,8 +577,10 @@ int lmv_revalidate_slaves(struct obd_export *exp, struct ptlrpc_request **reqp,
          * cached all the time.
          */
         obj = lmv_object_find_lock(obd, mid);
-        if (obj == NULL)
-                RETURN(-EALREADY);
+       if (obj == NULL) {
+               OBD_FREE_PTR(op_data);
+               RETURN(-EALREADY);
+       }
 
         for (i = 0; i < obj->lo_objcount; i++) {
                 fid = obj->lo_stripes[i].ls_fid;
@@ -768,7 +765,7 @@ int lmv_allocate_slaves(struct obd_device *obd, struct lu_fid *pid,
         }
 
         CDEBUG(D_INODE, "Allocate new fid "DFID" for slave "
-               "obj -> mds #"LPU64"\n", PFID(fid), mds);
+               "obj -> mds #%x\n", PFID(fid), mds);
 
         RETURN(rc);
 }