From patchwork Fri Feb 12 09:35:57 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepa Dinamani X-Patchwork-Id: 8289551 Return-Path: X-Original-To: patchwork-linux-fsdevel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id CE2D2BEEE5 for ; Fri, 12 Feb 2016 09:41:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AE52A203C1 for ; Fri, 12 Feb 2016 09:41:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8227E203B7 for ; Fri, 12 Feb 2016 09:41:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752072AbcBLJlj (ORCPT ); Fri, 12 Feb 2016 04:41:39 -0500 Received: from mail-pa0-f46.google.com ([209.85.220.46]:34932 "EHLO mail-pa0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751440AbcBLJgg (ORCPT ); Fri, 12 Feb 2016 04:36:36 -0500 Received: by mail-pa0-f46.google.com with SMTP id ho8so44426698pac.2; Fri, 12 Feb 2016 01:36:35 -0800 (PST) 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=LIh6vsGLsRtfIH2cjucDdgp/cKe+ayVxrPyA021/Txg=; b=HSc5bmRyYDA2h0JUqdDpg3lBpgq2v7xynUVDmFk/H7A/Fqrz+GVrmdGv3KbfPpdyZ/ USMFEYqqO+I/BMZZQ/++ba8VPn7koqgoST4YzgRLayENwaRpaQPX/HQDxTCVSbHlUoqy VGhprOijmVhqurcjh/KWZr0LFTg8ty+YBu9jruTycz+XHwiZ66m+AsidPfHa31arI4bS iUrb8AUd93nEcPxq3sw1VVnUP7Wd8fElOmcvnNbfbffyXN8HvpHJx+wjhT7jo4Vg2mVq 540Sg+QF7KBVE7ZeHgXS2y5kliXbLZzMvfaTXbegShlJmKCcAYwp/rmfZif5l44J+L3z ZfQw== 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=LIh6vsGLsRtfIH2cjucDdgp/cKe+ayVxrPyA021/Txg=; b=MGEt+UhFZbWbFSWkSLTC0uCizzUyJxH+BTnF0aTJMbnIqpR/gxQPtwZ+gWVza30/h1 Re5DbhoSvsKWa0HN2TtR5ybtEinHt1G474n05kRcrsWudWFDIrOvD+6CpkOKee2ppcv7 CD3da1Z1tsPX6wo6gyprMqbLfGWwmVoIKaLvJ722nZwKPMI54K+r+/ew9r1ythfE0iqI F2pusL2VOkt/51TXu4Nf03DoN3qlofA9eRZ9WlFwmMaYGnYxbNKV4YbQDyiEBpkmlWDr qd3HyQHzmQg3DxUtGooGIMxmssvMS8Jds7t0+QMgcmyflTNOylBCNKjc5uv07OM2Ss/D w54Q== X-Gm-Message-State: AG10YOTXwUI6gR82YbBFN2fUn0jX8l0WofQVcsGU/YQgQLYmoqgS4Tuyim4JjnAilymQgg== X-Received: by 10.66.62.132 with SMTP id y4mr624515par.55.1455269795621; Fri, 12 Feb 2016 01:36:35 -0800 (PST) Received: from localhost.localdomain ([106.51.31.162]) by smtp.gmail.com with ESMTPSA id g25sm17972250pfg.35.2016.02.12.01.36.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 12 Feb 2016 01:36:35 -0800 (PST) From: Deepa Dinamani To: linux-fsdevel@vger.kernel.org, y2038@lists.linaro.org Cc: Arnd Bergmann , Dave Chinner , "Theodore Ts'o" , linux-kernel@vger.kernel.org Subject: [RFC v2a 03/12] fs: cifs: Change cifs_fattr timestamps data type to vfs_time Date: Fri, 12 Feb 2016 01:35:57 -0800 Message-Id: <1455269766-2994-4-git-send-email-deepa.kernel@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1455269766-2994-1-git-send-email-deepa.kernel@gmail.com> References: <20160212092153.GA2368@deepa-ubuntu> <1455269766-2994-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-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The VFS inode timestamps are not y2038 safe as they use struct timespec. These will be changed to use struct timespec64 instead and that is y2038 safe. But, since the above data type conversion will break the end file systems, use vfs_time aliases here to access inode times. This is necessary because we are matching cifs_fattr data type to that of the vfs timestamps. This change is safe because cifs_fattr is accessed in following ways: 1. Assigning to/ from/ compared with struct inode timestamps, which will match vfs_time alias. 2. Assigned from cifs_NTtimeToUnix(). And, this function does not care about the data type sizes of tv_sec and tv_nsec fields. 3. Assigned from current_fs_time(), which will match vfs_time alias. 4. Assigned from cnvrtDosUnixTm(). And, this function does not care about the data type sizes of tv_sec and tv_nsec fields. Signed-off-by: Deepa Dinamani --- fs/cifs/cifsencrypt.c | 2 +- fs/cifs/cifsglob.h | 6 +++--- fs/cifs/cifsproto.h | 6 +++--- fs/cifs/cifssmb.c | 4 ++-- fs/cifs/inode.c | 2 +- fs/cifs/netmisc.c | 10 +++++----- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/fs/cifs/cifsencrypt.c b/fs/cifs/cifsencrypt.c index f86e07d..ee1e674 100644 --- a/fs/cifs/cifsencrypt.c +++ b/fs/cifs/cifsencrypt.c @@ -460,7 +460,7 @@ find_timestamp(struct cifs_ses *ses) unsigned char *blobptr; unsigned char *blobend; struct ntlmssp2_name *attrptr; - struct timespec ts; + struct vfs_time ts; if (!ses->auth_key.len || !ses->auth_key.response) return 0; diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h index a25b251..b08749e 100644 --- a/fs/cifs/cifsglob.h +++ b/fs/cifs/cifsglob.h @@ -1393,9 +1393,9 @@ struct cifs_fattr { dev_t cf_rdev; unsigned int cf_nlink; unsigned int cf_dtype; - struct timespec cf_atime; - struct timespec cf_mtime; - struct timespec cf_ctime; + struct vfs_time cf_atime; + struct vfs_time cf_mtime; + struct vfs_time cf_ctime; }; static inline void free_dfs_info_param(struct dfs_info3_param *param) diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h index eed7ff5..93e9638 100644 --- a/fs/cifs/cifsproto.h +++ b/fs/cifs/cifsproto.h @@ -126,9 +126,9 @@ extern enum securityEnum select_sectype(struct TCP_Server_Info *server, enum securityEnum requested); extern int CIFS_SessSetup(const unsigned int xid, struct cifs_ses *ses, const struct nls_table *nls_cp); -extern struct timespec cifs_NTtimeToUnix(__le64 utc_nanoseconds_since_1601); -extern u64 cifs_UnixTimeToNT(struct timespec); -extern struct timespec cnvrtDosUnixTm(__le16 le_date, __le16 le_time, +extern struct vfs_time cifs_NTtimeToUnix(__le64 utc_nanoseconds_since_1601); +extern u64 cifs_UnixTimeToNT(struct vfs_time); +extern struct vfs_time cnvrtDosUnixTm(__le16 le_date, __le16 le_time, int offset); extern void cifs_set_oplock_level(struct cifsInodeInfo *cinode, __u32 oplock); extern int cifs_get_writer(struct cifsInodeInfo *cinode); diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c index 1a9e43d..b3b3fa4 100644 --- a/fs/cifs/cifssmb.c +++ b/fs/cifs/cifssmb.c @@ -478,7 +478,7 @@ decode_lanman_negprot_rsp(struct TCP_Server_Info *server, NEGOTIATE_RSP *pSMBr) * this requirement. */ int val, seconds, remain, result; - struct timespec ts; + struct vfs_time ts; unsigned long utc = get_seconds(); ts = cnvrtDosUnixTm(rsp->SrvTime.Date, rsp->SrvTime.Time, 0); @@ -4000,7 +4000,7 @@ QInfRetry: if (rc) { cifs_dbg(FYI, "Send error in QueryInfo = %d\n", rc); } else if (data) { - struct timespec ts; + struct vfs_time ts; __u32 time = le32_to_cpu(pSMBr->last_write_time); /* decode response */ diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index fa72359..39068b4 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c @@ -110,7 +110,7 @@ cifs_revalidate_cache(struct inode *inode, struct cifs_fattr *fattr) } /* revalidate if mtime or size have changed */ - if (timespec_equal(&inode->i_mtime, &fattr->cf_mtime) && + if (vfs_time_equal(&inode->i_mtime, &fattr->cf_mtime) && cifs_i->server_eof == fattr->cf_eof) { cifs_dbg(FYI, "%s: inode %llu is unchanged\n", __func__, cifs_i->uniqueid); diff --git a/fs/cifs/netmisc.c b/fs/cifs/netmisc.c index abae6dd..86bc0e5 100644 --- a/fs/cifs/netmisc.c +++ b/fs/cifs/netmisc.c @@ -918,10 +918,10 @@ smbCalcSize(void *buf) * Convert the NT UTC (based 1601-01-01, in hundred nanosecond units) * into Unix UTC (based 1970-01-01, in seconds). */ -struct timespec +struct vfs_time cifs_NTtimeToUnix(__le64 ntutc) { - struct timespec ts; + struct vfs_time ts; /* BB what about the timezone? BB */ /* Subtract the NTFS time offset, then convert to 1s intervals. */ @@ -949,7 +949,7 @@ cifs_NTtimeToUnix(__le64 ntutc) /* Convert the Unix UTC into NT UTC. */ u64 -cifs_UnixTimeToNT(struct timespec t) +cifs_UnixTimeToNT(struct vfs_time t) { /* Convert to 100ns intervals and then add the NTFS time offset. */ return (u64) t.tv_sec * 10000000 + t.tv_nsec/100 + NTFS_TIME_OFFSET; @@ -959,9 +959,9 @@ static const int total_days_of_prev_months[] = { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 }; -struct timespec cnvrtDosUnixTm(__le16 le_date, __le16 le_time, int offset) +struct vfs_time cnvrtDosUnixTm(__le16 le_date, __le16 le_time, int offset) { - struct timespec ts; + struct vfs_time ts; int sec, min, days, month, year; u16 date = le16_to_cpu(le_date); u16 time = le16_to_cpu(le_time);