aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Layton <jlayton@kernel.org>2019-06-06 08:06:40 -0400
committerIlya Dryomov <idryomov@gmail.com>2019-07-08 08:01:43 -0400
commit176c77c9c9b1f843332496a28f4545eb96d5dab9 (patch)
tree6888489d5e897e50f85f82e7b8a3f7518c8bab84
parenta35ead314e0b9252a92a5e179a00b242d1af7bff (diff)
ceph: handle change_attr in cap messages
Signed-off-by: Jeff Layton <jlayton@kernel.org> Reviewed-by: "Yan, Zheng" <zyan@redhat.com> Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
-rw-r--r--fs/ceph/caps.c19
-rw-r--r--fs/ceph/snap.c2
-rw-r--r--fs/ceph/super.h1
3 files changed, 13 insertions, 9 deletions
diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c
index 623b82684e90..2e22efd79b0c 100644
--- a/fs/ceph/caps.c
+++ b/fs/ceph/caps.c
@@ -8,6 +8,7 @@
8#include <linux/vmalloc.h> 8#include <linux/vmalloc.h>
9#include <linux/wait.h> 9#include <linux/wait.h>
10#include <linux/writeback.h> 10#include <linux/writeback.h>
11#include <linux/iversion.h>
11 12
12#include "super.h" 13#include "super.h"
13#include "mds_client.h" 14#include "mds_client.h"
@@ -1138,6 +1139,7 @@ struct cap_msg_args {
1138 u64 ino, cid, follows; 1139 u64 ino, cid, follows;
1139 u64 flush_tid, oldest_flush_tid, size, max_size; 1140 u64 flush_tid, oldest_flush_tid, size, max_size;
1140 u64 xattr_version; 1141 u64 xattr_version;
1142 u64 change_attr;
1141 struct ceph_buffer *xattr_buf; 1143 struct ceph_buffer *xattr_buf;
1142 struct timespec64 atime, mtime, ctime, btime; 1144 struct timespec64 atime, mtime, ctime, btime;
1143 int op, caps, wanted, dirty; 1145 int op, caps, wanted, dirty;
@@ -1244,15 +1246,10 @@ static int send_cap_msg(struct cap_msg_args *arg)
1244 /* pool namespace (version 8) (mds always ignores this) */ 1246 /* pool namespace (version 8) (mds always ignores this) */
1245 ceph_encode_32(&p, 0); 1247 ceph_encode_32(&p, 0);
1246 1248
1247 /* 1249 /* btime and change_attr (version 9) */
1248 * btime and change_attr (version 9)
1249 *
1250 * We just zero these out for now, as the MDS ignores them unless
1251 * the requisite feature flags are set (which we don't do yet).
1252 */
1253 ceph_encode_timespec64(p, &arg->btime); 1250 ceph_encode_timespec64(p, &arg->btime);
1254 p += sizeof(struct ceph_timespec); 1251 p += sizeof(struct ceph_timespec);
1255 ceph_encode_64(&p, 0); 1252 ceph_encode_64(&p, arg->change_attr);
1256 1253
1257 /* Advisory flags (version 10) */ 1254 /* Advisory flags (version 10) */
1258 ceph_encode_32(&p, arg->flags); 1255 ceph_encode_32(&p, arg->flags);
@@ -1379,6 +1376,7 @@ static int __send_cap(struct ceph_mds_client *mdsc, struct ceph_cap *cap,
1379 arg.atime = inode->i_atime; 1376 arg.atime = inode->i_atime;
1380 arg.ctime = inode->i_ctime; 1377 arg.ctime = inode->i_ctime;
1381 arg.btime = ci->i_btime; 1378 arg.btime = ci->i_btime;
1379 arg.change_attr = inode_peek_iversion_raw(inode);
1382 1380
1383 arg.op = op; 1381 arg.op = op;
1384 arg.caps = cap->implemented; 1382 arg.caps = cap->implemented;
@@ -1439,6 +1437,7 @@ static inline int __send_flush_snap(struct inode *inode,
1439 arg.mtime = capsnap->mtime; 1437 arg.mtime = capsnap->mtime;
1440 arg.ctime = capsnap->ctime; 1438 arg.ctime = capsnap->ctime;
1441 arg.btime = capsnap->btime; 1439 arg.btime = capsnap->btime;
1440 arg.change_attr = capsnap->change_attr;
1442 1441
1443 arg.op = CEPH_CAP_OP_FLUSHSNAP; 1442 arg.op = CEPH_CAP_OP_FLUSHSNAP;
1444 arg.caps = capsnap->issued; 1443 arg.caps = capsnap->issued;
@@ -3043,6 +3042,7 @@ struct cap_extra_info {
3043 bool dirstat_valid; 3042 bool dirstat_valid;
3044 u64 nfiles; 3043 u64 nfiles;
3045 u64 nsubdirs; 3044 u64 nsubdirs;
3045 u64 change_attr;
3046 /* currently issued */ 3046 /* currently issued */
3047 int issued; 3047 int issued;
3048 struct timespec64 btime; 3048 struct timespec64 btime;
@@ -3127,6 +3127,8 @@ static void handle_cap_grant(struct inode *inode,
3127 3127
3128 __check_cap_issue(ci, cap, newcaps); 3128 __check_cap_issue(ci, cap, newcaps);
3129 3129
3130 inode_set_max_iversion_raw(inode, extra_info->change_attr);
3131
3130 if ((newcaps & CEPH_CAP_AUTH_SHARED) && 3132 if ((newcaps & CEPH_CAP_AUTH_SHARED) &&
3131 (extra_info->issued & CEPH_CAP_AUTH_EXCL) == 0) { 3133 (extra_info->issued & CEPH_CAP_AUTH_EXCL) == 0) {
3132 inode->i_mode = le32_to_cpu(grant->mode); 3134 inode->i_mode = le32_to_cpu(grant->mode);
@@ -3856,14 +3858,13 @@ void ceph_handle_caps(struct ceph_mds_session *session,
3856 3858
3857 if (msg_version >= 9) { 3859 if (msg_version >= 9) {
3858 struct ceph_timespec *btime; 3860 struct ceph_timespec *btime;
3859 u64 change_attr;
3860 3861
3861 if (p + sizeof(*btime) > end) 3862 if (p + sizeof(*btime) > end)
3862 goto bad; 3863 goto bad;
3863 btime = p; 3864 btime = p;
3864 ceph_decode_timespec64(&extra_info.btime, btime); 3865 ceph_decode_timespec64(&extra_info.btime, btime);
3865 p += sizeof(*btime); 3866 p += sizeof(*btime);
3866 ceph_decode_64_safe(&p, end, change_attr, bad); 3867 ceph_decode_64_safe(&p, end, extra_info.change_attr, bad);
3867 } 3868 }
3868 3869
3869 if (msg_version >= 11) { 3870 if (msg_version >= 11) {
diff --git a/fs/ceph/snap.c b/fs/ceph/snap.c
index 854308e13f12..4c6494eb02b5 100644
--- a/fs/ceph/snap.c
+++ b/fs/ceph/snap.c
@@ -3,6 +3,7 @@
3 3
4#include <linux/sort.h> 4#include <linux/sort.h>
5#include <linux/slab.h> 5#include <linux/slab.h>
6#include <linux/iversion.h>
6#include "super.h" 7#include "super.h"
7#include "mds_client.h" 8#include "mds_client.h"
8#include <linux/ceph/decode.h> 9#include <linux/ceph/decode.h>
@@ -607,6 +608,7 @@ int __ceph_finish_cap_snap(struct ceph_inode_info *ci,
607 capsnap->atime = inode->i_atime; 608 capsnap->atime = inode->i_atime;
608 capsnap->ctime = inode->i_ctime; 609 capsnap->ctime = inode->i_ctime;
609 capsnap->btime = ci->i_btime; 610 capsnap->btime = ci->i_btime;
611 capsnap->change_attr = inode_peek_iversion_raw(inode);
610 capsnap->time_warp_seq = ci->i_time_warp_seq; 612 capsnap->time_warp_seq = ci->i_time_warp_seq;
611 capsnap->truncate_size = ci->i_truncate_size; 613 capsnap->truncate_size = ci->i_truncate_size;
612 capsnap->truncate_seq = ci->i_truncate_seq; 614 capsnap->truncate_seq = ci->i_truncate_seq;
diff --git a/fs/ceph/super.h b/fs/ceph/super.h
index 2e20fc780f53..a592d4a8266c 100644
--- a/fs/ceph/super.h
+++ b/fs/ceph/super.h
@@ -197,6 +197,7 @@ struct ceph_cap_snap {
197 u64 xattr_version; 197 u64 xattr_version;
198 198
199 u64 size; 199 u64 size;
200 u64 change_attr;
200 struct timespec64 mtime, atime, ctime, btime; 201 struct timespec64 mtime, atime, ctime, btime;
201 u64 time_warp_seq; 202 u64 time_warp_seq;
202 u64 truncate_size; 203 u64 truncate_size;