Skip to content

Commit 28f4c58

Browse files
committed
afs: Fix offline and busy message emission
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. Signed-off-by: David Howells <dhowells@redhat.com> cc: Marc Dionne <marc.dionne@auristor.com> cc: linux-afs@lists.infradead.org
1 parent 495f2ae commit 28f4c58

2 files changed

Lines changed: 25 additions & 14 deletions

File tree

fs/afs/internal.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -612,6 +612,8 @@ struct afs_server_entry {
612612
time64_t cb_expires_at; /* Time at which volume-level callback expires */
613613
unsigned long flags;
614614
#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 */
615617
};
616618

617619
struct afs_server_list {
@@ -645,10 +647,8 @@ struct afs_volume {
645647
#define AFS_VOLUME_UPDATING 1 /* - T if an update is in progress */
646648
#define AFS_VOLUME_WAIT 2 /* - T if users must wait for update */
647649
#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 */
652652
#ifdef CONFIG_AFS_FSCACHE
653653
struct fscache_volume *cache; /* Caching cookie */
654654
#endif

fs/afs/rotate.c

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ static bool afs_start_fs_iteration(struct afs_operation *op,
111111
/*
112112
* Post volume busy note.
113113
*/
114-
static void afs_busy(struct afs_volume *volume, u32 abort_code)
114+
static void afs_busy(struct afs_operation *op, u32 abort_code)
115115
{
116116
const char *m;
117117

@@ -122,7 +122,8 @@ static void afs_busy(struct afs_volume *volume, u32 abort_code)
122122
default: m = "busy"; break;
123123
}
124124

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);
126127
}
127128

128129
/*
@@ -181,6 +182,10 @@ bool afs_select_fileserver(struct afs_operation *op)
181182
/* Evaluate the result of the previous operation, if there was one. */
182183
switch (op->call_error) {
183184
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);
184189
op->cumul_error.responded = true;
185190

186191
/* We succeeded, but we may need to redo the op from another
@@ -314,9 +319,11 @@ bool afs_select_fileserver(struct afs_operation *op)
314319
* expected to come back but it might take a long time (could be
315320
* days).
316321
*/
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);
320327
}
321328
if (op->flags & AFS_OPERATION_NO_VSLEEP) {
322329
afs_op_set_error(op, -EADV);
@@ -343,9 +350,11 @@ bool afs_select_fileserver(struct afs_operation *op)
343350
afs_op_set_error(op, -EBUSY);
344351
goto failed;
345352
}
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);
349358
}
350359
busy:
351360
if (op->flags & AFS_OPERATION_CUR_ONLY) {
@@ -426,8 +435,10 @@ bool afs_select_fileserver(struct afs_operation *op)
426435
default:
427436
afs_op_accumulate_error(op, error, abort_code);
428437
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);
431442
goto failed;
432443
}
433444

0 commit comments

Comments
 (0)