From patchwork Fri Feb 12 09:45:46 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deepa Dinamani X-Patchwork-Id: 8289721 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 56331BEEE5 for ; Fri, 12 Feb 2016 09:48:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 692B4203AC for ; Fri, 12 Feb 2016 09:48:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 618B920380 for ; Fri, 12 Feb 2016 09:48:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751781AbcBLJse (ORCPT ); Fri, 12 Feb 2016 04:48:34 -0500 Received: from mail-pf0-f176.google.com ([209.85.192.176]:36048 "EHLO mail-pf0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751514AbcBLJsb (ORCPT ); Fri, 12 Feb 2016 04:48:31 -0500 Received: by mail-pf0-f176.google.com with SMTP id e127so45166239pfe.3; Fri, 12 Feb 2016 01:48:31 -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=7adZansO2OfRqteiGD2ZWjFo2t+KUwA/TK+dRw76hzA=; b=d3RG6livmYyepgEWrhk7KdR0rtTAcrW4xgtjFlIDLMUEela0Iy5BiEL242NJqP/q/b s1FB3PUUiaO5CUBnJCyeN1TO6erOscS1rBPOSda65+qAR7vf/8a2X0b6/PCxfEr8NjSV 22If22qBhJUW1KHBfoQ9kU5vwz0bOgILjRDhyeGZEtDv5R06uLbaDnva6DJPq6T7ujAz m54sHnf+tg9BFrm6YzYzThejKoUqk0rrsQcg05TKIkKoBPj3vvBAIg+7zmfgNynYBXJr ioLrxPkhAjKQ1x304imEh8RaguGl98pZJJr3gHR2uQOR4+Pm8gr1mwRhH39IkHmTpUcd aGIA== 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=7adZansO2OfRqteiGD2ZWjFo2t+KUwA/TK+dRw76hzA=; b=HWnl26C5y2qB4NkBGR/wLbar4x9EO6UNz193jKsJP50aJjIvGauP98fqt8XcYiYTxq 6cIxqQlqIqSf7KsI3dUtVnBAoipgTr9QoUd3SOXhpfXC7O47HUONJ/vKGJttJFXYFCov EeTURIsdDWjzKwcZA9YmBARlJNKnil92eLAGqV7ZSk5BoUmFuZI/UlEAKRZ4Dqm7GA1H YUnkira51gDMqK9Q2SFzo0J3wxHNZR6ZuK3bGl/tbuGWIqRYCdgC7D09q1aP18gUUjzZ cNsbbFlHQ53TZu8b7ZoWT/zYcbstizIkmQWj9sXEHtO2qhM4BDaAJuEV2z09Rp5gHNuU 278A== X-Gm-Message-State: AG10YOQIX9NMBpJXsLhN/D9lVxWxEPDw6finQLdvRU8W/AfpkVESdIjHhGh4s866LOy1sQ== X-Received: by 10.98.0.194 with SMTP id 185mr732216pfa.139.1455270511301; Fri, 12 Feb 2016 01:48:31 -0800 (PST) Received: from localhost.localdomain ([106.51.31.162]) by smtp.gmail.com with ESMTPSA id ah10sm18066745pad.23.2016.02.12.01.48.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 12 Feb 2016 01:48:30 -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 v2b 2/5] fs: cifs: Use vfs_time accessors Date: Fri, 12 Feb 2016 01:45:46 -0800 Message-Id: <1455270349-3187-3-git-send-email-deepa.kernel@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1455270349-3187-1-git-send-email-deepa.kernel@gmail.com> References: <20160212092153.GA2368@deepa-ubuntu> <1455270349-3187-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=unavailable 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 This is preparation to make vfs inode timestamps y2038 safe. 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 access functions to access inode times. Signed-off-by: Deepa Dinamani --- fs/cifs/cache.c | 12 ++++++++---- fs/cifs/inode.c | 31 ++++++++++++++++++------------- 2 files changed, 26 insertions(+), 17 deletions(-) diff --git a/fs/cifs/cache.c b/fs/cifs/cache.c index 6c665bf..18c861f 100644 --- a/fs/cifs/cache.c +++ b/fs/cifs/cache.c @@ -259,8 +259,10 @@ cifs_fscache_inode_get_aux(const void *cookie_netfs_data, void *buffer, memset(&auxdata, 0, sizeof(auxdata)); auxdata.eof = cifsi->server_eof; - auxdata.last_write_time = cifsi->vfs_inode.i_mtime; - auxdata.last_change_time = cifsi->vfs_inode.i_ctime; + auxdata.last_write_time = + vfs_time_to_timespec(cifsi->vfs_inode.i_mtime); + auxdata.last_change_time = + vfs_time_to_timespec(cifsi->vfs_inode.i_ctime); if (maxbuf > sizeof(auxdata)) maxbuf = sizeof(auxdata); @@ -283,8 +285,10 @@ fscache_checkaux cifs_fscache_inode_check_aux(void *cookie_netfs_data, memset(&auxdata, 0, sizeof(auxdata)); auxdata.eof = cifsi->server_eof; - auxdata.last_write_time = cifsi->vfs_inode.i_mtime; - auxdata.last_change_time = cifsi->vfs_inode.i_ctime; + auxdata.last_write_time = + vfs_time_to_timespec(cifsi->vfs_inode.i_mtime); + auxdata.last_change_time = + vfs_time_to_timespec(cifsi->vfs_inode.i_ctime); if (memcmp(data, &auxdata, datalen) != 0) return FSCACHE_CHECKAUX_OBSOLETE; diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index fa72359..423bb0c 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c @@ -92,6 +92,7 @@ static void cifs_revalidate_cache(struct inode *inode, struct cifs_fattr *fattr) { struct cifsInodeInfo *cifs_i = CIFS_I(inode); + struct timespec mtime; cifs_dbg(FYI, "%s: revalidating inode %llu\n", __func__, cifs_i->uniqueid); @@ -109,8 +110,9 @@ cifs_revalidate_cache(struct inode *inode, struct cifs_fattr *fattr) return; } + mtime = vfs_time_to_timespec(inode->i_mtime); /* revalidate if mtime or size have changed */ - if (timespec_equal(&inode->i_mtime, &fattr->cf_mtime) && + if (timespec_equal(&mtime, &fattr->cf_mtime) && cifs_i->server_eof == fattr->cf_eof) { cifs_dbg(FYI, "%s: inode %llu is unchanged\n", __func__, cifs_i->uniqueid); @@ -159,9 +161,9 @@ cifs_fattr_to_inode(struct inode *inode, struct cifs_fattr *fattr) cifs_revalidate_cache(inode, fattr); spin_lock(&inode->i_lock); - inode->i_atime = fattr->cf_atime; - inode->i_mtime = fattr->cf_mtime; - inode->i_ctime = fattr->cf_ctime; + inode->i_atime = timespec_to_vfs_time(fattr->cf_atime); + inode->i_mtime = timespec_to_vfs_time(fattr->cf_mtime); + inode->i_ctime = timespec_to_vfs_time(fattr->cf_ctime); inode->i_rdev = fattr->cf_rdev; cifs_nlink_fattr_to_inode(inode, fattr); inode->i_uid = fattr->cf_uid; @@ -1066,15 +1068,15 @@ cifs_set_file_info(struct inode *inode, struct iattr *attrs, unsigned int xid, if (attrs->ia_valid & ATTR_ATIME) { set_time = true; - info_buf.LastAccessTime = - cpu_to_le64(cifs_UnixTimeToNT(attrs->ia_atime)); + info_buf.LastAccessTime = cpu_to_le64( + cifs_UnixTimeToNT(vfs_time_to_timespec(attrs->ia_atime))); } else info_buf.LastAccessTime = 0; if (attrs->ia_valid & ATTR_MTIME) { set_time = true; - info_buf.LastWriteTime = - cpu_to_le64(cifs_UnixTimeToNT(attrs->ia_mtime)); + info_buf.LastWriteTime = cpu_to_le64( + cifs_UnixTimeToNT(vfs_time_to_timespec(attrs->ia_mtime))); } else info_buf.LastWriteTime = 0; @@ -1086,8 +1088,8 @@ cifs_set_file_info(struct inode *inode, struct iattr *attrs, unsigned int xid, */ if (set_time && (attrs->ia_valid & ATTR_CTIME)) { cifs_dbg(FYI, "CIFS - CTIME changed\n"); - info_buf.ChangeTime = - cpu_to_le64(cifs_UnixTimeToNT(attrs->ia_ctime)); + info_buf.ChangeTime = cpu_to_le64( + cifs_UnixTimeToNT(vfs_time_to_timespec(attrs->ia_ctime))); } else info_buf.ChangeTime = 0; @@ -2193,17 +2195,20 @@ cifs_setattr_unix(struct dentry *direntry, struct iattr *attrs) args->gid = INVALID_GID; /* no change */ if (attrs->ia_valid & ATTR_ATIME) - args->atime = cifs_UnixTimeToNT(attrs->ia_atime); + args->atime = cifs_UnixTimeToNT( + vfs_time_to_timespec(attrs->ia_atime)); else args->atime = NO_CHANGE_64; if (attrs->ia_valid & ATTR_MTIME) - args->mtime = cifs_UnixTimeToNT(attrs->ia_mtime); + args->mtime = cifs_UnixTimeToNT( + vfs_time_to_timespec(attrs->ia_mtime)); else args->mtime = NO_CHANGE_64; if (attrs->ia_valid & ATTR_CTIME) - args->ctime = cifs_UnixTimeToNT(attrs->ia_ctime); + args->ctime = cifs_UnixTimeToNT( + vfs_time_to_timespec(attrs->ia_ctime)); else args->ctime = NO_CHANGE_64;