Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp193409imm; Tue, 31 Jul 2018 16:39:50 -0700 (PDT) X-Google-Smtp-Source: AAOMgpf3l9czvarSA4MUhAsYLS7piQAzDxThNVBbi5n59h2u6wb+EOlkaQYB+7M+I/tyFwabHJsH X-Received: by 2002:a62:d98f:: with SMTP id b15-v6mr24131844pfl.1.1533080390601; Tue, 31 Jul 2018 16:39:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533080390; cv=none; d=google.com; s=arc-20160816; b=Sqq16OvJiyKd4uC5pWZEiHaF3TcySziiLdSW0kGCHhM+nld9EUlnkZDfIy3/xxTF9w u8OCAXIlDaIBKEmshRu/ATjCDYEJfIGNHTDSn+6kX+P53Yq/G7HF/2PR6RjD3XW4lNUM U5qK750cPSKebofrTnwxvPMyyLOkclEpO/60103YvmEzNnpx9p7bV05kuiaWYk5eze2c 60dyrlPUkCt5olYBBKMRaQ/ocC3unLXbDAX+4msNoIb06PSXlqixtc7DjfA/8XwzvThD TXpzALa1O7MB+V2QMSOtqs16Cp7jry2AXiBLzHwATps3C5aME3vfcJ15kyXeXTZjpA5l TMHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=0Mh6CzglfwR9+/6ax2kdCjDaeu56JDjGrKGB4irqV6M=; b=IwIs5Vb/Yl4zVJII97XT2mNQ7Asgt2xRrXJcU281sm0asiTcQ4PSbfMh97jNhqRFQ3 YC6f4Wnhfj23poMluKc27RSrFyTL5uqkrPdjXxkro3oj39oluLpRP9A8Yj+sN4ePG0Xd Av0T0ZnpyThrs+bElaF4JMEfCB+d7b4HdXLYu7BbwmlAI9GxYg1wg8DbhrfInJhdbE7O HuxvmKhF+eHZRoRgzNEj1d20Jal3BqQCxjh9zvigPcCznO6bBaVoOAUqf/deoDqUyM32 te00L+xJYYTnQhmglFWTgGLsVS8xCxNgXrpmj8hCjQNoLh0j6HvtlTC5/OrnlzUqjv7u ljtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=s7c7wakC; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l67-v6si14635531pfl.167.2018.07.31.16.39.24; Tue, 31 Jul 2018 16:39:50 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=s7c7wakC; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732810AbeHABUp (ORCPT + 99 others); Tue, 31 Jul 2018 21:20:45 -0400 Received: from mail-qt0-f196.google.com ([209.85.216.196]:36682 "EHLO mail-qt0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732751AbeHABUp (ORCPT ); Tue, 31 Jul 2018 21:20:45 -0400 Received: by mail-qt0-f196.google.com with SMTP id t5-v6so17976694qtn.3; Tue, 31 Jul 2018 16:38:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=0Mh6CzglfwR9+/6ax2kdCjDaeu56JDjGrKGB4irqV6M=; b=s7c7wakCq7O75IR+xLzyHiMrNoLM3giBKXU0YrwHmHJDf1FjpLVVrZjN2lD/BYY7rm ElklEQY5v64m+5+VM0Fxa0AC+0RAVADnwrj+5PIrhXWao9pkBwpzsdPw0hUHsB1s1ovR 43Wxt/20iHkES613MPPtNhjOJ3RzZv7crR6G71+Xr5+KyKjkqFU7Fa1r6uy+0ZmCrgXj VYF+QHKUeSmV2XfRUPwvLk4zoT95Khieu/i7vcj4alZnaxY27/Ef9J5hp1ot14gSyvF1 ouFiSkxUh6LPrKTMKsO5sjO57Mud0qPirENYqF2JTjFZ7cZyt++m7VLvfEGnYDQeaVtg oO3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=0Mh6CzglfwR9+/6ax2kdCjDaeu56JDjGrKGB4irqV6M=; b=YpCg8owwiLDvc/6uzISCZPj6BQJx5TSWRgmt1TUPvDl0oRwvNfl6oxwm0TtNn0uL9c ceeZLcF+7vgLw6ug+t5r1aY4aELaN/N5Dnzcm5mLL4ev8W70PCC7l9QLRfWx+pvsWkX0 OPbGD5vK7u6GViJ9yKGC+afTlXuTmE9XuDlpyWxFvsA/nSEuByT5Cf1sMidO4uNyXie1 kFIgbyhzaq8jq3dpKUPm+Keyk5vcn8Oc0dt9ozw+LCtCXDOuHoKS97RiQUlzg0AQQAPw T2ofDg/RhCykZh5d8e8ukonolh4cEkIqTBw9IZAjF4UphGLetyCeWc2KUy6J/XzpHM+K obkQ== X-Gm-Message-State: AOUpUlGbenP/Jl16l+K99RwovpRAyqhqiUacbsE0dd8t7nCoooM19+gC bQ42wHq86bxcoNZ2LM5cq6o= X-Received: by 2002:aed:3f5d:: with SMTP id q29-v6mr22181190qtf.403.1533080282979; Tue, 31 Jul 2018 16:38:02 -0700 (PDT) Received: from eaf ([181.47.179.0]) by smtp.gmail.com with ESMTPSA id k3-v6sm12706451qkl.95.2018.07.31.16.38.00 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 31 Jul 2018 16:38:02 -0700 (PDT) Date: Tue, 31 Jul 2018 20:37:57 -0300 From: Ernesto =?utf-8?Q?A=2E_Fern=C3=A1ndez?= To: Arnd Bergmann Cc: Al Viro , Andrew Morton , y2038@lists.linaro.org, Jeff Layton , Jan Kara , Deepa Dinamani , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/3] hfs: stop using timespec based interfaces Message-ID: <20180731233756.24555xk6dvs5hfjb@eaf> References: <20180619160223.4108556-1-arnd@arndb.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20180619160223.4108556-1-arnd@arndb.de> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If you decide to go with this series after all: On Tue, Jun 19, 2018 at 06:02:07PM +0200, Arnd Bergmann wrote: > The native HFS timestamps overflow in year 2040, two years after the Unix > y2038 overflow. However, the way that the conversion between on-disk > timestamps and in-kernel timestamps was implemented, 64-bit machines > actually ended up converting negative UTC timestamps (1902 through 1969) > into times between 2038 and 2106. > > Rather than making all machines faithfully represent timestamps in the > ancient past but break after 2040, this changes the file system to > always use the unsigned UTC interpretation, reading back times between > 1970 and 2106. > > Signed-off-by: Arnd Bergmann > --- > fs/hfs/hfs_fs.h | 6 ++++-- > fs/hfs/inode.c | 4 ++-- > 2 files changed, 6 insertions(+), 4 deletions(-) > > diff --git a/fs/hfs/hfs_fs.h b/fs/hfs/hfs_fs.h > index 6d0783e2e276..ff432931a5b1 100644 > --- a/fs/hfs/hfs_fs.h > +++ b/fs/hfs/hfs_fs.h > @@ -245,6 +245,8 @@ extern void hfs_mark_mdb_dirty(struct super_block *sb); > * Unix: unsigned lil-endian since 00:00 GMT, Jan. 1, 1970 > * mac: unsigned big-endian since 00:00 GMT, Jan. 1, 1904 > * > + * We treat all timestamps before 1970 as times after 2038, so this ^^^^ Same as the hfsplus patch, I find this confusing. I think it should say 2040. Everything else looks good. Reviewed-by: Ernesto A. Fernández > + * actually works until year 2106 > */ > #define __hfs_u_to_mtime(sec) cpu_to_be32(sec + 2082844800U - sys_tz.tz_minuteswest * 60) > #define __hfs_m_to_utime(sec) (be32_to_cpu(sec) - 2082844800U + sys_tz.tz_minuteswest * 60) > @@ -252,9 +254,9 @@ extern void hfs_mark_mdb_dirty(struct super_block *sb); > #define HFS_I(inode) (container_of(inode, struct hfs_inode_info, vfs_inode)) > #define HFS_SB(sb) ((struct hfs_sb_info *)(sb)->s_fs_info) > > -#define hfs_m_to_utime(time) (struct timespec){ .tv_sec = __hfs_m_to_utime(time) } > +#define hfs_m_to_utime(time) (struct timespec64){ .tv_sec = __hfs_m_to_utime(time) } > #define hfs_u_to_mtime(time) __hfs_u_to_mtime((time).tv_sec) > -#define hfs_mtime() __hfs_u_to_mtime(get_seconds()) > +#define hfs_mtime() __hfs_u_to_mtime(ktime_get_real_seconds()) > > static inline const char *hfs_mdb_name(struct super_block *sb) > { > diff --git a/fs/hfs/inode.c b/fs/hfs/inode.c > index 2a16111d312f..b3309b83371a 100644 > --- a/fs/hfs/inode.c > +++ b/fs/hfs/inode.c > @@ -351,7 +351,7 @@ static int hfs_read_inode(struct inode *inode, void *data) > inode->i_mode &= ~hsb->s_file_umask; > inode->i_mode |= S_IFREG; > inode->i_ctime = inode->i_atime = inode->i_mtime = > - timespec_to_timespec64(hfs_m_to_utime(rec->file.MdDat)); > + hfs_m_to_utime(rec->file.MdDat); > inode->i_op = &hfs_file_inode_operations; > inode->i_fop = &hfs_file_operations; > inode->i_mapping->a_ops = &hfs_aops; > @@ -362,7 +362,7 @@ static int hfs_read_inode(struct inode *inode, void *data) > HFS_I(inode)->fs_blocks = 0; > inode->i_mode = S_IFDIR | (S_IRWXUGO & ~hsb->s_dir_umask); > inode->i_ctime = inode->i_atime = inode->i_mtime = > - timespec_to_timespec64(hfs_m_to_utime(rec->dir.MdDat)); > + hfs_m_to_utime(rec->dir.MdDat); > inode->i_op = &hfs_dir_inode_operations; > inode->i_fop = &hfs_dir_operations; > break; > -- > 2.9.0 >