Whamcloud - gitweb
LU-9727 lustre: record CLOSE if OPEN was recorded 29/27929/21
authorSebastien Buisson <sbuisson@ddn.com>
Tue, 4 Jul 2017 15:21:44 +0000 (00:21 +0900)
committerOleg Drokin <oleg.drokin@intel.com>
Tue, 6 Feb 2018 04:26:41 +0000 (04:26 +0000)
Record CL_CLOSE events in changelogs only if file was opened in
write mode, or if CL_OPEN was recorded.
Changelogs mask may change between open and close operations,
but this is not a big deal if we have a CL_CLOSE entry with no
matching CL_OPEN. Plus Changelogs mask may not change often.

Signed-off-by: Sebastien Buisson <sbuisson@ddn.com>
Change-Id: I5984a4b07b84d84c3860b9b21abc3b19b7fd9b1a
Reviewed-on: https://review.whamcloud.com/27929
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Matthew S <matthew.sanderson@anu.edu.au>
Reviewed-by: Li Xi <lixi@ddn.com>
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
lustre/mdd/mdd_object.c

index fc31d01..2bc73a4 100644 (file)
@@ -2520,8 +2520,15 @@ cont:
 out:
        mdd_write_unlock(env, mdd_obj);
 
+       /* Record CL_CLOSE in changelog only if file was opened in write mode,
+        * or if CL_OPEN was recorded.
+        * Changelogs mask may change between open and close operations, but
+        * this is not a big deal if we have a CL_CLOSE entry with no matching
+        * CL_OPEN. Plus Changelogs mask may not change often.
+        */
        if (!rc && !blocked &&
-           (mode & (FMODE_WRITE | MDS_OPEN_APPEND | MDS_OPEN_TRUNC)) &&
+           ((mode & (FMODE_WRITE | MDS_OPEN_APPEND | MDS_OPEN_TRUNC)) ||
+            (mdd->mdd_cl.mc_mask & (1 << CL_OPEN))) &&
            !(ma->ma_valid & MA_FLAGS && ma->ma_attr_flags & MDS_RECOV_OPEN)) {
                if (handle == NULL) {
                        handle = mdd_trans_create(env, mdo2mdd(obj));