Whamcloud - gitweb
LU-911 osd: fix th_sync and OSD_EXEC_OP issues
authorMikhail Pershin <tappro@whamcloud.com>
Fri, 13 Apr 2012 07:02:26 +0000 (11:02 +0400)
committerOleg Drokin <green@whamcloud.com>
Mon, 30 Apr 2012 01:56:09 +0000 (21:56 -0400)
This issues occurs during the porting from Orion to the master
- th_sync should accumulate values with '|=' to be not dropped
  occasionally to the async state from sync
- remove duplicated code
- remove ASSERTION in OSD_EXEC_OP as it was previously done but
  returned again from orion by mistake

Signed-off-by: Mikhail Pershin <tappro@whamcloud.com>
Change-Id: I6ee7eb8a086eae6e0a96364a90a192e6ac95903b
Reviewed-on: http://review.whamcloud.com/2530
Reviewed-by: Niu Yawei <niu@whamcloud.com>
Reviewed-by: Alex Zhuravlev <bzzz@whamcloud.com>
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
lustre/mdd/mdd_object.c
lustre/mdt/mdt_recovery.c
lustre/osd-ldiskfs/osd_internal.h

index 277f896..2b7627c 100644 (file)
@@ -1687,17 +1687,13 @@ static int mdd_attr_set(const struct lu_env *env, struct md_object *obj,
         if (rc)
                 GOTO(stop, rc);
 
-        /* permission changes may require sync operation */
-        if (ma->ma_attr.la_valid & (LA_MODE|LA_UID|LA_GID))
-                handle->th_sync = !!mdd->mdd_sync_permission;
-
         rc = mdd_trans_start(env, mdd, handle);
         if (rc)
                 GOTO(stop, rc);
 
         /* permission changes may require sync operation */
         if (ma->ma_attr.la_valid & (LA_MODE|LA_UID|LA_GID))
-                handle->th_sync |= mdd->mdd_sync_permission;
+                handle->th_sync |= !!mdd->mdd_sync_permission;
 
         if (ma->ma_attr.la_valid & (LA_MTIME | LA_CTIME))
                 CDEBUG(D_INODE, "setting mtime "LPU64", ctime "LPU64"\n",
@@ -1880,11 +1876,6 @@ static int mdd_xattr_set(const struct lu_env *env, struct md_object *obj,
         if (IS_ERR(handle))
                 RETURN(PTR_ERR(handle));
 
-        /* security-replated changes may require sync */
-        if (!strcmp(name, XATTR_NAME_ACL_ACCESS) &&
-            mdd->mdd_sync_permission == 1)
-                handle->th_sync = 1;
-
         rc = mdd_declare_xattr_set(env, mdd, mdd_obj, buf, name, handle);
         if (rc)
                 GOTO(stop, rc);
@@ -1895,7 +1886,7 @@ static int mdd_xattr_set(const struct lu_env *env, struct md_object *obj,
 
         /* security-replated changes may require sync */
         if (!strcmp(name, XATTR_NAME_ACL_ACCESS))
-                handle->th_sync |= mdd->mdd_sync_permission;
+                handle->th_sync |= !!mdd->mdd_sync_permission;
 
         rc = mdd_xattr_set_txn(env, mdd_obj, buf, name, fl, handle);
 
index 18d35d9..0ea9d6b 100644 (file)
@@ -908,9 +908,9 @@ static int mdt_txn_stop_cb(const struct lu_env *env,
         req->rq_transno = mti->mti_transno;
         lustre_msg_set_transno(req->rq_repmsg, mti->mti_transno);
         /* if can't add callback, do sync write */
-        txn->th_sync = !!lut_last_commit_cb_add(txn, &mdt->mdt_lut,
-                                                mti->mti_exp,
-                                                mti->mti_transno);
+        txn->th_sync |= !!lut_last_commit_cb_add(txn, &mdt->mdt_lut,
+                                                 mti->mti_exp,
+                                                 mti->mti_transno);
         return mdt_last_rcvd_update(mti, txn);
 }
 
index 6af354c..f616ed0 100644 (file)
@@ -254,11 +254,13 @@ struct osd_device {
 #define OSD_DECLARE_OP(oh, op)   {                               \
         LASSERT(oh->ot_handle == NULL);                          \
         ((oh)->ot_declare_ ##op)++; }
-#define OSD_EXEC_OP(handle, op)     {                            \
+#define OSD_EXEC_OP(handle,op)      {                            \
         struct osd_thandle *oh;                                  \
         oh = container_of0(handle, struct osd_thandle, ot_super);\
-        LASSERT((oh)->ot_declare_ ##op > 0);                     \
-        ((oh)->ot_declare_ ##op)--; }
+        if (((oh)->ot_declare_ ##op) > 0) {                      \
+                ((oh)->ot_declare_ ##op)--;                      \
+        }                                                        \
+        }
 #else
 #define OSD_DECLARE_OP(oh, op)
 #define OSD_EXEC_OP(oh, op)