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

afs: Don't get epoch from a server because it may be ambiguous

Don't get the epoch from a server, particularly one that we're looking up
by UUID, as UUIDs may be ambiguous and may map to more than one server - so
we can't draw any conclusions from it.

Reported-by: Jeffrey Altman <jaltman@auristor.com>
Signed-off-by: David Howells <dhowells@redhat.com>

+2 -54
+2 -47
fs/afs/cmservice.c
··· 118 118 { 119 119 _enter("{%u, CB.OP %u}", call->service_id, call->operation_ID); 120 120 121 - call->epoch = rxrpc_kernel_get_epoch(call->net->socket, call->rxcall); 122 - 123 121 switch (call->operation_ID) { 124 122 case CBCallBack: 125 123 call->type = &afs_SRXCBCallBack; ··· 148 150 } 149 151 150 152 /* 151 - * Record a probe to the cache manager from a server. 152 - */ 153 - static int afs_record_cm_probe(struct afs_call *call, struct afs_server *server) 154 - { 155 - _enter(""); 156 - 157 - if (test_bit(AFS_SERVER_FL_HAVE_EPOCH, &server->flags) && 158 - !afs_is_probing_server(server)) { 159 - if (server->cm_epoch == call->epoch) 160 - return 0; 161 - 162 - if (!server->probe.said_rebooted) { 163 - pr_notice("kAFS: FS rebooted %pU\n", &server->uuid); 164 - server->probe.said_rebooted = true; 165 - } 166 - } 167 - 168 - spin_lock(&server->probe_lock); 169 - 170 - if (!test_and_set_bit(AFS_SERVER_FL_HAVE_EPOCH, &server->flags)) { 171 - server->cm_epoch = call->epoch; 172 - server->probe.cm_epoch = call->epoch; 173 - goto out; 174 - } 175 - 176 - if (server->probe.cm_probed && 177 - call->epoch != server->probe.cm_epoch && 178 - !server->probe.said_inconsistent) { 179 - pr_notice("kAFS: FS endpoints inconsistent %pU\n", 180 - &server->uuid); 181 - server->probe.said_inconsistent = true; 182 - } 183 - 184 - if (!server->probe.cm_probed || call->epoch == server->cm_epoch) 185 - server->probe.cm_epoch = server->cm_epoch; 186 - 187 - out: 188 - server->probe.cm_probed = true; 189 - spin_unlock(&server->probe_lock); 190 - return 0; 191 - } 192 - 193 - /* 194 153 * Find the server record by peer address and record a probe to the cache 195 154 * manager from a server. 196 155 */ ··· 165 210 } 166 211 167 212 call->server = server; 168 - return afs_record_cm_probe(call, server); 213 + return 0; 169 214 } 170 215 171 216 /* ··· 186 231 } 187 232 188 233 call->server = server; 189 - return afs_record_cm_probe(call, server); 234 + return 0; 190 235 } 191 236 192 237 /*
-7
fs/afs/internal.h
··· 124 124 spinlock_t state_lock; 125 125 int error; /* error code */ 126 126 u32 abort_code; /* Remote abort ID or 0 */ 127 - u32 epoch; 128 127 unsigned int max_lifespan; /* Maximum lifespan to set if not 0 */ 129 128 unsigned request_size; /* size of request data */ 130 129 unsigned reply_max; /* maximum size of reply */ ··· 490 491 #define AFS_SERVER_FL_MAY_HAVE_CB 8 /* May have callbacks on this fileserver */ 491 492 #define AFS_SERVER_FL_IS_YFS 9 /* Server is YFS not AFS */ 492 493 #define AFS_SERVER_FL_NO_RM2 10 /* Fileserver doesn't support YFS.RemoveFile2 */ 493 - #define AFS_SERVER_FL_HAVE_EPOCH 11 /* ->epoch is valid */ 494 494 #define AFS_SERVER_FL_NEEDS_UPDATE 12 /* Fileserver address list is out of date */ 495 495 atomic_t ref; /* Object refcount */ 496 496 atomic_t active; /* Active user count */ 497 497 u32 addr_version; /* Address list version */ 498 - u32 cm_epoch; /* Server RxRPC epoch */ 499 498 unsigned int debug_id; /* Debugging ID for traces */ 500 499 501 500 /* file service access */ ··· 512 515 struct { 513 516 unsigned int rtt; /* RTT as ktime/64 */ 514 517 u32 abort_code; 515 - u32 cm_epoch; 516 518 short error; 517 519 bool responded:1; 518 520 bool is_yfs:1; 519 521 bool not_yfs:1; 520 522 bool local_failure:1; 521 - bool cm_probed:1; 522 - bool said_rebooted:1; 523 - bool said_inconsistent:1; 524 523 } probe; 525 524 }; 526 525