From 8fb5cfb53421f93784a9afed4762ac8180406bf2 Mon Sep 17 00:00:00 2001 From: Mikhail Pershin Date: Fri, 13 Apr 2012 11:02:26 +0400 Subject: [PATCH] LU-911 osd: fix th_sync and OSD_EXEC_OP issues 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 Change-Id: I6ee7eb8a086eae6e0a96364a90a192e6ac95903b Reviewed-on: http://review.whamcloud.com/2530 Reviewed-by: Niu Yawei Reviewed-by: Alex Zhuravlev Tested-by: Hudson Tested-by: Maloo --- lustre/mdd/mdd_object.c | 13 ++----------- lustre/mdt/mdt_recovery.c | 6 +++--- lustre/osd-ldiskfs/osd_internal.h | 8 +++++--- 3 files changed, 10 insertions(+), 17 deletions(-) diff --git a/lustre/mdd/mdd_object.c b/lustre/mdd/mdd_object.c index 277f896..2b7627c 100644 --- a/lustre/mdd/mdd_object.c +++ b/lustre/mdd/mdd_object.c @@ -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); diff --git a/lustre/mdt/mdt_recovery.c b/lustre/mdt/mdt_recovery.c index 18d35d9..0ea9d6b 100644 --- a/lustre/mdt/mdt_recovery.c +++ b/lustre/mdt/mdt_recovery.c @@ -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); } diff --git a/lustre/osd-ldiskfs/osd_internal.h b/lustre/osd-ldiskfs/osd_internal.h index 6af354c..f616ed0 100644 --- a/lustre/osd-ldiskfs/osd_internal.h +++ b/lustre/osd-ldiskfs/osd_internal.h @@ -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) -- 1.8.3.1