From patchwork Sat Jun 25 21:37:37 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepa Dinamani X-Patchwork-Id: 9198787 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 5832A6075F for ; Sat, 25 Jun 2016 21:43:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4EC1828527 for ; Sat, 25 Jun 2016 21:43:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 437E82852B; Sat, 25 Jun 2016 21:43:14 +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 B9BB628527 for ; Sat, 25 Jun 2016 21:43:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751690AbcFYVmr (ORCPT ); Sat, 25 Jun 2016 17:42:47 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:36151 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751933AbcFYVih (ORCPT ); Sat, 25 Jun 2016 17:38:37 -0400 Received: by mail-pf0-f194.google.com with SMTP id i123so12288826pfg.3; Sat, 25 Jun 2016 14:38:36 -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=EC1sDPXHqz8YzuM1yNSq52JA/g/qyGqIL/iChSUXAr4BymXJDps0c5wRMHMiz2XJ0D vWP63EvhmRiv1eK+Fj4FNzoMz3FDIGgwK6jAESLXuNINPYvac2ovpJZBTkrB4rkbL91G M02Cz2kizzauJvOTIe9cS144TWkicepgVcwPNlc+FRgqgHIerlnPTZ14jBcvPqD9WUNK VWln6RG/vt0Fmy2ngxEg60w+2yk4s6J/+C1aa3/hvki2OGQITE4y3Ekzcd4LVI/hqzSe ncz6f4pyl/FqWZD1v7gUZFB/xmlip0mnAO1l9f+uCwOo1xg82AZltgglN9yylySU6Emv LrAg== 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=b9P3FgLOpmjA54fCPsxPWI96EF3G/F727wKhzcucZJ7kQrpjo4mW8xZf0ELRw+Aa8X PeYRg0HZjrDIrkO8+YCmx/3BgMsWO2aE4Cx6+n6Ijv4OKwoN9eChovmpe5Or3tnjLT3z gV6YWbh2kha6ayI1Xvnl26pOHQUBSOrXRerd3TFuiBqrnI2ZCL5edbKZTOdzbiEHhAbV cps/TUaxQz9gMvhvi6Ft9W1uS/FAh831KMVdChlvrpgVXES8Hyw6PfMLxA3kADK1WKAM l3YvS1SGArzj+oT7GGTd836l+h+zrBBdWKyi2LNAIitXgZAoF7K4DCAILp6YqtlTFarl 33zg== X-Gm-Message-State: ALyK8tK3BpQ9VZvDIaoorNnz7YBhFrgsZnPwkjDZBNeu/fzQw80o+GJmUFCXHvkaAn+mxQ== X-Received: by 10.98.9.141 with SMTP id 13mr19651098pfj.130.1466890716535; Sat, 25 Jun 2016 14:38:36 -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 m8sm1861308pfi.27.2016.06.25.14.38.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 25 Jun 2016 14:38:36 -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 v3 13/24] fs: cifs: Replace CURRENT_TIME by get_seconds Date: Sat, 25 Jun 2016 14:37:37 -0700 Message-Id: <1466890668-23400-14-git-send-email-deepa.kernel@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1466890668-23400-1-git-send-email-deepa.kernel@gmail.com> References: <1466890668-23400-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;