From cb8b6863753e71277be8f72bc0d022e6f6a4d8e6 Mon Sep 17 00:00:00 2001 From: vs Date: Thu, 23 Oct 2008 14:19:59 +0000 Subject: [PATCH] b=11063 i=green,vitaly this patch reverses https://bugzilla.lustre.org/attachment.cgi?id=7933 https://bugzilla.lustre.org/attachment.cgi?id=7882 https://bugzilla.lustre.org/attachment.cgi?id=15831 and replaces them with setting mtime to past under extent lock sanity test (39c) is added to check original problem i=adilger,grev --- lustre/osc/osc_request.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/lustre/osc/osc_request.c b/lustre/osc/osc_request.c index f4e475f..e33d1f1 100644 --- a/lustre/osc/osc_request.c +++ b/lustre/osc/osc_request.c @@ -2010,6 +2010,7 @@ static struct ptlrpc_request *osc_build_req(struct client_obd *cli, void *caller_data = NULL; struct osc_async_page *oap; struct ldlm_lock *lock = NULL; + obd_valid valid; int i, rc; ENTRY; @@ -2051,14 +2052,32 @@ static struct ptlrpc_request *osc_build_req(struct client_obd *cli, CERROR("prep_req failed: %d\n", rc); GOTO(out, req = ERR_PTR(rc)); } + oa = &((struct ost_body *)lustre_msg_buf(req->rq_reqmsg, REQ_REC_OFF, + sizeof(struct ost_body)))->oa; /* Need to update the timestamps after the request is built in case * we race with setattr (locally or in queue at OST). If OST gets * later setattr before earlier BRW (as determined by the request xid), * the OST will not use BRW timestamps. Sadly, there is no obvious * way to do this in a single call. bug 10150 */ - ops->ap_update_obdo(caller_data, cmd, oa, - OBD_MD_FLMTIME | OBD_MD_FLCTIME | OBD_MD_FLATIME); + if (pga[0]->flag & OBD_BRW_SRVLOCK) { + /* in case of lockless read/write do not use inode's + * timestamps because concurrent stat might fill the + * inode with out-of-date times, send current + * instead */ + if (cmd & OBD_BRW_WRITE) { + oa->o_mtime = oa->o_ctime = LTIME_S(CURRENT_TIME); + oa->o_valid |= OBD_MD_FLMTIME | OBD_MD_FLCTIME; + valid = OBD_MD_FLATIME; + } else { + oa->o_atime = LTIME_S(CURRENT_TIME); + oa->o_valid |= OBD_MD_FLATIME; + valid = OBD_MD_FLMTIME | OBD_MD_FLCTIME; + } + } else { + valid = OBD_MD_FLMTIME | OBD_MD_FLCTIME | OBD_MD_FLATIME; + } + ops->ap_update_obdo(caller_data, cmd, oa, valid); CLASSERT(sizeof(*aa) <= sizeof(req->rq_async_args)); aa = ptlrpc_req_async_args(req); -- 1.8.3.1