Whamcloud - gitweb
LU-2515 quota: handle OBD_QC_CALLBACK for interoperability
[fs/lustre-release.git] / lustre / lmv / lmv_intent.c
index 32ccf75..8cac14e 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>
@@ -67,7 +62,7 @@ int lmv_intent_remote(struct obd_export *exp, void *lmm,
                       int lmmsize, struct lookup_intent *it,
                       int flags, struct ptlrpc_request **reqp,
                       ldlm_blocking_callback cb_blocking,
-                      int extra_lock_flags)
+                     __u64 extra_lock_flags)
 {
         struct obd_device      *obd = exp->exp_obd;
         struct lmv_obd         *lmv = &obd->u.lmv;
@@ -163,7 +158,7 @@ int lmv_intent_open(struct obd_export *exp, struct md_op_data *op_data,
                     void *lmm, int lmmsize, struct lookup_intent *it,
                     int flags, struct ptlrpc_request **reqp,
                     ldlm_blocking_callback cb_blocking,
-                    int extra_lock_flags)
+                   __u64 extra_lock_flags)
 {
         struct obd_device     *obd = exp->exp_obd;
         struct lu_fid          rpid = op_data->op_fid1;
@@ -348,7 +343,7 @@ int lmv_intent_lookup(struct obd_export *exp, struct md_op_data *op_data,
                       void *lmm, int lmmsize, struct lookup_intent *it,
                       int flags, struct ptlrpc_request **reqp,
                       ldlm_blocking_callback cb_blocking,
-                      int extra_lock_flags)
+                     __u64 extra_lock_flags)
 {
         struct obd_device      *obd = exp->exp_obd;
         struct lu_fid           rpid = op_data->op_fid1;
@@ -512,7 +507,7 @@ int lmv_intent_lock(struct obd_export *exp, struct md_op_data *op_data,
                     void *lmm, int lmmsize, struct lookup_intent *it,
                     int flags, struct ptlrpc_request **reqp,
                     ldlm_blocking_callback cb_blocking,
-                    int extra_lock_flags)
+                   __u64 extra_lock_flags)
 {
         struct obd_device *obd = exp->exp_obd;
         int                rc;
@@ -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);
@@ -545,7 +540,7 @@ int lmv_intent_lock(struct obd_export *exp, struct md_op_data *op_data,
 int lmv_revalidate_slaves(struct obd_export *exp, struct ptlrpc_request **reqp,
                           const struct lu_fid *mid, struct lookup_intent *oit,
                           int master_valid, ldlm_blocking_callback cb_blocking,
-                          int extra_lock_flags)
+                         __u64 extra_lock_flags)
 {
         struct obd_device      *obd = exp->exp_obd;
         struct lmv_obd         *lmv = &obd->u.lmv;
@@ -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;