Commit c4bfda16 authored by David Howells's avatar David Howells

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: d2ddc776 ("afs: Overhaul volume and server record caching and fileserver rotation")
Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
parent 69cf3978
...@@ -1333,7 +1333,7 @@ extern struct afs_volume *afs_create_volume(struct afs_fs_context *); ...@@ -1333,7 +1333,7 @@ extern struct afs_volume *afs_create_volume(struct afs_fs_context *);
extern void afs_activate_volume(struct afs_volume *); extern void afs_activate_volume(struct afs_volume *);
extern void afs_deactivate_volume(struct afs_volume *); extern void afs_deactivate_volume(struct afs_volume *);
extern void afs_put_volume(struct afs_cell *, struct afs_volume *); extern void afs_put_volume(struct afs_cell *, struct afs_volume *);
extern int afs_check_volume_status(struct afs_volume *, struct key *); extern int afs_check_volume_status(struct afs_volume *, struct afs_fs_cursor *);
/* /*
* write.c * write.c
......
...@@ -192,7 +192,7 @@ bool afs_select_fileserver(struct afs_fs_cursor *fc) ...@@ -192,7 +192,7 @@ bool afs_select_fileserver(struct afs_fs_cursor *fc)
write_unlock(&vnode->volume->servers_lock); write_unlock(&vnode->volume->servers_lock);
set_bit(AFS_VOLUME_NEEDS_UPDATE, &vnode->volume->flags); set_bit(AFS_VOLUME_NEEDS_UPDATE, &vnode->volume->flags);
error = afs_check_volume_status(vnode->volume, fc->key); error = afs_check_volume_status(vnode->volume, fc);
if (error < 0) if (error < 0)
goto failed_set_error; goto failed_set_error;
...@@ -281,7 +281,7 @@ bool afs_select_fileserver(struct afs_fs_cursor *fc) ...@@ -281,7 +281,7 @@ bool afs_select_fileserver(struct afs_fs_cursor *fc)
set_bit(AFS_VOLUME_WAIT, &vnode->volume->flags); set_bit(AFS_VOLUME_WAIT, &vnode->volume->flags);
set_bit(AFS_VOLUME_NEEDS_UPDATE, &vnode->volume->flags); set_bit(AFS_VOLUME_NEEDS_UPDATE, &vnode->volume->flags);
error = afs_check_volume_status(vnode->volume, fc->key); error = afs_check_volume_status(vnode->volume, fc);
if (error < 0) if (error < 0)
goto failed_set_error; goto failed_set_error;
...@@ -341,7 +341,7 @@ bool afs_select_fileserver(struct afs_fs_cursor *fc) ...@@ -341,7 +341,7 @@ bool afs_select_fileserver(struct afs_fs_cursor *fc)
/* See if we need to do an update of the volume record. Note that the /* See if we need to do an update of the volume record. Note that the
* volume may have moved or even have been deleted. * volume may have moved or even have been deleted.
*/ */
error = afs_check_volume_status(vnode->volume, fc->key); error = afs_check_volume_status(vnode->volume, fc);
if (error < 0) if (error < 0)
goto failed_set_error; goto failed_set_error;
......
...@@ -594,12 +594,9 @@ bool afs_check_server_record(struct afs_fs_cursor *fc, struct afs_server *server ...@@ -594,12 +594,9 @@ bool afs_check_server_record(struct afs_fs_cursor *fc, struct afs_server *server
} }
ret = wait_on_bit(&server->flags, AFS_SERVER_FL_UPDATING, ret = wait_on_bit(&server->flags, AFS_SERVER_FL_UPDATING,
TASK_INTERRUPTIBLE); (fc->flags & AFS_FS_CURSOR_INTR) ?
TASK_INTERRUPTIBLE : TASK_UNINTERRUPTIBLE);
if (ret == -ERESTARTSYS) { if (ret == -ERESTARTSYS) {
if (!(fc->flags & AFS_FS_CURSOR_INTR) && server->addresses) {
_leave(" = t [intr]");
return true;
}
fc->error = ret; fc->error = ret;
_leave(" = f [intr]"); _leave(" = f [intr]");
return false; return false;
......
...@@ -281,7 +281,7 @@ static int afs_update_volume_status(struct afs_volume *volume, struct key *key) ...@@ -281,7 +281,7 @@ static int afs_update_volume_status(struct afs_volume *volume, struct key *key)
/* /*
* Make sure the volume record is up to date. * Make sure the volume record is up to date.
*/ */
int afs_check_volume_status(struct afs_volume *volume, struct key *key) int afs_check_volume_status(struct afs_volume *volume, struct afs_fs_cursor *fc)
{ {
time64_t now = ktime_get_real_seconds(); time64_t now = ktime_get_real_seconds();
int ret, retries = 0; int ret, retries = 0;
...@@ -299,7 +299,7 @@ int afs_check_volume_status(struct afs_volume *volume, struct key *key) ...@@ -299,7 +299,7 @@ int afs_check_volume_status(struct afs_volume *volume, struct key *key)
} }
if (!test_and_set_bit_lock(AFS_VOLUME_UPDATING, &volume->flags)) { if (!test_and_set_bit_lock(AFS_VOLUME_UPDATING, &volume->flags)) {
ret = afs_update_volume_status(volume, key); ret = afs_update_volume_status(volume, fc->key);
clear_bit_unlock(AFS_VOLUME_WAIT, &volume->flags); clear_bit_unlock(AFS_VOLUME_WAIT, &volume->flags);
clear_bit_unlock(AFS_VOLUME_UPDATING, &volume->flags); clear_bit_unlock(AFS_VOLUME_UPDATING, &volume->flags);
wake_up_bit(&volume->flags, AFS_VOLUME_WAIT); wake_up_bit(&volume->flags, AFS_VOLUME_WAIT);
...@@ -312,7 +312,9 @@ int afs_check_volume_status(struct afs_volume *volume, struct key *key) ...@@ -312,7 +312,9 @@ int afs_check_volume_status(struct afs_volume *volume, struct key *key)
return 0; return 0;
} }
ret = wait_on_bit(&volume->flags, AFS_VOLUME_WAIT, TASK_INTERRUPTIBLE); ret = wait_on_bit(&volume->flags, AFS_VOLUME_WAIT,
(fc->flags & AFS_FS_CURSOR_INTR) ?
TASK_INTERRUPTIBLE : TASK_UNINTERRUPTIBLE);
if (ret == -ERESTARTSYS) { if (ret == -ERESTARTSYS) {
_leave(" = %d", ret); _leave(" = %d", ret);
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment