From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752598AbcFTCOT (ORCPT ); Sun, 19 Jun 2016 22:14:19 -0400 Received: from linuxhacker.ru ([217.76.32.60]:56106 "EHLO fiona.linuxhacker.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752077AbcFTCJa (ORCPT ); Sun, 19 Jun 2016 22:09:30 -0400 From: Oleg Drokin To: Greg Kroah-Hartman , devel@driverdev.osuosl.org, Andreas Dilger Cc: Linux Kernel Mailing List , Lustre Development List , Niu Yawei , Oleg Drokin Subject: [PATCH 20/28] staging/lustre/mdc: Zero atime in close RPC Date: Sun, 19 Jun 2016 22:07:35 -0400 Message-Id: <1466388463-1817551-21-git-send-email-green@linuxhacker.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1466388463-1817551-1-git-send-email-green@linuxhacker.ru> References: <1466388463-1817551-1-git-send-email-green@linuxhacker.ru> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Niu Yawei While atime on close is supposed to only increase, there's a bug in some older server versions where atime from a client is taken no matter the value that allows a stale client atime to overwrite a correct value. Update atime in close rpc to 0 to help such servers out. Signed-off-by: Niu Yawei Reviewed-on: http://review.whamcloud.com/19932 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-8041 Reviewed-by: Andreas Dilger Reviewed-by: Jinshan Xiong Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/mdc/mdc_lib.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/staging/lustre/lustre/mdc/mdc_lib.c b/drivers/staging/lustre/lustre/mdc/mdc_lib.c index 2703113..143bd76 100644 --- a/drivers/staging/lustre/lustre/mdc/mdc_lib.c +++ b/drivers/staging/lustre/lustre/mdc/mdc_lib.c @@ -467,6 +467,18 @@ void mdc_close_pack(struct ptlrpc_request *req, struct md_op_data *op_data) rec = req_capsule_client_get(&req->rq_pill, &RMF_REC_REINT); mdc_setattr_pack_rec(rec, op_data); + /* + * The client will zero out local timestamps when losing the IBITS lock + * so any new RPC timestamps will update the client inode's timestamps. + * There was a defect on the server side which allowed the atime to be + * overwritten by a zeroed-out atime packed into the close RPC. + * + * Proactively clear the MDS_ATTR_ATIME flag in the RPC in this case + * to avoid zeroing the atime on old unpatched servers. See LU-8041. + */ + if (rec->sa_atime == 0) + rec->sa_valid &= ~MDS_ATTR_ATIME; + mdc_ioepoch_pack(epoch, op_data); mdc_hsm_release_pack(req, op_data); } -- 2.7.4