Whamcloud - gitweb
b=21898 mdd_max_lmm_get unlikely->likely fix
[fs/lustre-release.git] / lustre / mdd / mdd_dir.c
index d11ffea..098b5d4 100644 (file)
@@ -26,7 +26,7 @@
  * 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.
  */
 /*
@@ -633,8 +633,11 @@ static int mdd_changelog_ns_store(const struct lu_env  *env,
         int rc;
         ENTRY;
 
+        /* Not recording */
         if (!(mdd->mdd_cl.mc_flags & CLM_ON))
                 RETURN(0);
+        if ((mdd->mdd_cl.mc_mask & (1 << type)) == 0)
+                RETURN(0);
 
         LASSERT(parent != NULL);
         LASSERT(tname != NULL);
@@ -881,10 +884,14 @@ static int mdd_unlink(const struct lu_env *env, struct md_object *pobj,
         if (rc)
                 GOTO(cleanup, rc);
 
-        la->la_valid = LA_CTIME;
-        rc = mdd_attr_check_set_internal(env, mdd_cobj, la, handle, 0);
-        if (rc)
-                GOTO(cleanup, rc);
+        if (ma->ma_attr.la_nlink > 0 || mdd_cobj->mod_count > 0) {
+                /* update ctime of an unlinked file only if it is still
+                 * opened or a link still exists */
+                la->la_valid = LA_CTIME;
+                rc = mdd_attr_check_set_internal(env, mdd_cobj, la, handle, 0);
+                if (rc)
+                        GOTO(cleanup, rc);
+        }
 
         rc = mdd_finish_unlink(env, mdd_cobj, ma, handle);
 #ifdef HAVE_QUOTA_SUPPORT