Skip to content

Commit

Permalink
Merge tag 'afs-fixes-20200424' of git://git.kernel.org/pub/scm/linux/…
Browse files Browse the repository at this point in the history
…kernel/git/dhowells/linux-fs

Pull misc AFS fixes from David Howells:
 "Three miscellaneous fixes to the afs filesystem:

   - Remove some struct members that aren't used, aren't set or aren't
     read, plus a wake up that nothing ever waits for.

   - Actually set the AFS_SERVER_FL_HAVE_EPOCH flag so that the code
     that depends on it can work.

   - Make a couple of waits uninterruptible if they're done for an
     operation that isn't supposed to be interruptible"

* tag 'afs-fixes-20200424' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs:
  afs: Make record checking use TASK_UNINTERRUPTIBLE when appropriate
  afs: Fix to actually set AFS_SERVER_FL_HAVE_EPOCH
  afs: Remove some unused bits
  • Loading branch information
torvalds committed Apr 24, 2020
2 parents b4ecf26 + c4bfda1 commit 9a19562
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 21 deletions.
2 changes: 1 addition & 1 deletion fs/afs/cmservice.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ static int afs_record_cm_probe(struct afs_call *call, struct afs_server *server)

spin_lock(&server->probe_lock);

if (!test_bit(AFS_SERVER_FL_HAVE_EPOCH, &server->flags)) {
if (!test_and_set_bit(AFS_SERVER_FL_HAVE_EPOCH, &server->flags)) {
server->cm_epoch = call->epoch;
server->probe.cm_epoch = call->epoch;
goto out;
Expand Down
5 changes: 1 addition & 4 deletions fs/afs/fs_probe.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,8 @@ void afs_fileserver_probe_result(struct afs_call *call)
(unsigned int)rtt, ret);

have_result |= afs_fs_probe_done(server);
if (have_result) {
server->probe.have_result = true;
wake_up_var(&server->probe.have_result);
if (have_result)
wake_up_all(&server->probe_wq);
}
}

/*
Expand Down
4 changes: 1 addition & 3 deletions fs/afs/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -533,12 +533,10 @@ struct afs_server {
u32 abort_code;
u32 cm_epoch;
short error;
bool have_result;
bool responded:1;
bool is_yfs:1;
bool not_yfs:1;
bool local_failure:1;
bool no_epoch:1;
bool cm_probed:1;
bool said_rebooted:1;
bool said_inconsistent:1;
Expand Down Expand Up @@ -1335,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_deactivate_volume(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
Expand Down
6 changes: 3 additions & 3 deletions fs/afs/rotate.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ bool afs_select_fileserver(struct afs_fs_cursor *fc)
write_unlock(&vnode->volume->servers_lock);

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)
goto failed_set_error;

Expand Down Expand Up @@ -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_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)
goto failed_set_error;

Expand Down Expand Up @@ -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
* 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)
goto failed_set_error;

Expand Down
7 changes: 2 additions & 5 deletions fs/afs/server.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
TASK_INTERRUPTIBLE);
(fc->flags & AFS_FS_CURSOR_INTR) ?
TASK_INTERRUPTIBLE : TASK_UNINTERRUPTIBLE);
if (ret == -ERESTARTSYS) {
if (!(fc->flags & AFS_FS_CURSOR_INTR) && server->addresses) {
_leave(" = t [intr]");
return true;
}
fc->error = ret;
_leave(" = f [intr]");
return false;
Expand Down
4 changes: 2 additions & 2 deletions fs/afs/vl_rotate.c
Original file line number Diff line number Diff line change
Expand Up @@ -302,8 +302,8 @@ static void afs_vl_dump_edestaddrreq(const struct afs_vl_cursor *vc)
pr_notice("VC: - nr=%u/%u/%u pf=%u\n",
a->nr_ipv4, a->nr_addrs, a->max_addrs,
a->preferred);
pr_notice("VC: - pr=%lx R=%lx F=%lx\n",
a->probed, a->responded, a->failed);
pr_notice("VC: - R=%lx F=%lx\n",
a->responded, a->failed);
if (a == vc->ac.alist)
pr_notice("VC: - current\n");
}
Expand Down
8 changes: 5 additions & 3 deletions fs/afs/volume.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
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();
int ret, retries = 0;
Expand All @@ -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)) {
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_UPDATING, &volume->flags);
wake_up_bit(&volume->flags, AFS_VOLUME_WAIT);
Expand All @@ -312,7 +312,9 @@ int afs_check_volume_status(struct afs_volume *volume, struct key *key)
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) {
_leave(" = %d", ret);
return ret;
Expand Down

0 comments on commit 9a19562

Please sign in to comment.