From 061f6421fcc9a41d53a3f66fff3848cb09b862ad Mon Sep 17 00:00:00 2001 From: Prakash Surya Date: Thu, 27 Sep 2012 15:37:10 -0700 Subject: [PATCH] LU-2078 ofd: drop locking in ofd_sync Improve concurrency by dropping the write lock around dt_object_sync(). This is safe because all consistency related to a single object is supposed to be maintained by the osd internally. In this case: 1) osd_object_sync() doesn't rely on the object at all: global sync is called 2) even if object is being destroyed at the same time - we're holding a reference, so we're safe 3) dt_version_get() -> osd_xattr_get() has own internal locking, protecting xattr consistency to improve concurrency Signed-off-by: Alex Zhuravlev Signed-off-by: Brian Behlendorf Signed-off-by: Prakash Surya Change-Id: I60c5b6a1d10afc717a24e7471071f1e2fdb89c29 Reviewed-on: http://review.whamcloud.com/4117 Tested-by: Hudson Reviewed-by: Andreas Dilger Tested-by: Maloo --- lustre/ofd/ofd_obd.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lustre/ofd/ofd_obd.c b/lustre/ofd/ofd_obd.c index 1f8e917..556eb4b 100644 --- a/lustre/ofd/ofd_obd.c +++ b/lustre/ofd/ofd_obd.c @@ -1307,15 +1307,14 @@ static int ofd_sync(const struct lu_env *env, struct obd_export *exp, GOTO(out, rc = PTR_ERR(fo)); } - ofd_write_lock(env, fo); if (!ofd_object_exists(fo)) - GOTO(unlock, rc = -ENOENT); + GOTO(put, rc = -ENOENT); if (dt_version_get(env, ofd_object_child(fo)) > ofd_obd(ofd)->obd_last_committed) { rc = dt_object_sync(env, ofd_object_child(fo)); if (rc) - GOTO(unlock, rc); + GOTO(put, rc); } oinfo->oi_oa->o_valid = OBD_MD_FLID; @@ -1324,8 +1323,7 @@ static int ofd_sync(const struct lu_env *env, struct obd_export *exp, ofd_counter_incr(exp, LPROC_OFD_STATS_SYNC, oinfo->oi_jobid, 1); EXIT; -unlock: - ofd_write_unlock(env, fo); +put: ofd_object_put(env, fo); out: return rc; -- 1.8.3.1