Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'ceph-for-4.17-rc3' of git://github.com/ceph/ceph-client

Pull ceph fixes from Ilya Dryomov:
"A CephFS quota follow-up and fixes for two older issues in the
messenger layer, marked for stable"

* tag 'ceph-for-4.17-rc3' of git://github.com/ceph/ceph-client:
libceph: validate con->state at the top of try_write()
libceph: reschedule a tick in finish_hunting()
libceph: un-backoff on tick when we have a authenticated session
ceph: check if mds create snaprealm when setting quota

+43 -6
+25 -3
fs/ceph/xattr.c
··· 228 228 229 229 static bool ceph_vxattrcb_quota_exists(struct ceph_inode_info *ci) 230 230 { 231 - return (ci->i_max_files || ci->i_max_bytes); 231 + bool ret = false; 232 + spin_lock(&ci->i_ceph_lock); 233 + if ((ci->i_max_files || ci->i_max_bytes) && 234 + ci->i_vino.snap == CEPH_NOSNAP && 235 + ci->i_snap_realm && 236 + ci->i_snap_realm->ino == ci->i_vino.ino) 237 + ret = true; 238 + spin_unlock(&ci->i_ceph_lock); 239 + return ret; 232 240 } 233 241 234 242 static size_t ceph_vxattrcb_quota(struct ceph_inode_info *ci, char *val, ··· 1016 1008 char *newval = NULL; 1017 1009 struct ceph_inode_xattr *xattr = NULL; 1018 1010 int required_blob_size; 1011 + bool check_realm = false; 1019 1012 bool lock_snap_rwsem = false; 1020 1013 1021 1014 if (ceph_snap(inode) != CEPH_NOSNAP) 1022 1015 return -EROFS; 1023 1016 1024 1017 vxattr = ceph_match_vxattr(inode, name); 1025 - if (vxattr && vxattr->readonly) 1026 - return -EOPNOTSUPP; 1018 + if (vxattr) { 1019 + if (vxattr->readonly) 1020 + return -EOPNOTSUPP; 1021 + if (value && !strncmp(vxattr->name, "ceph.quota", 10)) 1022 + check_realm = true; 1023 + } 1027 1024 1028 1025 /* pass any unhandled ceph.* xattrs through to the MDS */ 1029 1026 if (!strncmp(name, XATTR_CEPH_PREFIX, XATTR_CEPH_PREFIX_LEN)) ··· 1122 1109 err = -EBUSY; 1123 1110 } else { 1124 1111 err = ceph_sync_setxattr(inode, name, value, size, flags); 1112 + if (err >= 0 && check_realm) { 1113 + /* check if snaprealm was created for quota inode */ 1114 + spin_lock(&ci->i_ceph_lock); 1115 + if ((ci->i_max_files || ci->i_max_bytes) && 1116 + !(ci->i_snap_realm && 1117 + ci->i_snap_realm->ino == ci->i_vino.ino)) 1118 + err = -EOPNOTSUPP; 1119 + spin_unlock(&ci->i_ceph_lock); 1120 + } 1125 1121 } 1126 1122 out: 1127 1123 ceph_free_cap_flush(prealloc_cf);
+7
net/ceph/messenger.c
··· 2569 2569 int ret = 1; 2570 2570 2571 2571 dout("try_write start %p state %lu\n", con, con->state); 2572 + if (con->state != CON_STATE_PREOPEN && 2573 + con->state != CON_STATE_CONNECTING && 2574 + con->state != CON_STATE_NEGOTIATING && 2575 + con->state != CON_STATE_OPEN) 2576 + return 0; 2572 2577 2573 2578 more: 2574 2579 dout("try_write out_kvec_bytes %d\n", con->out_kvec_bytes); ··· 2599 2594 } 2600 2595 2601 2596 more_kvec: 2597 + BUG_ON(!con->sock); 2598 + 2602 2599 /* kvec data queued? */ 2603 2600 if (con->out_kvec_left) { 2604 2601 ret = write_partial_kvec(con);
+11 -3
net/ceph/mon_client.c
··· 209 209 __open_session(monc); 210 210 } 211 211 212 + static void un_backoff(struct ceph_mon_client *monc) 213 + { 214 + monc->hunt_mult /= 2; /* reduce by 50% */ 215 + if (monc->hunt_mult < 1) 216 + monc->hunt_mult = 1; 217 + dout("%s hunt_mult now %d\n", __func__, monc->hunt_mult); 218 + } 219 + 212 220 /* 213 221 * Reschedule delayed work timer. 214 222 */ ··· 971 963 if (!monc->hunting) { 972 964 ceph_con_keepalive(&monc->con); 973 965 __validate_auth(monc); 966 + un_backoff(monc); 974 967 } 975 968 976 969 if (is_auth && ··· 1132 1123 dout("%s found mon%d\n", __func__, monc->cur_mon); 1133 1124 monc->hunting = false; 1134 1125 monc->had_a_connection = true; 1135 - monc->hunt_mult /= 2; /* reduce by 50% */ 1136 - if (monc->hunt_mult < 1) 1137 - monc->hunt_mult = 1; 1126 + un_backoff(monc); 1127 + __schedule_delayed(monc); 1138 1128 } 1139 1129 } 1140 1130