Whamcloud - gitweb
LU-1222 ldlm: Fix the race in AST sender vs multiple arriving RPCs
[fs/lustre-release.git] / lustre / fld / fld_request.c
index 951f589..b0841c6 100644 (file)
  * GPL HEADER END
  */
 /*
- * Copyright  2008 Sun Microsystems, Inc. All rights reserved
+ * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
+ *
+ * Copyright (c) 2011, Whamcloud, Inc.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -280,8 +282,6 @@ int fld_client_del_target(struct lu_client_fld *fld,
 }
 EXPORT_SYMBOL(fld_client_del_target);
 
-static void fld_client_proc_fini(struct lu_client_fld *fld);
-
 #ifdef LPROCFS
 static int fld_client_proc_init(struct lu_client_fld *fld)
 {
@@ -314,7 +314,7 @@ out_cleanup:
         return rc;
 }
 
-static void fld_client_proc_fini(struct lu_client_fld *fld)
+void fld_client_proc_fini(struct lu_client_fld *fld)
 {
         ENTRY;
         if (fld->lcf_proc_dir) {
@@ -330,12 +330,14 @@ static int fld_client_proc_init(struct lu_client_fld *fld)
         return 0;
 }
 
-static void fld_client_proc_fini(struct lu_client_fld *fld)
+void fld_client_proc_fini(struct lu_client_fld *fld)
 {
         return;
 }
 #endif
 
+EXPORT_SYMBOL(fld_client_proc_fini);
+
 static inline int hash_is_sane(int hash)
 {
         return (hash >= 0 && hash < ARRAY_SIZE(fld_hash));
@@ -398,8 +400,6 @@ void fld_client_fini(struct lu_client_fld *fld)
         struct lu_fld_target *target, *tmp;
         ENTRY;
 
-        fld_client_proc_fini(fld);
-
         cfs_spin_lock(&fld->lcf_lock);
         cfs_list_for_each_entry_safe(target, tmp,
                                      &fld->lcf_targets, ft_chain) {
@@ -467,9 +467,8 @@ out_req:
         return rc;
 }
 
-int fld_client_lookup(struct lu_client_fld *fld,
-                      seqno_t seq, mdsno_t *mds,
-                      const struct lu_env *env)
+int fld_client_lookup(struct lu_client_fld *fld, seqno_t seq, mdsno_t *mds,
+                      __u32 flags, const struct lu_env *env)
 {
         struct lu_seq_range res;
         struct lu_fld_target *target;
@@ -480,7 +479,7 @@ int fld_client_lookup(struct lu_client_fld *fld,
 
         rc = fld_cache_lookup(fld->lcf_cache, seq, &res);
         if (rc == 0) {
-                *mds = res.lsr_mdt;
+                *mds = res.lsr_index;
                 RETURN(0);
         }
 
@@ -493,6 +492,7 @@ int fld_client_lookup(struct lu_client_fld *fld,
                fld_target_name(target), target->ft_idx);
 
         res.lsr_start = seq;
+        res.lsr_flags = flags;
 #ifdef __KERNEL__
         if (target->ft_srv != NULL) {
                 LASSERT(env != NULL);
@@ -507,7 +507,7 @@ int fld_client_lookup(struct lu_client_fld *fld,
 #endif
 
         if (rc == 0) {
-                *mds = res.lsr_mdt;
+                *mds = res.lsr_index;
 
                 fld_cache_insert(fld->lcf_cache, &res);
         }