Skip to content

Commit c4bfda1

Browse files
committed
afs: Make record checking use TASK_UNINTERRUPTIBLE when appropriate
When an operation is meant to be done uninterruptibly (such as FS.StoreData), we should not be allowing volume and server record checking to be interrupted. Fixes: d2ddc77 ("afs: Overhaul volume and server record caching and fileserver rotation") Signed-off-by: David Howells <[email protected]>
1 parent 69cf397 commit c4bfda1

File tree

4 files changed

+11
-12
lines changed

4 files changed

+11
-12
lines changed

fs/afs/internal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1333,7 +1333,7 @@ extern struct afs_volume *afs_create_volume(struct afs_fs_context *);
13331333
extern void afs_activate_volume(struct afs_volume *);
13341334
extern void afs_deactivate_volume(struct afs_volume *);
13351335
extern void afs_put_volume(struct afs_cell *, struct afs_volume *);
1336-
extern int afs_check_volume_status(struct afs_volume *, struct key *);
1336+
extern int afs_check_volume_status(struct afs_volume *, struct afs_fs_cursor *);
13371337

13381338
/*
13391339
* write.c

fs/afs/rotate.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ bool afs_select_fileserver(struct afs_fs_cursor *fc)
192192
write_unlock(&vnode->volume->servers_lock);
193193

194194
set_bit(AFS_VOLUME_NEEDS_UPDATE, &vnode->volume->flags);
195-
error = afs_check_volume_status(vnode->volume, fc->key);
195+
error = afs_check_volume_status(vnode->volume, fc);
196196
if (error < 0)
197197
goto failed_set_error;
198198

@@ -281,7 +281,7 @@ bool afs_select_fileserver(struct afs_fs_cursor *fc)
281281

282282
set_bit(AFS_VOLUME_WAIT, &vnode->volume->flags);
283283
set_bit(AFS_VOLUME_NEEDS_UPDATE, &vnode->volume->flags);
284-
error = afs_check_volume_status(vnode->volume, fc->key);
284+
error = afs_check_volume_status(vnode->volume, fc);
285285
if (error < 0)
286286
goto failed_set_error;
287287

@@ -341,7 +341,7 @@ bool afs_select_fileserver(struct afs_fs_cursor *fc)
341341
/* See if we need to do an update of the volume record. Note that the
342342
* volume may have moved or even have been deleted.
343343
*/
344-
error = afs_check_volume_status(vnode->volume, fc->key);
344+
error = afs_check_volume_status(vnode->volume, fc);
345345
if (error < 0)
346346
goto failed_set_error;
347347

fs/afs/server.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -594,12 +594,9 @@ bool afs_check_server_record(struct afs_fs_cursor *fc, struct afs_server *server
594594
}
595595

596596
ret = wait_on_bit(&server->flags, AFS_SERVER_FL_UPDATING,
597-
TASK_INTERRUPTIBLE);
597+
(fc->flags & AFS_FS_CURSOR_INTR) ?
598+
TASK_INTERRUPTIBLE : TASK_UNINTERRUPTIBLE);
598599
if (ret == -ERESTARTSYS) {
599-
if (!(fc->flags & AFS_FS_CURSOR_INTR) && server->addresses) {
600-
_leave(" = t [intr]");
601-
return true;
602-
}
603600
fc->error = ret;
604601
_leave(" = f [intr]");
605602
return false;

fs/afs/volume.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ static int afs_update_volume_status(struct afs_volume *volume, struct key *key)
281281
/*
282282
* Make sure the volume record is up to date.
283283
*/
284-
int afs_check_volume_status(struct afs_volume *volume, struct key *key)
284+
int afs_check_volume_status(struct afs_volume *volume, struct afs_fs_cursor *fc)
285285
{
286286
time64_t now = ktime_get_real_seconds();
287287
int ret, retries = 0;
@@ -299,7 +299,7 @@ int afs_check_volume_status(struct afs_volume *volume, struct key *key)
299299
}
300300

301301
if (!test_and_set_bit_lock(AFS_VOLUME_UPDATING, &volume->flags)) {
302-
ret = afs_update_volume_status(volume, key);
302+
ret = afs_update_volume_status(volume, fc->key);
303303
clear_bit_unlock(AFS_VOLUME_WAIT, &volume->flags);
304304
clear_bit_unlock(AFS_VOLUME_UPDATING, &volume->flags);
305305
wake_up_bit(&volume->flags, AFS_VOLUME_WAIT);
@@ -312,7 +312,9 @@ int afs_check_volume_status(struct afs_volume *volume, struct key *key)
312312
return 0;
313313
}
314314

315-
ret = wait_on_bit(&volume->flags, AFS_VOLUME_WAIT, TASK_INTERRUPTIBLE);
315+
ret = wait_on_bit(&volume->flags, AFS_VOLUME_WAIT,
316+
(fc->flags & AFS_FS_CURSOR_INTR) ?
317+
TASK_INTERRUPTIBLE : TASK_UNINTERRUPTIBLE);
316318
if (ret == -ERESTARTSYS) {
317319
_leave(" = %d", ret);
318320
return ret;

0 commit comments

Comments
 (0)