The current code assumes that offline and busy volume states apply to all instances of a volume, not just the one on the server that returned VOFFLINE or VBUSY and will emit a notice to dmesg suggesting that the entire volume is unavailable. Fix that by moving the flags recording this to the afs_server_entry struct that is used to represent a particular instance of a volume on a specific server. The notice is altered to include the server UUID also.
Unified · Split
| @@ -612,6 +612,8 @@ struct afs_server_entry { · 611 unmodified lines | ||
| 612 | 612 | time64_t cb_expires_at; /* Time at which volume-level callback expires */ |
| 613 | 613 | unsigned long flags; |
| 614 | 614 | #define AFS_SE_EXCLUDED 0 /* Set if server is to be excluded in rotation */ |
| 615 | +#define AFS_SE_VOLUME_OFFLINE 1 /* Set if volume offline notice given */ | |
| 616 | +#define AFS_SE_VOLUME_BUSY 2 /* Set if volume busy notice given */ | |
| 615 | 617 | }; |
| 616 | 618 | |
| 617 | 619 | struct afs_server_list { |
| @@ -645,10 +647,8 @@ struct afs_volume { · 27 unmodified lines | ||
| 645 | 647 | #define AFS_VOLUME_UPDATING 1 /* - T if an update is in progress */ |
| 646 | 648 | #define AFS_VOLUME_WAIT 2 /* - T if users must wait for update */ |
| 647 | 649 | #define AFS_VOLUME_DELETED 3 /* - T if volume appears deleted */ |
| 648 | −#define AFS_VOLUME_OFFLINE 4 /* - T if volume offline notice given */ | |
| 649 | −#define AFS_VOLUME_BUSY 5 /* - T if volume busy notice given */ | |
| 650 | −#define AFS_VOLUME_MAYBE_NO_IBULK 6 /* - T if some servers don't have InlineBulkStatus */ | |
| 651 | −#define AFS_VOLUME_RM_TREE 7 /* - Set if volume removed from cell->volumes */ | |
| 650 | +#define AFS_VOLUME_MAYBE_NO_IBULK 4 /* - T if some servers don't have InlineBulkStatus */ | |
| 651 | +#define AFS_VOLUME_RM_TREE 5 /* - Set if volume removed from cell->volumes */ | |
| 652 | 652 | #ifdef CONFIG_AFS_FSCACHE |
| 653 | 653 | struct fscache_volume *cache; /* Caching cookie */ |
| 654 | 654 | #endif |
| @@ -111,7 +111,7 @@ found_interest: · 110 unmodified lines | ||
| 111 | 111 | /* |
| 112 | 112 | * Post volume busy note. |
| 113 | 113 | */ |
| 114 | −static void afs_busy(struct afs_volume *volume, u32 abort_code) | |
| 114 | +static void afs_busy(struct afs_operation *op, u32 abort_code) | |
| 115 | 115 | { |
| 116 | 116 | const char *m; |
| 117 | 117 | |
| @@ -122,7 +122,8 @@ static void afs_busy(struct afs_volume *volume, u32 abort_code) · 4 unmodified lines | ||
| 122 | 122 | default: m = "busy"; break; |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | − pr_notice("kAFS: Volume %llu '%s' is %s\n", volume->vid, volume->name, m); | |
| 125 | + pr_notice("kAFS: Volume %llu '%s' on server %pU is %s\n", | |
| 126 | + op->volume->vid, op->volume->name, &op->server->uuid, m); | |
| 126 | 127 | } |
| 127 | 128 | |
| 128 | 129 | /* |
| @@ -181,6 +182,10 @@ bool afs_select_fileserver(struct afs_operation *op) · 52 unmodified lines | ||
| 181 | 182 | /* Evaluate the result of the previous operation, if there was one. */ |
| 182 | 183 | switch (op->call_error) { |
| 183 | 184 | case 0: |
| 185 | + clear_bit(AFS_SE_VOLUME_OFFLINE, | |
| 186 | + &op->server_list->servers[op->server_index].flags); | |
| 187 | + clear_bit(AFS_SE_VOLUME_BUSY, | |
| 188 | + &op->server_list->servers[op->server_index].flags); | |
| 184 | 189 | op->cumul_error.responded = true; |
| 185 | 190 | |
| 186 | 191 | /* We succeeded, but we may need to redo the op from another |
| @@ -314,9 +319,11 @@ bool afs_select_fileserver(struct afs_operation *op) · 127 unmodified lines | ||
| 314 | 319 | * expected to come back but it might take a long time (could be |
| 315 | 320 | * days). |
| 316 | 321 | */ |
| 317 | − if (!test_and_set_bit(AFS_VOLUME_OFFLINE, &op->volume->flags)) { | |
| 318 | − afs_busy(op->volume, abort_code); | |
| 319 | − clear_bit(AFS_VOLUME_BUSY, &op->volume->flags); | |
| 322 | + if (!test_and_set_bit(AFS_SE_VOLUME_OFFLINE, | |
| 323 | + &op->server_list->servers[op->server_index].flags)) { | |
| 324 | + afs_busy(op, abort_code); | |
| 325 | + clear_bit(AFS_SE_VOLUME_BUSY, | |
| 326 | + &op->server_list->servers[op->server_index].flags); | |
| 320 | 327 | } |
| 321 | 328 | if (op->flags & AFS_OPERATION_NO_VSLEEP) { |
| 322 | 329 | afs_op_set_error(op, -EADV); |
| @@ -343,9 +350,11 @@ bool afs_select_fileserver(struct afs_operation *op) · 20 unmodified lines | ||
| 343 | 350 | afs_op_set_error(op, -EBUSY); |
| 344 | 351 | goto failed; |
| 345 | 352 | } |
| 346 | − if (!test_and_set_bit(AFS_VOLUME_BUSY, &op->volume->flags)) { | |
| 347 | − afs_busy(op->volume, abort_code); | |
| 348 | − clear_bit(AFS_VOLUME_OFFLINE, &op->volume->flags); | |
| 353 | + if (!test_and_set_bit(AFS_SE_VOLUME_BUSY, | |
| 354 | + &op->server_list->servers[op->server_index].flags)) { | |
| 355 | + afs_busy(op, abort_code); | |
| 356 | + clear_bit(AFS_SE_VOLUME_OFFLINE, | |
| 357 | + &op->server_list->servers[op->server_index].flags); | |
| 349 | 358 | } |
| 350 | 359 | busy: |
| 351 | 360 | if (op->flags & AFS_OPERATION_CUR_ONLY) { |
| @@ -426,8 +435,10 @@ bool afs_select_fileserver(struct afs_operation *op) · 74 unmodified lines | ||
| 426 | 435 | default: |
| 427 | 436 | afs_op_accumulate_error(op, error, abort_code); |
| 428 | 437 | failed_but_online: |
| 429 | − clear_bit(AFS_VOLUME_OFFLINE, &op->volume->flags); | |
| 430 | − clear_bit(AFS_VOLUME_BUSY, &op->volume->flags); | |
| 438 | + clear_bit(AFS_SE_VOLUME_OFFLINE, | |
| 439 | + &op->server_list->servers[op->server_index].flags); | |
| 440 | + clear_bit(AFS_SE_VOLUME_BUSY, | |
| 441 | + &op->server_list->servers[op->server_index].flags); | |
| 431 | 442 | goto failed; |
| 432 | 443 | } |
| 433 | 444 | |