From: Andy Adamson <andros@xxxxxxxxxx> Signed-off-by: Andy Adamson <andros@xxxxxxxxxx> [pnfs-submit: fail init_clientid if a DS is not really a DS] Signed-off-by: Benny Halevy <bhalevy@xxxxxxxxxxx> --- fs/nfs/nfs4filelayoutdev.c | 5 ----- fs/nfs/nfs4state.c | 11 +++++++++++ 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/fs/nfs/nfs4filelayoutdev.c b/fs/nfs/nfs4filelayoutdev.c index 0059375..83b0ab8 100644 --- a/fs/nfs/nfs4filelayoutdev.c +++ b/fs/nfs/nfs4filelayoutdev.c @@ -183,11 +183,6 @@ nfs4_pnfs_ds_create(struct nfs_server *mds_srv, struct nfs4_pnfs_ds *ds) goto out_put; } /* - * Mask the (possibly) returned EXCHGID4_FLAG_USE_PNFS_MDS pNFS role - * The is_ds_only_session depends on this. - */ - clp->cl_exchange_flags &= ~EXCHGID4_FLAG_USE_PNFS_MDS; - /* * Set DS lease equal to the MDS lease, renewal is scheduled in * create_session */ diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c index 49433aa..3cdbf3b 100644 --- a/fs/nfs/nfs4state.c +++ b/fs/nfs/nfs4state.c @@ -229,6 +229,7 @@ static int nfs4_begin_drain_session(struct nfs_client *clp) int nfs41_init_clientid(struct nfs_client *clp, struct rpc_cred *cred) { int status; + u32 req_exchange_flags = clp->cl_exchange_flags; nfs4_begin_drain_session(clp); status = nfs4_proc_exchange_id(clp, cred); @@ -237,6 +238,16 @@ int nfs41_init_clientid(struct nfs_client *clp, struct rpc_cred *cred) status = nfs4_proc_create_session(clp); if (status != 0) goto out; + if (is_ds_only_session(req_exchange_flags)) { + clp->cl_exchange_flags &= + ~(EXCHGID4_FLAG_USE_PNFS_MDS | EXCHGID4_FLAG_USE_NON_PNFS); + if (!is_ds_only_session(clp->cl_exchange_flags)) { + nfs4_destroy_session(clp->cl_session); + clp->cl_session = NULL; + status = -ENOTSUPP; + goto out; + } + } nfs41_setup_state_renewal(clp); nfs_mark_client_ready(clp, NFS_CS_READY); out: -- 1.6.6 -- 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