Commit b0ef9647 authored by Trond Myklebust's avatar Trond Myklebust

NFSv4.1: Be conservative about the client highest slotid

If the server sends us a target that looks like an outlier, but
is lower than the existing target, then respect it anyway.
However defer actually updating the generation counter until
we get a target that doesn't look like an outlier.
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent 85563073
...@@ -273,20 +273,28 @@ void nfs41_wake_slot_table(struct nfs4_slot_table *tbl) ...@@ -273,20 +273,28 @@ void nfs41_wake_slot_table(struct nfs4_slot_table *tbl)
} }
} }
static void nfs41_set_max_slotid_locked(struct nfs4_slot_table *tbl,
u32 target_highest_slotid)
{
u32 max_slotid;
max_slotid = min(NFS4_MAX_SLOT_TABLE - 1, target_highest_slotid);
if (max_slotid > tbl->server_highest_slotid)
max_slotid = tbl->server_highest_slotid;
if (max_slotid > tbl->target_highest_slotid)
max_slotid = tbl->target_highest_slotid;
tbl->max_slotid = max_slotid;
nfs41_wake_slot_table(tbl);
}
/* Update the client's idea of target_highest_slotid */ /* Update the client's idea of target_highest_slotid */
static void nfs41_set_target_slotid_locked(struct nfs4_slot_table *tbl, static void nfs41_set_target_slotid_locked(struct nfs4_slot_table *tbl,
u32 target_highest_slotid) u32 target_highest_slotid)
{ {
unsigned int max_slotid;
if (tbl->target_highest_slotid == target_highest_slotid) if (tbl->target_highest_slotid == target_highest_slotid)
return; return;
tbl->target_highest_slotid = target_highest_slotid; tbl->target_highest_slotid = target_highest_slotid;
tbl->generation++; tbl->generation++;
max_slotid = min(NFS4_MAX_SLOT_TABLE - 1, tbl->target_highest_slotid);
tbl->max_slotid = max_slotid;
nfs41_wake_slot_table(tbl);
} }
void nfs41_set_target_slotid(struct nfs4_slot_table *tbl, void nfs41_set_target_slotid(struct nfs4_slot_table *tbl,
...@@ -296,6 +304,7 @@ void nfs41_set_target_slotid(struct nfs4_slot_table *tbl, ...@@ -296,6 +304,7 @@ void nfs41_set_target_slotid(struct nfs4_slot_table *tbl,
nfs41_set_target_slotid_locked(tbl, target_highest_slotid); nfs41_set_target_slotid_locked(tbl, target_highest_slotid);
tbl->d_target_highest_slotid = 0; tbl->d_target_highest_slotid = 0;
tbl->d2_target_highest_slotid = 0; tbl->d2_target_highest_slotid = 0;
nfs41_set_max_slotid_locked(tbl, target_highest_slotid);
spin_unlock(&tbl->slot_tbl_lock); spin_unlock(&tbl->slot_tbl_lock);
} }
...@@ -370,6 +379,7 @@ void nfs41_update_target_slotid(struct nfs4_slot_table *tbl, ...@@ -370,6 +379,7 @@ void nfs41_update_target_slotid(struct nfs4_slot_table *tbl,
nfs41_set_target_slotid_locked(tbl, res->sr_target_highest_slotid); nfs41_set_target_slotid_locked(tbl, res->sr_target_highest_slotid);
if (tbl->generation == slot->generation) if (tbl->generation == slot->generation)
nfs41_set_server_slotid_locked(tbl, res->sr_highest_slotid); nfs41_set_server_slotid_locked(tbl, res->sr_highest_slotid);
nfs41_set_max_slotid_locked(tbl, res->sr_target_highest_slotid);
spin_unlock(&tbl->slot_tbl_lock); spin_unlock(&tbl->slot_tbl_lock);
} }
......
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