On Thu, Mar 15, 2012 at 8:35 PM, Myklebust, Trond <Trond.Myklebust@xxxxxxxxxx> wrote: > On Thu, 2012-03-15 at 14:40 -0400, andros@xxxxxxxxxx wrote: >> From: Andy Adamson <andros@xxxxxxxxxx> >> >> When the last DS io is processed, the data server client record will be >> freed. >> >> Signed-off-by: Andy Adamson <andros@xxxxxxxxxx> >> --- >> fs/nfs/nfs4filelayout.c | 4 ++++ >> fs/nfs/nfs4filelayout.h | 1 + >> fs/nfs/nfs4filelayoutdev.c | 17 +++++++++++++++++ >> 3 files changed, 22 insertions(+), 0 deletions(-) >> >> diff --git a/fs/nfs/nfs4filelayout.c b/fs/nfs/nfs4filelayout.c >> index 4c846cb..28b71bf 100644 >> --- a/fs/nfs/nfs4filelayout.c >> +++ b/fs/nfs/nfs4filelayout.c >> @@ -209,10 +209,12 @@ static int filelayout_read_done_cb(struct rpc_task *task, >> reset, data->ds_clp, data->ds_clp->cl_session); >> >> if (test_bit(NFS4_RESET_TO_MDS, &reset)) { >> + struct nfs_client *clp = data->ds_clp; >> filelayout_reset_read(task, data); >> if (test_bit(NFS4_RESET_DEVICEID, &reset)) { >> filelayout_mark_devid_invalid(devid); >> rpc_drain_queue(&tbl->slot_tbl_waitq); >> + nfs4_ds_disconnect(clp); >> } >> } >> rpc_restart_call_prepare(task); >> @@ -310,10 +312,12 @@ static int filelayout_write_done_cb(struct rpc_task *task, >> reset, data->ds_clp, data->ds_clp->cl_session); >> >> if (test_bit(NFS4_RESET_TO_MDS, &reset)) { >> + struct nfs_client *clp = data->ds_clp; >> filelayout_reset_write(task, data); >> if (test_bit(NFS4_RESET_DEVICEID, &reset)) { >> filelayout_mark_devid_invalid(devid); >> rpc_drain_queue(&tbl->slot_tbl_waitq); >> + nfs4_ds_disconnect(clp); > > What guarantees at this point that all the RPC calls have terminated? That is not the intention of the call to nfs4_ds_disconnect. What is guaranteed is: 1) there are no more new calls using the DS session due to the invalid deviceid. 2) all calls (including outstanding calls) have a reference to the DS nfs_client 3) once the last outstanding call has been processed and it's nfs_put_client has been called, because of the nfs_put_client call in nfs4_ds_disconnect, the DS nfs_client is freed. > > > -- > Trond Myklebust > Linux NFS client maintainer > > NetApp > Trond.Myklebust@xxxxxxxxxx > www.netapp.com > -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html