From patchwork Sat Aug 13 22:48:26 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepa Dinamani X-Patchwork-Id: 9278735 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 9D27E60780 for ; Sun, 14 Aug 2016 10:35:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8EFD728996 for ; Sun, 14 Aug 2016 10:35:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 839F5289E6; Sun, 14 Aug 2016 10:35:15 +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 2358328996 for ; Sun, 14 Aug 2016 10:35:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752805AbcHNKe4 (ORCPT ); Sun, 14 Aug 2016 06:34:56 -0400 Received: from mail-pa0-f68.google.com ([209.85.220.68]:34181 "EHLO mail-pa0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752319AbcHNKez (ORCPT ); Sun, 14 Aug 2016 06:34:55 -0400 Received: by mail-pa0-f68.google.com with SMTP id hh10so2033102pac.1; Sun, 14 Aug 2016 03:34:54 -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=1Ayc6BIZpVaJ+lL2HtJKvhEKU6YebffUb/p6Sws46u8=; b=iqRYEWgkykwtJqAGTed+2YyfRTSo+Mw0cFH1iA8ehYXvH3iukZZ9Ok8HfXULt5L3qS QaZ4ks7niZeX/Z8zJyIVI6RM5E/BVybr5Lp0Nbfb9Ivyq3jMxOccaJ40U2hgxtv1VESu ahfYZ1uKssaBdVQwDDwEIw9y+z91n59F73pLoUQr4N1BqAB2cPdRhmLsmVR1vzIYSual pSsF8q21YZp7IIM98wx+W5pzZUEMVDag1heY4FJ/YQXtu0N/Xbhs6fJKmxJiVSsPnD3o uwDX2vUK4BoEmg4uSjzztvUStUa1g9p8Ccvi5QcL+0S5D1HhO0UCl4cyDJcxv2vXuihQ gyKg== 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=1Ayc6BIZpVaJ+lL2HtJKvhEKU6YebffUb/p6Sws46u8=; b=T0cDw8fGsjC6iS3iumVLaq/KwVGa8/LiTIMSmlo8PaBJP9CJtK5n9gxYhvVrbtIBBu GchpNZ0WttMkFbMcBtJj4l4Xnkkp5cvuhYYX7TnhI0X5uI74E1/4Djkbj+yZ50cfqNlZ ZP2w8k4/mX+0JZwZDbSRCt+NRVwSX1V2+T3/ggAYVWtPhpBOFw2gTjmICW+67fnoyQax O/BRC4z3n5GUMJiMiMJHe+fnKHBVzKDh9o9RHlgIMNFM1ruy7rG6+c3az8UrnXf8kPsy BdMso6akcOJ4iJKLe8YGRQfhiECKN7c+MARzhZo5QnhBVsswxvAIrDxH5tO7ZmggQgQd 8DNA== X-Gm-Message-State: AEkooutmt9qyifq8UPnc9wCUVJRM3JIgOV2CmE25qqbrwDTo2AFdyLnElggGWlhCF02JKg== X-Received: by 10.66.76.38 with SMTP id h6mr39631869paw.79.1471128572350; Sat, 13 Aug 2016 15:49:32 -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 81sm22528007pfm.90.2016.08.13.15.49.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 13 Aug 2016 15:49:31 -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 v4 14/26] fs: cifs: Replace CURRENT_TIME by get_seconds Date: Sat, 13 Aug 2016 15:48:26 -0700 Message-Id: <1471128518-24075-15-git-send-email-deepa.kernel@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1471128518-24075-1-git-send-email-deepa.kernel@gmail.com> References: <1471128518-24075-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 Reviewed-by: Arnd Bergmann 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;