Whamcloud - gitweb
LU-1222 ldlm: Fix the race in AST sender vs multiple arriving RPCs
[fs/lustre-release.git] / lustre / osc / osc_cl_internal.h
index d3445e2..c98c01a 100644 (file)
  * GPL HEADER END
  */
 /*
- * Copyright  2008 Sun Microsystems, Inc. All rights reserved
+ * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
+ *
+ * Copyright (c) 2012, Whamcloud, Inc.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -71,10 +73,10 @@ struct osc_io {
         int                oi_lockless;
 
         struct obdo        oi_oa;
-        struct osc_punch_cbargs {
+        struct osc_setattr_cbargs {
                 int               opc_rc;
                 cfs_completion_t  opc_sync;
-        } oi_punch_cbarg;
+        } oi_setattr_cbarg;
 };
 
 /**
@@ -196,6 +198,17 @@ struct osc_lock {
         struct lustre_handle     ols_handle;
         struct ldlm_enqueue_info ols_einfo;
         enum osc_lock_state      ols_state;
+
+        /**
+         * How many pages are using this lock for io, currently only used by
+         * read-ahead. If non-zero, the underlying dlm lock won't be cancelled
+         * during recovery to avoid deadlock. see bz16774.
+         *
+         * \see osc_page::ops_lock
+         * \see osc_page_addref_lock(), osc_page_putref_lock()
+         */
+        cfs_atomic_t             ols_pageref;
+
         /**
          * true, if ldlm_lock_addref() was called against
          * osc_lock::ols_lock. This is used for sanity checking.
@@ -242,7 +255,11 @@ struct osc_lock {
          * granted.
          * Glimpse lock should be destroyed immediately after use.
          */
-                                 ols_glimpse:1;
+                                 ols_glimpse:1,
+        /**
+         * For async glimpse lock.
+         */
+                                 ols_agl:1;
         /**
          * IO that owns this lock. This field is used for a dead-lock
          * avoidance by osc_lock_enqueue_wait().
@@ -301,6 +318,16 @@ struct osc_page {
          * Submit time - the time when the page is starting RPC. For debugging.
          */
         cfs_time_t            ops_submit_time;
+
+        /**
+         * A lock of which we hold a reference covers this page. Only used by
+         * read-ahead: for a readahead page, we hold it's covering lock to
+         * prevent it from being canceled during recovery.
+         *
+         * \see osc_lock::ols_pageref
+         * \see osc_page_addref_lock(), osc_page_putref_lock().
+         */
+        struct cl_lock       *ops_lock;
 };
 
 extern cfs_mem_cache_t *osc_page_kmem;