From patchwork Thu Jun 9 05:04:53 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepa Dinamani X-Patchwork-Id: 9166225 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 3FA9360467 for ; Thu, 9 Jun 2016 05:07:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3078E26490 for ; Thu, 9 Jun 2016 05:07:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 231F128294; Thu, 9 Jun 2016 05:07:43 +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 2076E26490 for ; Thu, 9 Jun 2016 05:07:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1946030AbcFIFHk (ORCPT ); Thu, 9 Jun 2016 01:07:40 -0400 Received: from mail-pf0-f195.google.com ([209.85.192.195]:35043 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752557AbcFIFFv (ORCPT ); Thu, 9 Jun 2016 01:05:51 -0400 Received: by mail-pf0-f195.google.com with SMTP id t190so2028744pfb.2; Wed, 08 Jun 2016 22:05:50 -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=p0qh3Q/MZvhbpHxzOvYr52d0EKH3Klfgfgc5m3f+o7M=; b=0Gy6HkRJcIa+93o8IfkwoK9hXQbwjLlM6L0nJgqtd+t5NcsiGQ1AZvVzJH2kRlU6NL t0wcKGCbCce8MapgWcorUAxPIESeWl8bJLT+wAu9bI0jEJdWfKN6xC3+0huzGaq4omfE AmUptN0BD3JM60sL7gevMD6orVwc/MlasfhWLfSdO5xJRtcWtDSCC4E/1Nw55I/EZyb3 s1MYSMftQtiHbTmK8872A4aZd6mYfWe1wR4E58xfg+hH8jhKBk3dVx+OVgEULHlcaui4 vVtW8392Jwpxy0rvDxrYAu2UFSSPNHGHTrADZvbpPq2klWzCbwCFdduxLUe0sXtgxTJf 7BCw== 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=p0qh3Q/MZvhbpHxzOvYr52d0EKH3Klfgfgc5m3f+o7M=; b=YPFzqrNhd08jlvzwEk3owQN9T9Lh/VEBlz4MH5dLIr/ihR0LQwWDu+K/lkA5JakFWR X1ncfCdVxWV0HAEfCpirHeRNf2cs/GdDQ1W5vvc0UUsArs4WlW24Itr+1RZOqEwthxoU s4sS1Lt5QskG6xmvJ9xOKGUXRBKrkKOTgIq+X3NF/gNMHRCxcjPih4wipBTdvq0Og95u atsdUFCDOT+P2jaK72sggxjVdn/Ls50j3Zl8r2+vWmcdtXdmyKZRSvnWHYAWseJayy8d 4Yt1M4Ra5Mrf8asegBY95cnDDVaKekgj8OHlAP+GHEnQujBajhQ9omO4CKZraA/WwYSX hKRQ== X-Gm-Message-State: ALyK8tJJM32f2bPlriktGiRSslAPttoaptAeykNyP1x+tyx/qQTQqrp0ze5Pyns3eOL0+w== X-Received: by 10.98.93.93 with SMTP id r90mr2539475pfb.65.1465448750347; Wed, 08 Jun 2016 22:05:50 -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 129sm6220808pfe.3.2016.06.08.22.05.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 08 Jun 2016 22:05:49 -0700 (PDT) From: Deepa Dinamani To: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Arnd Bergmann , Thomas Gleixner , Al Viro , Linus Torvalds , y2038@lists.linaro.org, Steve French , linux-cifs@vger.kernel.org, samba-technical@lists.samba.org Subject: [PATCH 09/21] fs: cifs: Replace CURRENT_TIME by get_seconds Date: Wed, 8 Jun 2016 22:04:53 -0700 Message-Id: <1465448705-25055-10-git-send-email-deepa.kernel@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1465448705-25055-1-git-send-email-deepa.kernel@gmail.com> References: <1465448705-25055-1-git-send-email-deepa.kernel@gmail.com> Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@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_fs_time() instead of CURRENT_TIME. Use get_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 Cc: linux-cifs@vger.kernel.org Cc: samba-technical@lists.samba.org --- 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..aeae6a0 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 = get_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;