From patchwork Tue Jun 19 16:02:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 139181 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp5384507lji; Tue, 19 Jun 2018 09:02:37 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKFVyHHBHgcVLtddwg7fOnL61X1BSTNiwBwLoCLReiixXO5X5WV+2ahmka4z8NLlFJO6DU4 X-Received: by 2002:a63:3c07:: with SMTP id j7-v6mr15240877pga.440.1529424157501; Tue, 19 Jun 2018 09:02:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529424157; cv=none; d=google.com; s=arc-20160816; b=N/a25+23m3tM7IdRluLZVVQxH8dJi8rQlZgkXcwLAqY+Uw5Yp/I+V+gPi7SL0BVVkI PEEardMUeesCj0WNJJOLatvn/hoGMw11K4oJoS7cOfdJ2QSnMtgSmIM1Wg6El4XT49t7 fhjMznFPFXNsJTBnfZTxNUi3pe7s0H8Vfw3O8ETdMqoIkkGBoFUhIkp8Lf0MB9iaGqZH rhDwijr8GKBWAwT5+90ybnj3ww2+WrZqb0s2HUzXoT2cHtaWUrMLGfIn4JOG+03Mh/4K o3Dt0Us+Sjm13aSxlwcWM1QdGla9Rf//ejj1QfNvURPOxV8rOphUzu60gEwlD2Kh/eaw 1Kyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=I6lEjaheLtYZhsYhJSymWT7bHfh2P77xYxUBE+snoyA=; b=X7JYUMs+rGPdbBavlNgcHct6VcEMBo2A6sJ2Pck6qI2N5D7j+Ho/0GCgQoD4hoqv0n xQkL+T7t44PxvQsR/ItohYX2FsVEDaVAYIvr4/eWZ/rtxkC+TWrGbz5m4NjinUMiYmfP kSwUqVM2HqwINZ226Qlb82fOe0XidE+eQAe4YaF+vyunhRK2XMC3W1frdM3lE07Dx2yv bNcCuMID4VxcXB3agoOUm2YtdG9sc2TV1/S0caoGuNKFVKeHVIfv6oR1k1D835edjyhy XlKwjOm4R2ltwtslOnJFzHht0xdNVsZCKfGvH/8PgeU/kiWT3LY4dReRcNEwj2h+z40p sQaw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a16-v6si23102pfk.350.2018.06.19.09.02.37; Tue, 19 Jun 2018 09:02:37 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966864AbeFSQCf (ORCPT + 30 others); Tue, 19 Jun 2018 12:02:35 -0400 Received: from mout.kundenserver.de ([212.227.126.135]:48737 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966267AbeFSQCd (ORCPT ); Tue, 19 Jun 2018 12:02:33 -0400 Received: from wuerfel.lan ([95.208.111.237]) by mrelayeu.kundenserver.de (mreue005 [212.227.15.129]) with ESMTPA (Nemesis) id 0MUjoe-1fhSBy3r36-00Y8zn; Tue, 19 Jun 2018 18:02:27 +0200 From: Arnd Bergmann To: Al Viro , Andrew Morton Cc: y2038@lists.linaro.org, Arnd Bergmann , Jeff Layton , Jan Kara , Deepa Dinamani , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/3] hfs: stop using timespec based interfaces Date: Tue, 19 Jun 2018 18:02:07 +0200 Message-Id: <20180619160223.4108556-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K1:L9t0W1DT5ojYT4b0E/bYnB21OmagDxPdAxoHiNzQAQe6rlRn8lD lOzuko0IJ1RLmW4p5Zs3X1JZzPcvsvIK/DGmQLKT19Y0ag4Lc9IZBbvnnvrPxzi/xVUE7gT 9y5z3svGqto0Yj2KA529DaWyAWiEeB6eEUpahFJwIiLsYXgKBkNa3Zf+d9w0LZyBTaYONeq ejUpD0cOd8z2pu9hbYTMA== X-UI-Out-Filterresults: notjunk:1; V01:K0:GboANqIifc0=:mfS9Z9MRa2lqf4ywrfyYIh OftX/kdNYHAoDduyF8+CH9gIyb5cb+uvY7C0B43czLf4KPpg5EymBPMgIndIZMFzB2XlySTHr 6MzX1kRZt8xX9VkMaCqhjrpxDfh4mK05w52YDErui7eV4MJXADMe2kLSOUDqxqN2o9Rbjd5lO a2yt2T6D862sxi2Pdpc0EyBv9od4Me7psRGeivTONffhMvsPR+Gm28h7+1wEF2mQHMqPgFmTb S3K3YhJeoGYzSISs6YTAL+SIPFpBZba1kxrX/WDyeBP2nmaC99PHkQguJUSPUzBr8KBYvBiMw eSfHn7gYB/Gi9OWlzxmbPx09PzFL0v3RPxMUg8JcZ/koz8loa/QWCP3lbNTOdwR9qauwW5a6E yy43NwhBxu7u84yyFeVlhgOO3zz35c7X4MrXd8LLt6FcSe8KxwXwQ/wCAcBOaO1KDQG9DR5AQ FBX3OlfS/s/s/lr2ZbUs8wcewBv0FwcKarB5d9g7ObnDjZKE+NrsvAVgjNzGxlxkYaC6SKFc2 ZRdmDGorBJPbymqPrKamNVLfTGGswt36LsOYMcMR+KGx73Y6zQIwDcS2X5pSqNESbXXKaQDe9 Lq3pkbHzHy2Hej/UEVtyT8VmFhUg9OyKiUGKRtJiSZRUalx6JB0D/wZHxyMKQ+r7zonScOceY HcUdQIN6GXRdFL1d2v8dSNTWFIQnqCuTvr5aPzNzREvMTp/Q/OXHwOelN0Hvq3uOnyyI= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(-) -- 2.9.0 Reviewed-by: Ernesto A. Fernández 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 + * 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; From patchwork Tue Jun 19 16:02:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 139182 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp5385291lji; Tue, 19 Jun 2018 09:03:14 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJS5w8TXy9nyMEhiy5Y32XuepAKgufAefTA8zF7ULC9jRd1iA9d24fhxUv6/2V3JArQpebj X-Received: by 2002:a17:902:b604:: with SMTP id b4-v6mr19443062pls.18.1529424193898; Tue, 19 Jun 2018 09:03:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529424193; cv=none; d=google.com; s=arc-20160816; b=gWFy+wHcGAcJahB5Yf0Uvc/kUt364ywjjw2u+pUGOm0dJ/J46l6RChIOlTPHvNtPKf Lm+V+q+ttywWFEMplWqinXCh6LXRP/vmo3kXxBzYjMLiwvgXyaGbOXJZBFC8BEJZxO3J 1OAp0ZhJQ6T6HI5h9gXQfnzt6cC45i5DZzoyblExFIL/MinUG/b6PXI8sVhZXPJQE2xy 2DoAAnhZY8yYUDwMhRvT2ZHRQ8Fq6I7mxVQOvJ3q+rFExHp43sWD7DCpfRhQWCkYuJlC cHa03n4GedpNfMncf2ZDRg5ryX/RuzLMWAmwZQPtxssTW7WpSSGSFG9BxUoo5OEoD0Lf tO8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=ZAbLTD+WaHSynQ3FUcuKvITyxws7vFDjqWPcRR50tTs=; b=lUfThLRQwgyPSmJ+zvTcrrkeVo1UDZsfjELDAXXueawU9oxO4FkTr2TCQFHKDnQ0XZ 7aw1aFOz+BNILkS/z9DRvHQSuB02mHvVEQUi8mannQfzInky8e5/+DNZBrCHvKRZBZ3G jfi0tjJuHz3quneAZH9RfdGGExudQKu+fVbi0Y4mJh2QGYW2I9Bqjpj72Kqjf3J0JD3Y AO9tReeKRwglJMQYC7Exe3nDpYkVj/5V3TOircxoBtnlFia/I8bUD51tVY+Q1q5RndYm PITwQ3/wb2h4/7+1sxR38HtnpORskZxz5fl/SrQUR/w2UkaOFBKErsTZwJfojxGA37+e wF2A== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t9-v6si22803pgc.511.2018.06.19.09.03.13; Tue, 19 Jun 2018 09:03:13 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966924AbeFSQDK (ORCPT + 30 others); Tue, 19 Jun 2018 12:03:10 -0400 Received: from mout.kundenserver.de ([212.227.126.187]:34151 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966267AbeFSQDH (ORCPT ); Tue, 19 Jun 2018 12:03:07 -0400 Received: from wuerfel.lan ([95.208.111.237]) by mrelayeu.kundenserver.de (mreue005 [212.227.15.129]) with ESMTPA (Nemesis) id 0Lgt3C-1g1skI0j02-00oIGr; Tue, 19 Jun 2018 18:02:56 +0200 From: Arnd Bergmann To: Al Viro , Andrew Morton Cc: y2038@lists.linaro.org, Arnd Bergmann , Vyacheslav Dubeyko , "Ernesto A. Fernandez" , Jan Kara , Dave Kleikamp , Jeff Layton , Deepa Dinamani , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/3] hfsplus: stop using timespec based interfaces Date: Tue, 19 Jun 2018 18:02:08 +0200 Message-Id: <20180619160223.4108556-2-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20180619160223.4108556-1-arnd@arndb.de> References: <20180619160223.4108556-1-arnd@arndb.de> X-Provags-ID: V03:K1:DeSI1oNEvn7y5VgzwAyDnZ5vWeRfKiDKSfNY1O/7Npr0FZUmNHk 3aS9mQERqoxDMZ+Al2a0km86nN9jXowtpYUX1KEbsPcI1gCVfrSs13SmpgufYI3U+FSsAF/ tJQmH6WSElOGfWmuju+S8wafu7w5jL2JXdW9j2ArLoUGY6FxOgNo9TvwkQ6MdrpxnzK9DBq 2SQAVObEM8TbReK17W2bA== X-UI-Out-Filterresults: notjunk:1; V01:K0:iZE5c1VzwwE=:eIrg+pxUxvXtiyYl7vl0LI PTHfdg0aaSOf35AzBEnPsLBHvnbDZjFS1GtCnF88Lsw5KyHKFEgKACsOwRLFMlfcx+SySlgq5 VyydHZ1lGhq0KRd6gfZjBlK+FF0BqSNhZWLUi5B5WsMFOsaDLC9XmF4ao2gwWzJz8LFca+2oy hRPqa7rCIPiqrIu4gqipCq4AbD6KCuGgVBpKwIJtQNkr/8k2zZhvPq3ZSbd8Gy6QvlelVw9ie qNeyrGW0WAdizmPehdZz6OSdqIY3ZrsZCykdvD6IOqXU43wF+PSYPrlEgVRoCTpIO/woMP9ml l6d8MM7zniuRHiPG3UzYI9+7+OUF2L+g0NN8TE59ttPd+xo4Ht/K0am2kaDAQoGXyMvgxRFc1 MGAeGpRE41w+ONbZV3oEdt686axlZImsI3InWSYXr5FVrEE7tP2Z2sFua//OhelaC+2KfN5C7 owJa9iMJ3rdtN0Im83ghmxn6+vHrfvRM5Yz9t1XK7EG5ZRgzMfU/OlmQFcOAgtEjvHiC7NTzR uGas3oEzY9QnApUIPz1NvGx2is4+sBH078/fnRC9GIGMe50+5hNbr+I3kU/yRDJo+/saZXJTc nmvs65Rr4XFsmHpZYPxfB9BnW9dr+qpNd+abZ3PEYcqMaP6NIw+8+ON0AJUpTvtBc+O3PB6yK P0InXfo9SATyjbQunV++wU4hO07h1eSWyg5JuPURHJoN9zlq4Ek72gPD5h6w1YUN3sqo= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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/hfsplus/hfsplus_fs.h | 7 ++++--- fs/hfsplus/inode.c | 12 ++++++------ 2 files changed, 10 insertions(+), 9 deletions(-) -- 2.9.0 Reviewed-by: Ernesto A. Fernández diff --git a/fs/hfsplus/hfsplus_fs.h b/fs/hfsplus/hfsplus_fs.h index d9255abafb81..646c207be38d 100644 --- a/fs/hfsplus/hfsplus_fs.h +++ b/fs/hfsplus/hfsplus_fs.h @@ -530,13 +530,14 @@ int hfsplus_submit_bio(struct super_block *sb, sector_t sector, void *buf, void **data, int op, int op_flags); int hfsplus_read_wrapper(struct super_block *sb); -/* time macros */ +/* time macros: convert between 1904-2040 and 1970-2106 range, + * pre-1970 timestamps are interpreted as post-2038 times after wrap-around */ #define __hfsp_mt2ut(t) (be32_to_cpu(t) - 2082844800U) #define __hfsp_ut2mt(t) (cpu_to_be32(t + 2082844800U)) /* compatibility */ -#define hfsp_mt2ut(t) (struct timespec){ .tv_sec = __hfsp_mt2ut(t) } +#define hfsp_mt2ut(t) (struct timespec64){ .tv_sec = __hfsp_mt2ut(t) } #define hfsp_ut2mt(t) __hfsp_ut2mt((t).tv_sec) -#define hfsp_now2mt() __hfsp_ut2mt(get_seconds()) +#define hfsp_now2mt() __hfsp_ut2mt(ktime_get_real_seconds()) #endif diff --git a/fs/hfsplus/inode.c b/fs/hfsplus/inode.c index c824f702feec..c0c8d433864f 100644 --- a/fs/hfsplus/inode.c +++ b/fs/hfsplus/inode.c @@ -493,9 +493,9 @@ int hfsplus_cat_read_inode(struct inode *inode, struct hfs_find_data *fd) hfsplus_get_perms(inode, &folder->permissions, 1); set_nlink(inode, 1); inode->i_size = 2 + be32_to_cpu(folder->valence); - inode->i_atime = timespec_to_timespec64(hfsp_mt2ut(folder->access_date)); - inode->i_mtime = timespec_to_timespec64(hfsp_mt2ut(folder->content_mod_date)); - inode->i_ctime = timespec_to_timespec64(hfsp_mt2ut(folder->attribute_mod_date)); + inode->i_atime = hfsp_mt2ut(folder->access_date); + inode->i_mtime = hfsp_mt2ut(folder->content_mod_date); + inode->i_ctime = hfsp_mt2ut(folder->attribute_mod_date); HFSPLUS_I(inode)->create_date = folder->create_date; HFSPLUS_I(inode)->fs_blocks = 0; if (folder->flags & cpu_to_be16(HFSPLUS_HAS_FOLDER_COUNT)) { @@ -531,9 +531,9 @@ int hfsplus_cat_read_inode(struct inode *inode, struct hfs_find_data *fd) init_special_inode(inode, inode->i_mode, be32_to_cpu(file->permissions.dev)); } - inode->i_atime = timespec_to_timespec64(hfsp_mt2ut(file->access_date)); - inode->i_mtime = timespec_to_timespec64(hfsp_mt2ut(file->content_mod_date)); - inode->i_ctime = timespec_to_timespec64(hfsp_mt2ut(file->attribute_mod_date)); + inode->i_atime = hfsp_mt2ut(file->access_date); + inode->i_mtime = hfsp_mt2ut(file->content_mod_date); + inode->i_ctime = hfsp_mt2ut(file->attribute_mod_date); HFSPLUS_I(inode)->create_date = file->create_date; } else { pr_err("bad catalog entry used to create inode\n"); From patchwork Tue Jun 19 16:02:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 139183 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp5385714lji; Tue, 19 Jun 2018 09:03:37 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJQDgw7bZkr8R0aZfVO1suTbQaLaHqbiyun35dYk2CNMHx6L8km6zAipOvqeSQFNpn4Ob7Y X-Received: by 2002:a63:3dcc:: with SMTP id k195-v6mr15452723pga.254.1529424217121; Tue, 19 Jun 2018 09:03:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529424217; cv=none; d=google.com; s=arc-20160816; b=cg2JGNbVweRI7IwyXM7jNodYT5FiwYjWlBfdhV7j1lqgRSoM6IlD/XeOn9xFZANov5 85YeYIex5oTES5E2jCfMjSGRSkTYJhGZQXHwlp1QmtoG5QrmIyc1iTSXshTn1RJWn0UW Bn69sXcHNJrGbcHEibMBMtqV1FLkYufO1tgT4EZveOm9xC3NoRO/qyyg5Kco+2IejyEo D/BMeMKnQQriKblgc2R0XLUXimh7boCVAk0M1uPbKMXx5wHPLp62QA1df8KHYxlE2S5W xcTNtxWvLZp6CJCcTTAOms07/hSd2wooMq2Kwp2Si7xv/8vwETaI1+tRC6ijZkh4Jl8C ZY1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=TlKScKp/lYqMBxxiYCV8oY8p4gI/LRfMrad1tNaMgGs=; b=rg9G83qgObZx11aaFZK8MTbzDTFCtRi6xH2tz4vqGX7m9O4rEiAgNZb6lHbK5xbJp2 BW8S1CXNqGeh1MSZDUQwNFOSBTPa9jvfaGob1QRfTDZSvDpON98RI3xeFMW+URWFZTS7 KuFpiGYUR0lH0So+RMJpOsIr21TbXNTnhVfNGeN/aXq3nAM1C7TWYLd+bFae2lHRA+lX ZkNGCTZh2Q4/Rx2zLGOrDncStDR/txWQHjrINaQ4VtoJT0w1FS/QJo3twITL+5Tctxn9 AHUzM80odsZ03jmZWrUP3n9FEUva9vks19pfg7xryeGUtRb9hNN9J/OPpHLrVnMfjrQZ fT4g== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b15-v6si26568pfc.320.2018.06.19.09.03.36; Tue, 19 Jun 2018 09:03:37 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966967AbeFSQDd (ORCPT + 30 others); Tue, 19 Jun 2018 12:03:33 -0400 Received: from mout.kundenserver.de ([212.227.126.133]:33533 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966267AbeFSQD2 (ORCPT ); Tue, 19 Jun 2018 12:03:28 -0400 Received: from wuerfel.lan ([95.208.111.237]) by mrelayeu.kundenserver.de (mreue005 [212.227.15.129]) with ESMTPA (Nemesis) id 0MOETY-1fapPp2sgW-005ZXD; Tue, 19 Jun 2018 18:03:21 +0200 From: Arnd Bergmann To: Al Viro , Andrew Morton Cc: y2038@lists.linaro.org, Arnd Bergmann , Vyacheslav Dubeyko , "Ernesto A. Fernandez" , Deepa Dinamani , Jan Kara , Jeff Layton , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/3] hfsplus: return inode birthtime for statx Date: Tue, 19 Jun 2018 18:02:09 +0200 Message-Id: <20180619160223.4108556-3-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20180619160223.4108556-1-arnd@arndb.de> References: <20180619160223.4108556-1-arnd@arndb.de> X-Provags-ID: V03:K1:lXw6D43eZ1lgc1qQLcDqzztwJfREYdLFEFc8N66QqYoWRGMiz9v xXboL2uJtqZ80BdLGnPZKOtq5gExaIJcMy7qI93NFXxSj7KlWG3OwPr8BWG0+D/x9DqjXiG 0r0eWhL/u8an2jrwqMH+VxQTDOJyh8eDc7tOvAA9A//qQksiMN73Y2vrtVYFGecq2eBmOpL OPuLXf35onQKxszKZhaRQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:vkiWz0Z8T68=:E8agSrRpvrALGkM1j2dkLb 70ntZ4azE3NrmT9tyQ3LVN5UlpVT9LLgSGXWLeaflD8iv+N6CshK5vYW5ygJ+r6Mf4MvPcWUd dw5CL0hso8p3N1I8VOYgYnNip3Pc6lOFzJx3Um7I6gyFkwYe4LL3KXu61zW40RU2yW8tdvnDN fnin0sfo3JEkU/TiZ5Fz+ZU6TGHO5RHJ7bxwGaJ/utzGtW0lVufs144/2rpSNXfampZ5VGSYn sOTpwM2k0JEawwHDEXtLO1uzqjMoDGiKOK5lB8K4TW1Z4ZvST091Hs2/3fr/sDubUdDrK0oaF Twzp5KBewcPTkPzoAp2+DhaPYRRAb3/dYfzI+X2RUAuw3MARFcsQDEyGfPar6joytRA1YQIjt 68M8U65rX4bm6rBdFpAaLy4QeZBjcTOZLyQMaAnk2Hu+OIGwRn/j0wxaR1HQ9xy+xSphG86a7 MxyJ8y6iC6qGNi1/S9TBHxXrRLcYtSbbpW2LJ3Q7bTY2pJC8QJSRxAA8fEZpCwGVLXc8bwGhr KyLicegs6o35TIJO4T0eaRCFJQZS/1OPQa/l8v73up7kNOsZ+XwONDFZb0kJ8DY/JVLDAbJ+N 8w2QD16TNmj8zYreH72dEQv+5j4uEX3syO98RQQ/YQCnPV12845iOJk2TJrNXo/W6MK+ymu5q fx1nTHyKqrqR7UOFxjAVxmp/nwDqeY6oWkhYfb/DgvRDZtUk88wJ6IWI1iNNzVZrcMJk= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We have the data in the kernel, so we might just as well provide it to user space. Signed-off-by: Arnd Bergmann --- fs/hfsplus/dir.c | 1 + fs/hfsplus/hfsplus_fs.h | 2 ++ fs/hfsplus/inode.c | 14 ++++++++++++++ 3 files changed, 17 insertions(+) -- 2.9.0 diff --git a/fs/hfsplus/dir.c b/fs/hfsplus/dir.c index b5254378f011..df14b6dd5b5a 100644 --- a/fs/hfsplus/dir.c +++ b/fs/hfsplus/dir.c @@ -566,6 +566,7 @@ const struct inode_operations hfsplus_dir_inode_operations = { .symlink = hfsplus_symlink, .mknod = hfsplus_mknod, .rename = hfsplus_rename, + .getattr = hfsplus_getattr, .listxattr = hfsplus_listxattr, #ifdef CONFIG_HFSPLUS_FS_POSIX_ACL .get_acl = hfsplus_get_posix_acl, diff --git a/fs/hfsplus/hfsplus_fs.h b/fs/hfsplus/hfsplus_fs.h index 646c207be38d..1a6b469f8d22 100644 --- a/fs/hfsplus/hfsplus_fs.h +++ b/fs/hfsplus/hfsplus_fs.h @@ -489,6 +489,8 @@ int hfsplus_cat_read_inode(struct inode *inode, struct hfs_find_data *fd); int hfsplus_cat_write_inode(struct inode *inode); int hfsplus_file_fsync(struct file *file, loff_t start, loff_t end, int datasync); +int hfsplus_getattr(const struct path *path, struct kstat *stat, + u32 request_mask, unsigned int query_flags); /* ioctl.c */ long hfsplus_ioctl(struct file *filp, unsigned int cmd, unsigned long arg); diff --git a/fs/hfsplus/inode.c b/fs/hfsplus/inode.c index c0c8d433864f..f9bb568f9479 100644 --- a/fs/hfsplus/inode.c +++ b/fs/hfsplus/inode.c @@ -276,6 +276,19 @@ static int hfsplus_setattr(struct dentry *dentry, struct iattr *attr) return 0; } +int hfsplus_getattr(const struct path *path, struct kstat *stat, + u32 request_mask, unsigned int query_flags) +{ + struct inode *inode = d_backing_inode(path->dentry); + + generic_fillattr(inode, stat); + + stat->btime = hfsp_mt2ut(HFSPLUS_I(inode)->create_date); + stat->result_mask |= STATX_BTIME; + + return 0; +} + int hfsplus_file_fsync(struct file *file, loff_t start, loff_t end, int datasync) { @@ -335,6 +348,7 @@ int hfsplus_file_fsync(struct file *file, loff_t start, loff_t end, static const struct inode_operations hfsplus_file_inode_operations = { .setattr = hfsplus_setattr, + .getattr = hfsplus_getattr, .listxattr = hfsplus_listxattr, #ifdef CONFIG_HFSPLUS_FS_POSIX_ACL .get_acl = hfsplus_get_posix_acl,