summaryrefslogtreecommitdiffstats
path: root/fs/ceph
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-06-14 18:31:07 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2018-06-14 18:31:07 -0400
commit7a932516f55cdf430c7cce78df2010ff7db6b874 (patch)
treeb116c2551348c798240b26bd831f0cf96dd8d591 /fs/ceph
parentdc594c39f7a9dcdfd5dbb1a446ac6d06182e2472 (diff)
parente264abeaf9daa3cde9aed8013a6f82b0370425e5 (diff)
Merge tag 'vfs-timespec64' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/playground
Pull inode timestamps conversion to timespec64 from Arnd Bergmann: "This is a late set of changes from Deepa Dinamani doing an automated treewide conversion of the inode and iattr structures from 'timespec' to 'timespec64', to push the conversion from the VFS layer into the individual file systems. As Deepa writes: 'The series aims to switch vfs timestamps to use struct timespec64. Currently vfs uses struct timespec, which is not y2038 safe. The series involves the following: 1. Add vfs helper functions for supporting struct timepec64 timestamps. 2. Cast prints of vfs timestamps to avoid warnings after the switch. 3. Simplify code using vfs timestamps so that the actual replacement becomes easy. 4. Convert vfs timestamps to use struct timespec64 using a script. This is a flag day patch. Next steps: 1. Convert APIs that can handle timespec64, instead of converting timestamps at the boundaries. 2. Update internal data structures to avoid timestamp conversions' Thomas Gleixner adds: 'I think there is no point to drag that out for the next merge window. The whole thing needs to be done in one go for the core changes which means that you're going to play that catchup game forever. Let's get over with it towards the end of the merge window'" * tag 'vfs-timespec64' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/playground: pstore: Remove bogus format string definition vfs: change inode times to use struct timespec64 pstore: Convert internal records to timespec64 udf: Simplify calls to udf_disk_stamp_to_time fs: nfs: get rid of memcpys for inode times ceph: make inode time prints to be long long lustre: Use long long type to print inode time fs: add timespec64_truncate()
Diffstat (limited to 'fs/ceph')
-rw-r--r--fs/ceph/addr.c12
-rw-r--r--fs/ceph/cache.c4
-rw-r--r--fs/ceph/caps.c6
-rw-r--r--fs/ceph/file.c6
-rw-r--r--fs/ceph/inode.c86
-rw-r--r--fs/ceph/mds_client.c7
-rw-r--r--fs/ceph/snap.c6
7 files changed, 68 insertions, 59 deletions
diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c
index afcc59ed7090..292b3d72d725 100644
--- a/fs/ceph/addr.c
+++ b/fs/ceph/addr.c
@@ -574,6 +574,7 @@ static u64 get_writepages_data_length(struct inode *inode,
574 */ 574 */
575static int writepage_nounlock(struct page *page, struct writeback_control *wbc) 575static int writepage_nounlock(struct page *page, struct writeback_control *wbc)
576{ 576{
577 struct timespec ts;
577 struct inode *inode; 578 struct inode *inode;
578 struct ceph_inode_info *ci; 579 struct ceph_inode_info *ci;
579 struct ceph_fs_client *fsc; 580 struct ceph_fs_client *fsc;
@@ -624,11 +625,12 @@ static int writepage_nounlock(struct page *page, struct writeback_control *wbc)
624 set_bdi_congested(inode_to_bdi(inode), BLK_RW_ASYNC); 625 set_bdi_congested(inode_to_bdi(inode), BLK_RW_ASYNC);
625 626
626 set_page_writeback(page); 627 set_page_writeback(page);
628 ts = timespec64_to_timespec(inode->i_mtime);
627 err = ceph_osdc_writepages(&fsc->client->osdc, ceph_vino(inode), 629 err = ceph_osdc_writepages(&fsc->client->osdc, ceph_vino(inode),
628 &ci->i_layout, snapc, page_off, len, 630 &ci->i_layout, snapc, page_off, len,
629 ceph_wbc.truncate_seq, 631 ceph_wbc.truncate_seq,
630 ceph_wbc.truncate_size, 632 ceph_wbc.truncate_size,
631 &inode->i_mtime, &page, 1); 633 &ts, &page, 1);
632 if (err < 0) { 634 if (err < 0) {
633 struct writeback_control tmp_wbc; 635 struct writeback_control tmp_wbc;
634 if (!wbc) 636 if (!wbc)
@@ -1132,7 +1134,7 @@ new_request:
1132 pages = NULL; 1134 pages = NULL;
1133 } 1135 }
1134 1136
1135 req->r_mtime = inode->i_mtime; 1137 req->r_mtime = timespec64_to_timespec(inode->i_mtime);
1136 rc = ceph_osdc_start_request(&fsc->client->osdc, req, true); 1138 rc = ceph_osdc_start_request(&fsc->client->osdc, req, true);
1137 BUG_ON(rc); 1139 BUG_ON(rc);
1138 req = NULL; 1140 req = NULL;
@@ -1732,7 +1734,7 @@ int ceph_uninline_data(struct file *filp, struct page *locked_page)
1732 goto out; 1734 goto out;
1733 } 1735 }
1734 1736
1735 req->r_mtime = inode->i_mtime; 1737 req->r_mtime = timespec64_to_timespec(inode->i_mtime);
1736 err = ceph_osdc_start_request(&fsc->client->osdc, req, false); 1738 err = ceph_osdc_start_request(&fsc->client->osdc, req, false);
1737 if (!err) 1739 if (!err)
1738 err = ceph_osdc_wait_request(&fsc->client->osdc, req); 1740 err = ceph_osdc_wait_request(&fsc->client->osdc, req);
@@ -1774,7 +1776,7 @@ int ceph_uninline_data(struct file *filp, struct page *locked_page)
1774 goto out_put; 1776 goto out_put;
1775 } 1777 }
1776 1778
1777 req->r_mtime = inode->i_mtime; 1779 req->r_mtime = timespec64_to_timespec(inode->i_mtime);
1778 err = ceph_osdc_start_request(&fsc->client->osdc, req, false); 1780 err = ceph_osdc_start_request(&fsc->client->osdc, req, false);
1779 if (!err) 1781 if (!err)
1780 err = ceph_osdc_wait_request(&fsc->client->osdc, req); 1782 err = ceph_osdc_wait_request(&fsc->client->osdc, req);
@@ -1935,7 +1937,7 @@ static int __ceph_pool_perm_get(struct ceph_inode_info *ci,
1935 0, false, true); 1937 0, false, true);
1936 err = ceph_osdc_start_request(&fsc->client->osdc, rd_req, false); 1938 err = ceph_osdc_start_request(&fsc->client->osdc, rd_req, false);
1937 1939
1938 wr_req->r_mtime = ci->vfs_inode.i_mtime; 1940 wr_req->r_mtime = timespec64_to_timespec(ci->vfs_inode.i_mtime);
1939 err2 = ceph_osdc_start_request(&fsc->client->osdc, wr_req, false); 1941 err2 = ceph_osdc_start_request(&fsc->client->osdc, wr_req, false);
1940 1942
1941 if (!err) 1943 if (!err)
diff --git a/fs/ceph/cache.c b/fs/ceph/cache.c
index bb524c880b1e..362900e42424 100644
--- a/fs/ceph/cache.c
+++ b/fs/ceph/cache.c
@@ -130,7 +130,7 @@ static enum fscache_checkaux ceph_fscache_inode_check_aux(
130 130
131 memset(&aux, 0, sizeof(aux)); 131 memset(&aux, 0, sizeof(aux));
132 aux.version = ci->i_version; 132 aux.version = ci->i_version;
133 aux.mtime = inode->i_mtime; 133 aux.mtime = timespec64_to_timespec(inode->i_mtime);
134 134
135 if (memcmp(data, &aux, sizeof(aux)) != 0) 135 if (memcmp(data, &aux, sizeof(aux)) != 0)
136 return FSCACHE_CHECKAUX_OBSOLETE; 136 return FSCACHE_CHECKAUX_OBSOLETE;
@@ -163,7 +163,7 @@ void ceph_fscache_register_inode_cookie(struct inode *inode)
163 if (!ci->fscache) { 163 if (!ci->fscache) {
164 memset(&aux, 0, sizeof(aux)); 164 memset(&aux, 0, sizeof(aux));
165 aux.version = ci->i_version; 165 aux.version = ci->i_version;
166 aux.mtime = inode->i_mtime; 166 aux.mtime = timespec64_to_timespec(inode->i_mtime);
167 ci->fscache = fscache_acquire_cookie(fsc->fscache, 167 ci->fscache = fscache_acquire_cookie(fsc->fscache,
168 &ceph_fscache_inode_object_def, 168 &ceph_fscache_inode_object_def,
169 &ci->i_vino, sizeof(ci->i_vino), 169 &ci->i_vino, sizeof(ci->i_vino),
diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c
index 0ae41854d676..990258cbd836 100644
--- a/fs/ceph/caps.c
+++ b/fs/ceph/caps.c
@@ -1360,9 +1360,9 @@ static int __send_cap(struct ceph_mds_client *mdsc, struct ceph_cap *cap,
1360 arg.xattr_buf = NULL; 1360 arg.xattr_buf = NULL;
1361 } 1361 }
1362 1362
1363 arg.mtime = inode->i_mtime; 1363 arg.mtime = timespec64_to_timespec(inode->i_mtime);
1364 arg.atime = inode->i_atime; 1364 arg.atime = timespec64_to_timespec(inode->i_atime);
1365 arg.ctime = inode->i_ctime; 1365 arg.ctime = timespec64_to_timespec(inode->i_ctime);
1366 1366
1367 arg.op = op; 1367 arg.op = op;
1368 arg.caps = cap->implemented; 1368 arg.caps = cap->implemented;
diff --git a/fs/ceph/file.c b/fs/ceph/file.c
index 6b9f7f3cd237..ad0bed99b1d5 100644
--- a/fs/ceph/file.c
+++ b/fs/ceph/file.c
@@ -923,7 +923,7 @@ ceph_direct_read_write(struct kiocb *iocb, struct iov_iter *iter,
923 int num_pages = 0; 923 int num_pages = 0;
924 int flags; 924 int flags;
925 int ret; 925 int ret;
926 struct timespec mtime = current_time(inode); 926 struct timespec mtime = timespec64_to_timespec(current_time(inode));
927 size_t count = iov_iter_count(iter); 927 size_t count = iov_iter_count(iter);
928 loff_t pos = iocb->ki_pos; 928 loff_t pos = iocb->ki_pos;
929 bool write = iov_iter_rw(iter) == WRITE; 929 bool write = iov_iter_rw(iter) == WRITE;
@@ -1131,7 +1131,7 @@ ceph_sync_write(struct kiocb *iocb, struct iov_iter *from, loff_t pos,
1131 int flags; 1131 int flags;
1132 int ret; 1132 int ret;
1133 bool check_caps = false; 1133 bool check_caps = false;
1134 struct timespec mtime = current_time(inode); 1134 struct timespec mtime = timespec64_to_timespec(current_time(inode));
1135 size_t count = iov_iter_count(from); 1135 size_t count = iov_iter_count(from);
1136 1136
1137 if (ceph_snap(file_inode(file)) != CEPH_NOSNAP) 1137 if (ceph_snap(file_inode(file)) != CEPH_NOSNAP)
@@ -1663,7 +1663,7 @@ static int ceph_zero_partial_object(struct inode *inode,
1663 goto out; 1663 goto out;
1664 } 1664 }
1665 1665
1666 req->r_mtime = inode->i_mtime; 1666 req->r_mtime = timespec64_to_timespec(inode->i_mtime);
1667 ret = ceph_osdc_start_request(&fsc->client->osdc, req, false); 1667 ret = ceph_osdc_start_request(&fsc->client->osdc, req, false);
1668 if (!ret) { 1668 if (!ret) {
1669 ret = ceph_osdc_wait_request(&fsc->client->osdc, req); 1669 ret = ceph_osdc_wait_request(&fsc->client->osdc, req);
diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c
index 4fda7a9d4c9d..ee764ac352ab 100644
--- a/fs/ceph/inode.c
+++ b/fs/ceph/inode.c
@@ -662,6 +662,9 @@ void ceph_fill_file_time(struct inode *inode, int issued,
662 struct timespec *mtime, struct timespec *atime) 662 struct timespec *mtime, struct timespec *atime)
663{ 663{
664 struct ceph_inode_info *ci = ceph_inode(inode); 664 struct ceph_inode_info *ci = ceph_inode(inode);
665 struct timespec64 ctime64 = timespec_to_timespec64(*ctime);
666 struct timespec64 mtime64 = timespec_to_timespec64(*mtime);
667 struct timespec64 atime64 = timespec_to_timespec64(*atime);
665 int warn = 0; 668 int warn = 0;
666 669
667 if (issued & (CEPH_CAP_FILE_EXCL| 670 if (issued & (CEPH_CAP_FILE_EXCL|
@@ -670,39 +673,39 @@ void ceph_fill_file_time(struct inode *inode, int issued,
670 CEPH_CAP_AUTH_EXCL| 673 CEPH_CAP_AUTH_EXCL|
671 CEPH_CAP_XATTR_EXCL)) { 674 CEPH_CAP_XATTR_EXCL)) {
672 if (ci->i_version == 0 || 675 if (ci->i_version == 0 ||
673 timespec_compare(ctime, &inode->i_ctime) > 0) { 676 timespec64_compare(&ctime64, &inode->i_ctime) > 0) {
674 dout("ctime %ld.%09ld -> %ld.%09ld inc w/ cap\n", 677 dout("ctime %lld.%09ld -> %lld.%09ld inc w/ cap\n",
675 inode->i_ctime.tv_sec, inode->i_ctime.tv_nsec, 678 (long long)inode->i_ctime.tv_sec, inode->i_ctime.tv_nsec,
676 ctime->tv_sec, ctime->tv_nsec); 679 (long long)ctime->tv_sec, ctime->tv_nsec);
677 inode->i_ctime = *ctime; 680 inode->i_ctime = ctime64;
678 } 681 }
679 if (ci->i_version == 0 || 682 if (ci->i_version == 0 ||
680 ceph_seq_cmp(time_warp_seq, ci->i_time_warp_seq) > 0) { 683 ceph_seq_cmp(time_warp_seq, ci->i_time_warp_seq) > 0) {
681 /* the MDS did a utimes() */ 684 /* the MDS did a utimes() */
682 dout("mtime %ld.%09ld -> %ld.%09ld " 685 dout("mtime %lld.%09ld -> %lld.%09ld "
683 "tw %d -> %d\n", 686 "tw %d -> %d\n",
684 inode->i_mtime.tv_sec, inode->i_mtime.tv_nsec, 687 (long long)inode->i_mtime.tv_sec, inode->i_mtime.tv_nsec,
685 mtime->tv_sec, mtime->tv_nsec, 688 (long long)mtime->tv_sec, mtime->tv_nsec,
686 ci->i_time_warp_seq, (int)time_warp_seq); 689 ci->i_time_warp_seq, (int)time_warp_seq);
687 690
688 inode->i_mtime = *mtime; 691 inode->i_mtime = mtime64;
689 inode->i_atime = *atime; 692 inode->i_atime = atime64;
690 ci->i_time_warp_seq = time_warp_seq; 693 ci->i_time_warp_seq = time_warp_seq;
691 } else if (time_warp_seq == ci->i_time_warp_seq) { 694 } else if (time_warp_seq == ci->i_time_warp_seq) {
692 /* nobody did utimes(); take the max */ 695 /* nobody did utimes(); take the max */
693 if (timespec_compare(mtime, &inode->i_mtime) > 0) { 696 if (timespec64_compare(&mtime64, &inode->i_mtime) > 0) {
694 dout("mtime %ld.%09ld -> %ld.%09ld inc\n", 697 dout("mtime %lld.%09ld -> %lld.%09ld inc\n",
695 inode->i_mtime.tv_sec, 698 (long long)inode->i_mtime.tv_sec,
696 inode->i_mtime.tv_nsec, 699 inode->i_mtime.tv_nsec,
697 mtime->tv_sec, mtime->tv_nsec); 700 (long long)mtime->tv_sec, mtime->tv_nsec);
698 inode->i_mtime = *mtime; 701 inode->i_mtime = mtime64;
699 } 702 }
700 if (timespec_compare(atime, &inode->i_atime) > 0) { 703 if (timespec64_compare(&atime64, &inode->i_atime) > 0) {
701 dout("atime %ld.%09ld -> %ld.%09ld inc\n", 704 dout("atime %lld.%09ld -> %lld.%09ld inc\n",
702 inode->i_atime.tv_sec, 705 (long long)inode->i_atime.tv_sec,
703 inode->i_atime.tv_nsec, 706 inode->i_atime.tv_nsec,
704 atime->tv_sec, atime->tv_nsec); 707 (long long)atime->tv_sec, atime->tv_nsec);
705 inode->i_atime = *atime; 708 inode->i_atime = atime64;
706 } 709 }
707 } else if (issued & CEPH_CAP_FILE_EXCL) { 710 } else if (issued & CEPH_CAP_FILE_EXCL) {
708 /* we did a utimes(); ignore mds values */ 711 /* we did a utimes(); ignore mds values */
@@ -712,9 +715,9 @@ void ceph_fill_file_time(struct inode *inode, int issued,
712 } else { 715 } else {
713 /* we have no write|excl caps; whatever the MDS says is true */ 716 /* we have no write|excl caps; whatever the MDS says is true */
714 if (ceph_seq_cmp(time_warp_seq, ci->i_time_warp_seq) >= 0) { 717 if (ceph_seq_cmp(time_warp_seq, ci->i_time_warp_seq) >= 0) {
715 inode->i_ctime = *ctime; 718 inode->i_ctime = ctime64;
716 inode->i_mtime = *mtime; 719 inode->i_mtime = mtime64;
717 inode->i_atime = *atime; 720 inode->i_atime = atime64;
718 ci->i_time_warp_seq = time_warp_seq; 721 ci->i_time_warp_seq = time_warp_seq;
719 } else { 722 } else {
720 warn = 1; 723 warn = 1;
@@ -1950,6 +1953,7 @@ int __ceph_setattr(struct inode *inode, struct iattr *attr)
1950 int err = 0; 1953 int err = 0;
1951 int inode_dirty_flags = 0; 1954 int inode_dirty_flags = 0;
1952 bool lock_snap_rwsem = false; 1955 bool lock_snap_rwsem = false;
1956 struct timespec ts;
1953 1957
1954 prealloc_cf = ceph_alloc_cap_flush(); 1958 prealloc_cf = ceph_alloc_cap_flush();
1955 if (!prealloc_cf) 1959 if (!prealloc_cf)
@@ -2024,44 +2028,44 @@ int __ceph_setattr(struct inode *inode, struct iattr *attr)
2024 } 2028 }
2025 2029
2026 if (ia_valid & ATTR_ATIME) { 2030 if (ia_valid & ATTR_ATIME) {
2027 dout("setattr %p atime %ld.%ld -> %ld.%ld\n", inode, 2031 dout("setattr %p atime %lld.%ld -> %lld.%ld\n", inode,
2028 inode->i_atime.tv_sec, inode->i_atime.tv_nsec, 2032 (long long)inode->i_atime.tv_sec, inode->i_atime.tv_nsec,
2029 attr->ia_atime.tv_sec, attr->ia_atime.tv_nsec); 2033 (long long)attr->ia_atime.tv_sec, attr->ia_atime.tv_nsec);
2030 if (issued & CEPH_CAP_FILE_EXCL) { 2034 if (issued & CEPH_CAP_FILE_EXCL) {
2031 ci->i_time_warp_seq++; 2035 ci->i_time_warp_seq++;
2032 inode->i_atime = attr->ia_atime; 2036 inode->i_atime = attr->ia_atime;
2033 dirtied |= CEPH_CAP_FILE_EXCL; 2037 dirtied |= CEPH_CAP_FILE_EXCL;
2034 } else if ((issued & CEPH_CAP_FILE_WR) && 2038 } else if ((issued & CEPH_CAP_FILE_WR) &&
2035 timespec_compare(&inode->i_atime, 2039 timespec64_compare(&inode->i_atime,
2036 &attr->ia_atime) < 0) { 2040 &attr->ia_atime) < 0) {
2037 inode->i_atime = attr->ia_atime; 2041 inode->i_atime = attr->ia_atime;
2038 dirtied |= CEPH_CAP_FILE_WR; 2042 dirtied |= CEPH_CAP_FILE_WR;
2039 } else if ((issued & CEPH_CAP_FILE_SHARED) == 0 || 2043 } else if ((issued & CEPH_CAP_FILE_SHARED) == 0 ||
2040 !timespec_equal(&inode->i_atime, &attr->ia_atime)) { 2044 !timespec64_equal(&inode->i_atime, &attr->ia_atime)) {
2041 ceph_encode_timespec(&req->r_args.setattr.atime, 2045 ts = timespec64_to_timespec(attr->ia_atime);
2042 &attr->ia_atime); 2046 ceph_encode_timespec(&req->r_args.setattr.atime, &ts);
2043 mask |= CEPH_SETATTR_ATIME; 2047 mask |= CEPH_SETATTR_ATIME;
2044 release |= CEPH_CAP_FILE_SHARED | 2048 release |= CEPH_CAP_FILE_SHARED |
2045 CEPH_CAP_FILE_RD | CEPH_CAP_FILE_WR; 2049 CEPH_CAP_FILE_RD | CEPH_CAP_FILE_WR;
2046 } 2050 }
2047 } 2051 }
2048 if (ia_valid & ATTR_MTIME) { 2052 if (ia_valid & ATTR_MTIME) {
2049 dout("setattr %p mtime %ld.%ld -> %ld.%ld\n", inode, 2053 dout("setattr %p mtime %lld.%ld -> %lld.%ld\n", inode,
2050 inode->i_mtime.tv_sec, inode->i_mtime.tv_nsec, 2054 (long long)inode->i_mtime.tv_sec, inode->i_mtime.tv_nsec,
2051 attr->ia_mtime.tv_sec, attr->ia_mtime.tv_nsec); 2055 (long long)attr->ia_mtime.tv_sec, attr->ia_mtime.tv_nsec);
2052 if (issued & CEPH_CAP_FILE_EXCL) { 2056 if (issued & CEPH_CAP_FILE_EXCL) {
2053 ci->i_time_warp_seq++; 2057 ci->i_time_warp_seq++;
2054 inode->i_mtime = attr->ia_mtime; 2058 inode->i_mtime = attr->ia_mtime;
2055 dirtied |= CEPH_CAP_FILE_EXCL; 2059 dirtied |= CEPH_CAP_FILE_EXCL;
2056 } else if ((issued & CEPH_CAP_FILE_WR) && 2060 } else if ((issued & CEPH_CAP_FILE_WR) &&
2057 timespec_compare(&inode->i_mtime, 2061 timespec64_compare(&inode->i_mtime,
2058 &attr->ia_mtime) < 0) { 2062 &attr->ia_mtime) < 0) {
2059 inode->i_mtime = attr->ia_mtime; 2063 inode->i_mtime = attr->ia_mtime;
2060 dirtied |= CEPH_CAP_FILE_WR; 2064 dirtied |= CEPH_CAP_FILE_WR;
2061 } else if ((issued & CEPH_CAP_FILE_SHARED) == 0 || 2065 } else if ((issued & CEPH_CAP_FILE_SHARED) == 0 ||
2062 !timespec_equal(&inode->i_mtime, &attr->ia_mtime)) { 2066 !timespec64_equal(&inode->i_mtime, &attr->ia_mtime)) {
2063 ceph_encode_timespec(&req->r_args.setattr.mtime, 2067 ts = timespec64_to_timespec(attr->ia_mtime);
2064 &attr->ia_mtime); 2068 ceph_encode_timespec(&req->r_args.setattr.mtime, &ts);
2065 mask |= CEPH_SETATTR_MTIME; 2069 mask |= CEPH_SETATTR_MTIME;
2066 release |= CEPH_CAP_FILE_SHARED | 2070 release |= CEPH_CAP_FILE_SHARED |
2067 CEPH_CAP_FILE_RD | CEPH_CAP_FILE_WR; 2071 CEPH_CAP_FILE_RD | CEPH_CAP_FILE_WR;
@@ -2091,9 +2095,9 @@ int __ceph_setattr(struct inode *inode, struct iattr *attr)
2091 if (ia_valid & ATTR_CTIME) { 2095 if (ia_valid & ATTR_CTIME) {
2092 bool only = (ia_valid & (ATTR_SIZE|ATTR_MTIME|ATTR_ATIME| 2096 bool only = (ia_valid & (ATTR_SIZE|ATTR_MTIME|ATTR_ATIME|
2093 ATTR_MODE|ATTR_UID|ATTR_GID)) == 0; 2097 ATTR_MODE|ATTR_UID|ATTR_GID)) == 0;
2094 dout("setattr %p ctime %ld.%ld -> %ld.%ld (%s)\n", inode, 2098 dout("setattr %p ctime %lld.%ld -> %lld.%ld (%s)\n", inode,
2095 inode->i_ctime.tv_sec, inode->i_ctime.tv_nsec, 2099 (long long)inode->i_ctime.tv_sec, inode->i_ctime.tv_nsec,
2096 attr->ia_ctime.tv_sec, attr->ia_ctime.tv_nsec, 2100 (long long)attr->ia_ctime.tv_sec, attr->ia_ctime.tv_nsec,
2097 only ? "ctime only" : "ignored"); 2101 only ? "ctime only" : "ignored");
2098 if (only) { 2102 if (only) {
2099 /* 2103 /*
@@ -2135,7 +2139,7 @@ int __ceph_setattr(struct inode *inode, struct iattr *attr)
2135 req->r_inode_drop = release; 2139 req->r_inode_drop = release;
2136 req->r_args.setattr.mask = cpu_to_le32(mask); 2140 req->r_args.setattr.mask = cpu_to_le32(mask);
2137 req->r_num_caps = 1; 2141 req->r_num_caps = 1;
2138 req->r_stamp = attr->ia_ctime; 2142 req->r_stamp = timespec64_to_timespec(attr->ia_ctime);
2139 err = ceph_mdsc_do_request(mdsc, NULL, req); 2143 err = ceph_mdsc_do_request(mdsc, NULL, req);
2140 } 2144 }
2141 dout("setattr %p result=%d (%s locally, %d remote)\n", inode, err, 2145 dout("setattr %p result=%d (%s locally, %d remote)\n", inode, err,
diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c
index cf8d24812cc0..dc8bc664a871 100644
--- a/fs/ceph/mds_client.c
+++ b/fs/ceph/mds_client.c
@@ -2958,12 +2958,15 @@ static int encode_caps_cb(struct inode *inode, struct ceph_cap *cap,
2958 rec.v2.flock_len = (__force __le32) 2958 rec.v2.flock_len = (__force __le32)
2959 ((ci->i_ceph_flags & CEPH_I_ERROR_FILELOCK) ? 0 : 1); 2959 ((ci->i_ceph_flags & CEPH_I_ERROR_FILELOCK) ? 0 : 1);
2960 } else { 2960 } else {
2961 struct timespec ts;
2961 rec.v1.cap_id = cpu_to_le64(cap->cap_id); 2962 rec.v1.cap_id = cpu_to_le64(cap->cap_id);
2962 rec.v1.wanted = cpu_to_le32(__ceph_caps_wanted(ci)); 2963 rec.v1.wanted = cpu_to_le32(__ceph_caps_wanted(ci));
2963 rec.v1.issued = cpu_to_le32(cap->issued); 2964 rec.v1.issued = cpu_to_le32(cap->issued);
2964 rec.v1.size = cpu_to_le64(inode->i_size); 2965 rec.v1.size = cpu_to_le64(inode->i_size);
2965 ceph_encode_timespec(&rec.v1.mtime, &inode->i_mtime); 2966 ts = timespec64_to_timespec(inode->i_mtime);
2966 ceph_encode_timespec(&rec.v1.atime, &inode->i_atime); 2967 ceph_encode_timespec(&rec.v1.mtime, &ts);
2968 ts = timespec64_to_timespec(inode->i_atime);
2969 ceph_encode_timespec(&rec.v1.atime, &ts);
2967 rec.v1.snaprealm = cpu_to_le64(ci->i_snap_realm->ino); 2970 rec.v1.snaprealm = cpu_to_le64(ci->i_snap_realm->ino);
2968 rec.v1.pathbase = cpu_to_le64(pathbase); 2971 rec.v1.pathbase = cpu_to_le64(pathbase);
2969 } 2972 }
diff --git a/fs/ceph/snap.c b/fs/ceph/snap.c
index 041c27ea8de1..af81555c14fd 100644
--- a/fs/ceph/snap.c
+++ b/fs/ceph/snap.c
@@ -594,9 +594,9 @@ int __ceph_finish_cap_snap(struct ceph_inode_info *ci,
594 594
595 BUG_ON(capsnap->writing); 595 BUG_ON(capsnap->writing);
596 capsnap->size = inode->i_size; 596 capsnap->size = inode->i_size;
597 capsnap->mtime = inode->i_mtime; 597 capsnap->mtime = timespec64_to_timespec(inode->i_mtime);
598 capsnap->atime = inode->i_atime; 598 capsnap->atime = timespec64_to_timespec(inode->i_atime);
599 capsnap->ctime = inode->i_ctime; 599 capsnap->ctime = timespec64_to_timespec(inode->i_ctime);
600 capsnap->time_warp_seq = ci->i_time_warp_seq; 600 capsnap->time_warp_seq = ci->i_time_warp_seq;
601 capsnap->truncate_size = ci->i_truncate_size; 601 capsnap->truncate_size = ci->i_truncate_size;
602 capsnap->truncate_seq = ci->i_truncate_seq; 602 capsnap->truncate_seq = ci->i_truncate_seq;