From patchwork Mon Jun 20 00:27:11 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepa Dinamani X-Patchwork-Id: 9186411 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 08D446075E for ; Mon, 20 Jun 2016 01:36:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DEF2920748 for ; Mon, 20 Jun 2016 01:36:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D12E422230; Mon, 20 Jun 2016 01:36:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 486E320748 for ; Mon, 20 Jun 2016 01:36:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752142AbcFTBgq (ORCPT ); Sun, 19 Jun 2016 21:36:46 -0400 Received: from mail-pa0-f66.google.com ([209.85.220.66]:34997 "EHLO mail-pa0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752116AbcFTBgp (ORCPT ); Sun, 19 Jun 2016 21:36:45 -0400 Received: by mail-pa0-f66.google.com with SMTP id hf6so9751071pac.2; Sun, 19 Jun 2016 18:36:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=913mxbci2Oll2BGcnfoLfwtCZ3Gdl+tdMkoPBlsNqQY=; b=tzCGhFCcNpi4Ng6BFZyEEi8t1TCtjINt5YTdzpSivBbEs1s2OxKaOzpr3/qLAISxFX lhsFbwoCEO4Fkadzly7j0pyv4xDipkb8AOnQdDPN9HWoDOZdsSA0162Gr8zPwVYZWIbE CjVCJLKuhgqgXxuQ1ISQuK2CVoS0Nq5W64yRfc+LlERbV+cxmYrgcSl9yeTHUq6L7WPG Hi5siBj+Z5lBVQiQYmroEj5lr5EW10U73NMqZPWTwxs4OUphSQkFqIcrE1kYsFfIwLpP DqXoG49D/2wxYbbo/WVfaZyKELekX0eyupnTkRGRjlVO/gXUxaqQY0kBVCUpkoTkR+mA 8n4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=913mxbci2Oll2BGcnfoLfwtCZ3Gdl+tdMkoPBlsNqQY=; b=g4DWBN3EixE9ExXwAvDRvlLkJknqd9RaOQ/Mpk3hr2rZFefjU7s42+Wif9kV3YF0ci C+k+tS3Y16xScVhQeleZIX+J+bLWix2zWt24wkNe2RzyyJbrG72m76VjLLtVqnGZ3LXd DlTFZjzoVqXhMOWoTNeR0gFHIO5qVEw6o/ayii3VwUcUks33kb7EgLvalIzdPuBcdKP/ kH20z73mPC1aS86lQmcgUya1aSnnsAJbDsCL8huMr1Zzgb9Unwdo7S11GXxi1nUDPA7q mLDW5IbYE8wFKTeD2dbVKxmjesqXFlXeavbkkdHzu9gfG2b3bZyp1puZZ4X6CmONDzg3 GWGw== X-Gm-Message-State: ALyK8tL31kSxVaemtJP79wD8qy39YACxeXoanE+HwsvKCgdBqoWbootZzcGJvvwaBYCfVw== X-Received: by 10.67.16.108 with SMTP id fv12mr18670283pad.8.1466382504452; Sun, 19 Jun 2016 17:28:24 -0700 (PDT) Received: from deepa-ubuntu.hsd1.ca.comcast.net (c-73-252-251-201.hsd1.ca.comcast.net. [73.252.251.201]) by smtp.gmail.com with ESMTPSA id s12sm34984980pfj.57.2016.06.19.17.28.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 19 Jun 2016 17:28:23 -0700 (PDT) From: Deepa Dinamani To: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Cc: arnd@arndb.de, tglx@linutronix.de, torvalds@linux-foundation.org, tytso@mit.edu, viro@zeniv.linux.org.uk, y2038@lists.linaro.org, Steve French Subject: [PATCH v2 12/24] fs: cifs: Replace CURRENT_TIME by get_seconds Date: Sun, 19 Jun 2016 17:27:11 -0700 Message-Id: <1466382443-11063-13-git-send-email-deepa.kernel@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1466382443-11063-1-git-send-email-deepa.kernel@gmail.com> References: <1466382443-11063-1-git-send-email-deepa.kernel@gmail.com> Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This is in preparation for the change that transitions filesystem timestamps to use 64 bit time and hence make them y2038 safe. CURRENT_TIME macro will be deleted before merging the aforementioned patch. Filesystems will use current_time() instead of CURRENT_TIME. Use ktime_get_real_seconds() here as this is not filesystem time. Only the seconds portion of the timestamp is necessary for timezone calculation using server time. Assume that the difference between server and client times lie in the range INT_MIN..INT_MAX. This is valid because this is the difference between current times between server and client, and the largest timezone difference is in the range of one day. All cifs timestamps currently use timespec internally. This timestamp can also be transitioned into using timespec64 when all other timestamps for cifs is transitioned to use timespec64. Signed-off-by: Deepa Dinamani Cc: Steve French --- fs/cifs/cifssmb.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c index d47197e..6c666a3 100644 --- a/fs/cifs/cifssmb.c +++ b/fs/cifs/cifssmb.c @@ -478,14 +478,14 @@ decode_lanman_negprot_rsp(struct TCP_Server_Info *server, NEGOTIATE_RSP *pSMBr) * this requirement. */ int val, seconds, remain, result; - struct timespec ts, utc; - utc = CURRENT_TIME; + struct timespec ts; + unsigned long utc = ktime_get_real_seconds(); ts = cnvrtDosUnixTm(rsp->SrvTime.Date, rsp->SrvTime.Time, 0); cifs_dbg(FYI, "SrvTime %d sec since 1970 (utc: %d) diff: %d\n", - (int)ts.tv_sec, (int)utc.tv_sec, - (int)(utc.tv_sec - ts.tv_sec)); - val = (int)(utc.tv_sec - ts.tv_sec); + (int)ts.tv_sec, (int)utc, + (int)(utc - ts.tv_sec)); + val = (int)(utc - ts.tv_sec); seconds = abs(val); result = (seconds / MIN_TZ_ADJ) * MIN_TZ_ADJ; remain = seconds % MIN_TZ_ADJ;