]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
NFS: Use nfs4_setup_sequence() everywhere
authorAnna Schumaker <Anna.Schumaker@Netapp.com>
Mon, 9 Jan 2017 21:51:52 +0000 (16:51 -0500)
committerAnna Schumaker <Anna.Schumaker@Netapp.com>
Mon, 30 Jan 2017 18:14:50 +0000 (13:14 -0500)
This does the right thing depending on if we have a session, rather than
needing to handle this manually in multiple places.

Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
fs/nfs/filelayout/filelayout.c
fs/nfs/flexfilelayout/flexfilelayout.c
fs/nfs/nfs42proc.c
fs/nfs/nfs4_fs.h
fs/nfs/nfs4proc.c

index a3fc48ba4931d7a25c56077ac114ef279eaa4f3a..7aff350f15b1ced36e751ffd4574d91eea0a76a3 100644 (file)
@@ -305,7 +305,7 @@ static void filelayout_read_prepare(struct rpc_task *task, void *data)
        }
        hdr->pgio_done_cb = filelayout_read_done_cb;
 
-       if (nfs41_setup_sequence(hdr->ds_clp->cl_session,
+       if (nfs4_setup_sequence(hdr->ds_clp,
                        &hdr->args.seq_args,
                        &hdr->res.seq_res,
                        task))
@@ -403,7 +403,7 @@ static void filelayout_write_prepare(struct rpc_task *task, void *data)
                rpc_exit(task, 0);
                return;
        }
-       if (nfs41_setup_sequence(hdr->ds_clp->cl_session,
+       if (nfs4_setup_sequence(hdr->ds_clp,
                        &hdr->args.seq_args,
                        &hdr->res.seq_res,
                        task))
@@ -438,7 +438,7 @@ static void filelayout_commit_prepare(struct rpc_task *task, void *data)
 {
        struct nfs_commit_data *wdata = data;
 
-       nfs41_setup_sequence(wdata->ds_clp->cl_session,
+       nfs4_setup_sequence(wdata->ds_clp,
                        &wdata->args.seq_args,
                        &wdata->res.seq_res,
                        task);
index 0ca4af8cca5d89f9d0ecb4d164c5164a62585b4f..cc9064974104503babf5a9df79563d95cf24b50e 100644 (file)
@@ -1384,30 +1384,14 @@ static void ff_layout_read_prepare_v3(struct rpc_task *task, void *data)
        rpc_call_start(task);
 }
 
-static int ff_layout_setup_sequence(struct nfs_client *ds_clp,
-                                   struct nfs4_sequence_args *args,
-                                   struct nfs4_sequence_res *res,
-                                   struct rpc_task *task)
-{
-       if (ds_clp->cl_session)
-               return nfs41_setup_sequence(ds_clp->cl_session,
-                                          args,
-                                          res,
-                                          task);
-       return nfs40_setup_sequence(ds_clp->cl_slot_tbl,
-                                  args,
-                                  res,
-                                  task);
-}
-
 static void ff_layout_read_prepare_v4(struct rpc_task *task, void *data)
 {
        struct nfs_pgio_header *hdr = data;
 
-       if (ff_layout_setup_sequence(hdr->ds_clp,
-                                    &hdr->args.seq_args,
-                                    &hdr->res.seq_res,
-                                    task))
+       if (nfs4_setup_sequence(hdr->ds_clp,
+                               &hdr->args.seq_args,
+                               &hdr->res.seq_res,
+                               task))
                return;
 
        if (ff_layout_read_prepare_common(task, hdr))
@@ -1578,10 +1562,10 @@ static void ff_layout_write_prepare_v4(struct rpc_task *task, void *data)
 {
        struct nfs_pgio_header *hdr = data;
 
-       if (ff_layout_setup_sequence(hdr->ds_clp,
-                                    &hdr->args.seq_args,
-                                    &hdr->res.seq_res,
-                                    task))
+       if (nfs4_setup_sequence(hdr->ds_clp,
+                               &hdr->args.seq_args,
+                               &hdr->res.seq_res,
+                               task))
                return;
 
        if (ff_layout_write_prepare_common(task, hdr))
@@ -1667,10 +1651,10 @@ static void ff_layout_commit_prepare_v4(struct rpc_task *task, void *data)
 {
        struct nfs_commit_data *wdata = data;
 
-       if (ff_layout_setup_sequence(wdata->ds_clp,
-                                &wdata->args.seq_args,
-                                &wdata->res.seq_res,
-                                task))
+       if (nfs4_setup_sequence(wdata->ds_clp,
+                               &wdata->args.seq_args,
+                               &wdata->res.seq_res,
+                               task))
                return;
        ff_layout_commit_prepare_common(task, data);
 }
index b03010eebafd3eca352fb293a3445b80bb778e39..98cf58341066fec824a147372a08333ba2817f6c 100644 (file)
@@ -332,8 +332,8 @@ nfs42_layoutstat_prepare(struct rpc_task *task, void *calldata)
        }
        nfs4_stateid_copy(&data->args.stateid, &lo->plh_stateid);
        spin_unlock(&inode->i_lock);
-       nfs41_setup_sequence(nfs4_get_session(server->nfs_client),
-                            &data->args.seq_args, &data->res.seq_res, task);
+       nfs4_setup_sequence(server->nfs_client, &data->args.seq_args,
+                           &data->res.seq_res, task);
 }
 
 static void
index 04ffea093d56bb4fbd693ff2f5f632bd6dfec240..af285cc27ccf8c8457dee080cccbf75df77f0fcb 100644 (file)
@@ -273,9 +273,6 @@ extern int nfs4_set_rw_stateid(nfs4_stateid *stateid,
                fmode_t fmode);
 
 #if defined(CONFIG_NFS_V4_1)
-extern int nfs41_setup_sequence(struct nfs4_session *session,
-               struct nfs4_sequence_args *args, struct nfs4_sequence_res *res,
-               struct rpc_task *task);
 extern int nfs41_sequence_done(struct rpc_task *, struct nfs4_sequence_res *);
 extern int nfs4_proc_create_session(struct nfs_client *, struct rpc_cred *);
 extern int nfs4_proc_destroy_session(struct nfs4_session *, struct rpc_cred *);
@@ -456,7 +453,7 @@ extern void nfs_increment_open_seqid(int status, struct nfs_seqid *seqid);
 extern void nfs_increment_lock_seqid(int status, struct nfs_seqid *seqid);
 extern void nfs_release_seqid(struct nfs_seqid *seqid);
 extern void nfs_free_seqid(struct nfs_seqid *seqid);
-extern int nfs40_setup_sequence(struct nfs4_slot_table *tbl,
+extern int nfs4_setup_sequence(const struct nfs_client *client,
                                struct nfs4_sequence_args *args,
                                struct nfs4_sequence_res *res,
                                struct rpc_task *task);
index f62d58cb30145a6f0b82abbe2ca3d8cc3adfb27a..4ced1c964b1e9129b981097a8b232262fc5871fd 100644 (file)
@@ -622,10 +622,10 @@ static void nfs4_set_sequence_privileged(struct nfs4_sequence_args *args)
        args->sa_privileged = 1;
 }
 
-int nfs40_setup_sequence(struct nfs4_slot_table *tbl,
-                        struct nfs4_sequence_args *args,
-                        struct nfs4_sequence_res *res,
-                        struct rpc_task *task)
+static int nfs40_setup_sequence(struct nfs4_slot_table *tbl,
+                               struct nfs4_sequence_args *args,
+                               struct nfs4_sequence_res *res,
+                               struct rpc_task *task)
 {
        struct nfs4_slot *slot;
 
@@ -662,7 +662,6 @@ out_sleep:
        spin_unlock(&tbl->slot_tbl_lock);
        return -EAGAIN;
 }
-EXPORT_SYMBOL_GPL(nfs40_setup_sequence);
 
 static void nfs40_sequence_free_slot(struct nfs4_sequence_res *res)
 {
@@ -882,7 +881,7 @@ int nfs4_sequence_done(struct rpc_task *task, struct nfs4_sequence_res *res)
 }
 EXPORT_SYMBOL_GPL(nfs4_sequence_done);
 
-int nfs41_setup_sequence(struct nfs4_session *session,
+static int nfs41_setup_sequence(struct nfs4_session *session,
                                struct nfs4_sequence_args *args,
                                struct nfs4_sequence_res *res,
                                struct rpc_task *task)
@@ -945,12 +944,11 @@ out_sleep:
        spin_unlock(&tbl->slot_tbl_lock);
        return -EAGAIN;
 }
-EXPORT_SYMBOL_GPL(nfs41_setup_sequence);
 
-static int nfs4_setup_sequence(const struct nfs_client *client,
-                              struct nfs4_sequence_args *args,
-                              struct nfs4_sequence_res *res,
-                              struct rpc_task *task)
+int nfs4_setup_sequence(const struct nfs_client *client,
+                       struct nfs4_sequence_args *args,
+                       struct nfs4_sequence_res *res,
+                       struct rpc_task *task)
 {
        struct nfs4_session *session = nfs4_get_session(client);
        int ret = 0;
@@ -968,6 +966,7 @@ static int nfs4_setup_sequence(const struct nfs_client *client,
        dprintk("<-- %s status=%d\n", __func__, ret);
        return ret;
 }
+EXPORT_SYMBOL_GPL(nfs4_setup_sequence);
 
 static void nfs41_call_sync_prepare(struct rpc_task *task, void *calldata)
 {
@@ -993,13 +992,14 @@ static const struct rpc_call_ops nfs41_call_sync_ops = {
 
 #else  /* !CONFIG_NFS_V4_1 */
 
-static int nfs4_setup_sequence(const struct nfs_client *client,
-                              struct nfs4_sequence_args *args,
-                              struct nfs4_sequence_res *res,
-                              struct rpc_task *task)
+int nfs4_setup_sequence(const struct nfs_client *client,
+                       struct nfs4_sequence_args *args,
+                       struct nfs4_sequence_res *res,
+                       struct rpc_task *task)
 {
        return nfs40_setup_sequence(client->cl_slot_tbl, args, res, task);
 }
+EXPORT_SYMBOL_GPL(nfs4_setup_sequence);
 
 static int nfs4_sequence_process(struct rpc_task *task, struct nfs4_sequence_res *res)
 {