Whamcloud - gitweb
Fix eric's extremely well-spotted locking bug. It's not clear that we even
[fs/lustre-release.git] / lustre / llite / dcache.c
index 3a6d230..631dd9a 100644 (file)
 
 #include <linux/obd_support.h>
 #include <linux/lustre_lite.h>
+#include <linux/lustre_dlm.h>
 
 extern struct address_space_operations ll_aops;
 
 void ll_intent_release(struct dentry *de)
 {
-        struct ldlm_lock *lock;
         struct lustre_handle *handle;
         ENTRY;
 
@@ -29,13 +29,16 @@ void ll_intent_release(struct dentry *de)
                 EXIT;
                 return;
         }
-
         if (de->d_it->it_lock_mode) {
                 handle = (struct lustre_handle *)de->d_it->it_lock_handle;
-                lock = lustre_handle2object(handle);
-                LDLM_DEBUG(lock, "calling ldlm_lock_decref(%d)",
-                           de->d_it->it_lock_mode);
-                ldlm_lock_decref(lock, de->d_it->it_lock_mode);
+                if (de->d_it->it_op == IT_SETATTR) {
+                        int rc;
+                        ldlm_lock_decref(handle, de->d_it->it_lock_mode);
+                        rc = ldlm_cli_cancel(handle);
+                        if (rc < 0)
+                                CERROR("ldlm_cli_cancel: %d\n", rc);
+                } else
+                        ldlm_lock_decref(handle, de->d_it->it_lock_mode);
         }
         de->d_it = NULL;
         EXIT;
@@ -45,6 +48,7 @@ int ll_revalidate2(struct dentry *de, int flags, struct lookup_intent *it)
 {
         ENTRY;
 
+        /* for debugging purposes, we currently always force client re-get */
         RETURN(0);
 }