2010-06-17 14:47:08

by Benny Halevy

[permalink] [raw]
Subject: [PATCH 0/19]: merge pnfs client ops into nfs4's

The following patchset folds the pnfs client ops into their
nfs4 counterparts.

Note that the pnfs implementation forked off of old versions
of the nfs ops but we failed to update the pnfs implementation
when the original code they were derived from changed so the
current state captures an unintentional deviation.

Merging back the code ensures that the common paths are
correctly used and we deal only with the pnfs-specific
functionality.

This solves the bug where we were using two client structures when
mounting the server more than once and seeing the session destroyed
repeatedly (and the server returning 10052 on DESTROY_SESSION) and
eventually hitting the session recovery deadlock reported here:
http://marc.info/?l=linux-nfs&m=127663654927724&w=2

Here's the list of patches:
[PATCH 01/19] SQUASHME: pnfs-submit: merge pnfs4_proc_setattr into nfs4_proc_setattr
[PATCH 02/19] SQUASHME: pnfs4_read_done status variable is unused
[PATCH 03/19] SQUASHME: pnfs-submit: optionally pass nfs_client to nfs4_async_handle_error
[PATCH 04/19] SQUASHME: pnfs-submit: merge pnfs4_read_done into nfs4_read_done - part 1
[PATCH 05/19] SQUASHME: pnfs-submit: merge pnfs4_read_done into nfs4_read_done - part 2
[PATCH 06/19] SQUASHME: pnfs-submit: merge pnfs4_read_done into nfs4_read_done - part 3
[PATCH 07/19] SQUASHME: pnfs-submit: get rid of pnfs4_read_done
[PATCH 08/19] SQUASHME: pnfs-submit: merge pnfs4_write_done into nfs4_write_done - part 1
[PATCH 09/19] SQUASHME: pnfs-submit: merge pnfs4_write_done into nfs4_write_done - part 2
[PATCH 10/19] SQUASHME: pnfs-submit: merge pnfs4_write_done into nfs4_write_done - part 3
[PATCH 11/19] SQUASHME: pnfs-submit: merge pnfs4_write_done into nfs4_write_done - part 4
[PATCH 12/19] SQUASHME: pnfs-submit: get rid of pnfs4_write_done
[PATCH 13/19] SQUASHME: pnfs-submit: merge pnfs4_commit_done into nfs4_commit_done - part 1
[PATCH 14/19] SQUASHME: pnfs-submit: merge pnfs4_commit_done into nfs4_commit_done - part 2
[PATCH 15/19] SQUASHME: pnfs-submit: merge pnfs4_commit_done into nfs4_commit_done - part 3
[PATCH 16/19] SQUASHME: pnfs-submit: get rid of pnfs4_commit_done
[PATCH 17/19] SQUASHME: pnfs-submit: merge pnfs4_proc_write_setup into nfs4_proc_write_setup
[PATCH 18/19] SQUASHME: pnfs-submit: merge pnfs4_proc_commit_setup into nfs4_proc_commit_setup
[PATCH 19/19] SQUASHME: pnfs-submit: get rid of pnfs_v4_clientops


2010-06-17 15:15:02

by Fred Isaman

[permalink] [raw]
Subject: Re: [PATCH 06/19] SQUASHME: pnfs-submit: merge pnfs4_read_done into nfs4_read_done - part 3

On Thu, Jun 17, 2010 at 10:49 AM, Benny Halevy <[email protected]> wr=
ote:
> Do not renew the data server lease.
>
> Signed-off-by: Benny Halevy <[email protected]>
> ---
> =A0fs/nfs/nfs4proc.c | =A0 =A02 +-
> =A01 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
> index 77b7182..e8b0f33 100644
> --- a/fs/nfs/nfs4proc.c
> +++ b/fs/nfs/nfs4proc.c
> @@ -3164,7 +3164,7 @@ static int nfs4_read_done(struct rpc_task *task=
, struct nfs_read_data *data)
> =A0 =A0 =A0 =A0}
>
> =A0 =A0 =A0 =A0nfs_invalidate_atime(data->inode);
> - =A0 =A0 =A0 if (task->tk_status > 0)
> + =A0 =A0 =A0 if (task->tk_status > 0 && client =3D=3D server->nfs_cl=
ient)

Will this test work if there is a dual role MDS/DS?

=46red

> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0renew_lease(server, data->timestamp);
> =A0 =A0 =A0 =A0return 0;
> =A0}
> --
> 1.6.4.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-nfs" =
in
> the body of a message to [email protected]
> More majordomo info at =A0http://vger.kernel.org/majordomo-info.html
>

2010-06-17 15:19:48

by Fred Isaman

[permalink] [raw]
Subject: Re: [PATCH 09/19] SQUASHME: pnfs-submit: merge pnfs4_write_done into nfs4_write_done - part 2

On Thu, Jun 17, 2010 at 10:49 AM, Benny Halevy <[email protected]> wr=
ote:
> PNFS_NO_RPC.
>
> Signed-off-by: Benny Halevy <[email protected]>
> ---
> =A0fs/nfs/nfs4proc.c | =A0 =A03 +++
> =A01 files changed, 3 insertions(+), 0 deletions(-)
>
> diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
> index 5948de5..fd2b588 100644
> --- a/fs/nfs/nfs4proc.c
> +++ b/fs/nfs/nfs4proc.c
> @@ -3279,6 +3279,9 @@ static int nfs4_write_done(struct rpc_task *tas=
k, struct nfs_write_data *data)
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0data->pdata.orig_count=
);
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0data->args.count =3D data->pdata.orig_=
count;
> =A0 =A0 =A0 =A0}
> +
> + =A0 =A0 =A0 if (data->pdata.pnfsflags & PNFS_NO_RPC)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return 0;
> =A0#endif /* CONFIG_NFS_V4_1 */

Again, this is is a post-submit patch

=46red

>
> =A0 =A0 =A0 =A0nfs4_sequence_done(NFS_SERVER(inode), &data->res.seq_r=
es,
> --
> 1.6.4.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-nfs" =
in
> the body of a message to [email protected]
> More majordomo info at =A0http://vger.kernel.org/majordomo-info.html
>

2010-06-17 14:48:13

by Benny Halevy

[permalink] [raw]
Subject: [PATCH 01/19] SQUASHME: pnfs-submit: merge pnfs4_proc_setattr into nfs4_proc_setattr

Signed-off-by: Benny Halevy <[email protected]>
---
fs/nfs/nfs4proc.c | 35 +++++++++++++++--------------------
1 files changed, 15 insertions(+), 20 deletions(-)

diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 8c02296..17a2597 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -2333,6 +2333,19 @@ static int nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle,
return err;
}

+static void
+pnfs4_return_layout_on_setattr(struct inode *inode)
+{
+#ifdef CONFIG_NFS_V4_1
+ struct nfs_server *server = NFS_SERVER(inode);
+ struct nfs_inode *nfsi = NFS_I(inode);
+
+ if (pnfs_enabled_sb(server) && has_layout(nfsi) &&
+ pnfs_ld_layoutret_on_setattr(server->pnfs_curr_ld))
+ pnfs_return_layout(inode, NULL, NULL, RETURN_FILE, true);
+#endif /* CONFIG_NFS_V4_1 */
+}
+
/*
* The file is not closed if it is opened due to the a request to change
* the size of the file. The open call will not be needed once the
@@ -2359,6 +2372,8 @@ nfs4_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr,
struct nfs4_state *state = NULL;
int status;

+ pnfs4_return_layout_on_setattr(inode);
+
nfs_fattr_init(fattr);

/* Search for an existing open(O_WRITE) file */
@@ -2378,25 +2393,6 @@ nfs4_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr,
return status;
}

-#ifdef CONFIG_NFS_V4_1
-/*
- * Return layout before issueing a setattr
- */
-static int
-pnfs4_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr,
- struct iattr *sattr)
-{
- struct inode *inode = dentry->d_inode;
- struct nfs_server *server = NFS_SERVER(inode);
- struct nfs_inode *nfsi = NFS_I(inode);
-
- if (pnfs_enabled_sb(server) && has_layout(nfsi) &&
- pnfs_ld_layoutret_on_setattr(server->pnfs_curr_ld))
- pnfs_return_layout(inode, NULL, NULL, RETURN_FILE, true);
- return nfs4_proc_setattr(dentry, fattr, sattr);
-}
-#endif /* CONFIG_NFS_V4_1 */
-
static int _nfs4_proc_lookupfh(struct nfs_server *server, const struct nfs_fh *dirfh,
const struct qstr *name, struct nfs_fh *fhandle,
struct nfs_fattr *fattr)
@@ -6068,7 +6064,6 @@ pnfs_v4_clientops_init(void)
struct nfs_rpc_ops *p = (struct nfs_rpc_ops *)&pnfs_v4_clientops;

memcpy(p, &nfs_v4_clientops, sizeof(*p));
- p->setattr = pnfs4_proc_setattr;
p->read_done = pnfs4_read_done;
p->write_setup = pnfs4_proc_write_setup;
p->write_done = pnfs4_write_done;
--
1.6.4.4


2010-06-17 14:48:24

by Benny Halevy

[permalink] [raw]
Subject: [PATCH 02/19] SQUASHME: pnfs4_read_done status variable is unused

Signed-off-by: Benny Halevy <[email protected]>
---
fs/nfs/nfs4proc.c | 3 ---
1 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 17a2597..8ab30d5 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -3166,15 +3166,12 @@ static int pnfs4_read_done(struct rpc_task *task, struct nfs_read_data *data)
struct nfs_server *mds_svr = NFS_SERVER(data->inode);
struct nfs_client *client = mds_svr->nfs_client;
struct nfs4_session *ds_session = NULL;
- int status;

dprintk("--> %s\n", __func__);

if (data->pdata.pnfsflags & PNFS_NO_RPC)
return 0;

- status = task->tk_status >= 0 ? 0 : task->tk_status;
-
/* Is this a DS session */
if (data->fldata.ds_nfs_client) {
dprintk("%s DS read\n", __func__);
--
1.6.4.4


2010-06-17 14:48:35

by Benny Halevy

[permalink] [raw]
Subject: [PATCH 03/19] SQUASHME: pnfs-submit: optionally pass nfs_client to nfs4_async_handle_error

To overrise the server->client with the data server's nfs client.

Signed-off-by: Benny Halevy <[email protected]>
---
fs/nfs/nfs4proc.c | 22 ++++++----------------
1 files changed, 6 insertions(+), 16 deletions(-)

diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 8ab30d5..c4f707f 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -70,7 +70,7 @@ struct nfs4_opendata;
static int _nfs4_proc_open(struct nfs4_opendata *data);
static int _nfs4_recover_proc_open(struct nfs4_opendata *data);
static int nfs4_do_fsinfo(struct nfs_server *, struct nfs_fh *, struct nfs_fsinfo *);
-static int nfs4_async_handle_error(struct rpc_task *, const struct nfs_server *, struct nfs4_state *, struct nfs4_session *ds_session);
+static int nfs4_async_handle_error(struct rpc_task *, const struct nfs_server *, struct nfs4_state *, struct nfs_client *);
static int _nfs4_proc_lookup(struct inode *dir, const struct qstr *name, struct nfs_fh *fhandle, struct nfs_fattr *fattr);
static int _nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle, struct nfs_fattr *fattr);
static int nfs4_do_setattr(struct inode *inode, struct rpc_cred *cred,
@@ -3165,7 +3165,6 @@ static int pnfs4_read_done(struct rpc_task *task, struct nfs_read_data *data)
{
struct nfs_server *mds_svr = NFS_SERVER(data->inode);
struct nfs_client *client = mds_svr->nfs_client;
- struct nfs4_session *ds_session = NULL;

dprintk("--> %s\n", __func__);

@@ -3176,7 +3175,6 @@ static int pnfs4_read_done(struct rpc_task *task, struct nfs_read_data *data)
if (data->fldata.ds_nfs_client) {
dprintk("%s DS read\n", __func__);
client = data->fldata.ds_nfs_client;
- ds_session = data->fldata.ds_nfs_client->cl_session;
}

nfs41_sequence_done(&data->res.seq_res);
@@ -3187,7 +3185,7 @@ static int pnfs4_read_done(struct rpc_task *task, struct nfs_read_data *data)

/* FIXME: pass data->args.context->state to nfs4_async_handle_error
like in nfs4_read_done? */
- if (nfs4_async_handle_error(task, mds_svr, NULL, ds_session) == -EAGAIN) {
+ if (nfs4_async_handle_error(task, mds_svr, NULL, client) == -EAGAIN) {
nfs_restart_rpc(task, client);
dprintk("<-- %s status= %d\n", __func__, -EAGAIN);
return -EAGAIN;
@@ -3209,7 +3207,6 @@ static int pnfs4_write_done(struct rpc_task *task, struct nfs_write_data *data)
{
struct nfs_server *mds_svr = NFS_SERVER(data->inode);
struct nfs_client *client = mds_svr->nfs_client;
- struct nfs4_session *ds_session = NULL;

/* restore original count after retry? */
if (data->pdata.orig_count) {
@@ -3225,7 +3222,6 @@ static int pnfs4_write_done(struct rpc_task *task, struct nfs_write_data *data)
if (data->fldata.ds_nfs_client) {
dprintk("%s DS write\n", __func__);
client = data->fldata.ds_nfs_client;
- ds_session = client->cl_session;
}

nfs41_sequence_done(&data->res.seq_res);
@@ -3235,7 +3231,7 @@ static int pnfs4_write_done(struct rpc_task *task, struct nfs_write_data *data)
*/
/* FIXME: pass data->args.context->state to nfs4_async_handle_error
like in nfs4_write_done? */
- if (nfs4_async_handle_error(task, mds_svr, NULL, ds_session) == -EAGAIN) {
+ if (nfs4_async_handle_error(task, mds_svr, NULL, client) == -EAGAIN) {
nfs_restart_rpc(task, client);
dprintk("<-- %s status= %d\n", __func__, -EAGAIN);
return -EAGAIN;
@@ -3269,7 +3265,6 @@ static int pnfs4_commit_done(struct rpc_task *task, struct nfs_write_data *data)
{
struct nfs_server *mds_svr = NFS_SERVER(data->inode);
struct nfs_client *client = mds_svr->nfs_client;
- struct nfs4_session *ds_session = mds_svr->nfs_client->cl_session;

dprintk("--> %s task->tk_status %d\n", __func__, task->tk_status);

@@ -3284,7 +3279,7 @@ static int pnfs4_commit_done(struct rpc_task *task, struct nfs_write_data *data)

nfs41_sequence_done(&data->res.seq_res);

- if (nfs4_async_handle_error(task, mds_svr, NULL, ds_session) == -EAGAIN) {
+ if (nfs4_async_handle_error(task, mds_svr, NULL, client) == -EAGAIN) {
nfs_restart_rpc(task, client);
return -EAGAIN;
}
@@ -3698,14 +3693,9 @@ static int nfs4_proc_set_acl(struct inode *inode, const void *buf, size_t buflen
}

static int
-nfs4_async_handle_error(struct rpc_task *task, const struct nfs_server *server, struct nfs4_state *state, struct nfs4_session *ds_session)
+nfs4_async_handle_error(struct rpc_task *task, const struct nfs_server *server, struct nfs4_state *state, struct nfs_client *clp)
{
- struct nfs_client *clp;
-
- /* Either server or ds_session is set */
- if (ds_session)
- clp = ds_session->clp;
- else
+ if (!clp)
clp = server->nfs_client;

if (task->tk_status >= 0)
--
1.6.4.4


2010-06-17 14:48:47

by Benny Halevy

[permalink] [raw]
Subject: [PATCH 04/19] SQUASHME: pnfs-submit: merge pnfs4_read_done into nfs4_read_done - part 1

deviding into several patches to assist review

Signed-off-by: Benny Halevy <[email protected]>
---
fs/nfs/nfs4proc.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index c4f707f..a6bebbf 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -3144,6 +3144,11 @@ static int nfs4_read_done(struct rpc_task *task, struct nfs_read_data *data)

dprintk("--> %s\n", __func__);

+#ifdef CONFIG_NFS_V4_1
+ if (data->pdata.pnfsflags & PNFS_NO_RPC)
+ return 0;
+#endif /* CONFIG_NFS_V4_1 */
+
nfs4_sequence_done(server, &data->res.seq_res, task->tk_status);

if (nfs4_async_handle_error(task, server, data->args.context->state, NULL) == -EAGAIN) {
--
1.6.4.4


2010-06-17 14:48:58

by Benny Halevy

[permalink] [raw]
Subject: [PATCH 05/19] SQUASHME: pnfs-submit: merge pnfs4_read_done into nfs4_read_done - part 2

Possibly override nfs_client with ds_nfs_client

Signed-off-by: Benny Halevy <[email protected]>
---
fs/nfs/nfs4proc.c | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index a6bebbf..77b7182 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -3141,18 +3141,25 @@ static int nfs4_proc_pathconf(struct nfs_server *server, struct nfs_fh *fhandle,
static int nfs4_read_done(struct rpc_task *task, struct nfs_read_data *data)
{
struct nfs_server *server = NFS_SERVER(data->inode);
+ struct nfs_client *client = server->nfs_client;

dprintk("--> %s\n", __func__);

#ifdef CONFIG_NFS_V4_1
if (data->pdata.pnfsflags & PNFS_NO_RPC)
return 0;
+
+ /* Is this a DS session */
+ if (data->fldata.ds_nfs_client) {
+ dprintk("%s DS read\n", __func__);
+ client = data->fldata.ds_nfs_client;
+ }
#endif /* CONFIG_NFS_V4_1 */

nfs4_sequence_done(server, &data->res.seq_res, task->tk_status);

- if (nfs4_async_handle_error(task, server, data->args.context->state, NULL) == -EAGAIN) {
- nfs_restart_rpc(task, server->nfs_client);
+ if (nfs4_async_handle_error(task, server, data->args.context->state, client) == -EAGAIN) {
+ nfs_restart_rpc(task, client);
return -EAGAIN;
}

--
1.6.4.4


2010-06-17 14:49:09

by Benny Halevy

[permalink] [raw]
Subject: [PATCH 06/19] SQUASHME: pnfs-submit: merge pnfs4_read_done into nfs4_read_done - part 3

Do not renew the data server lease.

Signed-off-by: Benny Halevy <[email protected]>
---
fs/nfs/nfs4proc.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 77b7182..e8b0f33 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -3164,7 +3164,7 @@ static int nfs4_read_done(struct rpc_task *task, struct nfs_read_data *data)
}

nfs_invalidate_atime(data->inode);
- if (task->tk_status > 0)
+ if (task->tk_status > 0 && client == server->nfs_client)
renew_lease(server, data->timestamp);
return 0;
}
--
1.6.4.4


2010-06-17 14:49:20

by Benny Halevy

[permalink] [raw]
Subject: [PATCH 07/19] SQUASHME: pnfs-submit: get rid of pnfs4_read_done

Now that its funcitonality if fully merged into nfs4_read_done

Signed-off-by: Benny Halevy <[email protected]>
---
fs/nfs/nfs4proc.c | 43 -------------------------------------------
1 files changed, 0 insertions(+), 43 deletions(-)

diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index e8b0f33..6a0ab6c 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -3171,48 +3171,6 @@ static int nfs4_read_done(struct rpc_task *task, struct nfs_read_data *data)

#ifdef CONFIG_NFS_V4_1
/*
- * rpc_call_done callback for a read to the MDS or to a filelayout Data Server
- */
-static int pnfs4_read_done(struct rpc_task *task, struct nfs_read_data *data)
-{
- struct nfs_server *mds_svr = NFS_SERVER(data->inode);
- struct nfs_client *client = mds_svr->nfs_client;
-
- dprintk("--> %s\n", __func__);
-
- if (data->pdata.pnfsflags & PNFS_NO_RPC)
- return 0;
-
- /* Is this a DS session */
- if (data->fldata.ds_nfs_client) {
- dprintk("%s DS read\n", __func__);
- client = data->fldata.ds_nfs_client;
- }
-
- nfs41_sequence_done(&data->res.seq_res);
-
- /*
- * Handle async errors for both data servers and MDS communication.
- */
-
- /* FIXME: pass data->args.context->state to nfs4_async_handle_error
- like in nfs4_read_done? */
- if (nfs4_async_handle_error(task, mds_svr, NULL, client) == -EAGAIN) {
- nfs_restart_rpc(task, client);
- dprintk("<-- %s status= %d\n", __func__, -EAGAIN);
- return -EAGAIN;
- }
-
- /* Only renew lease if this was a read call to MDS */
- if (task->tk_status > 0 && !data->fldata.ds_nfs_client)
- renew_lease(mds_svr, data->timestamp);
-
- dprintk("<-- %s\n", __func__);
-
- return 0;
-}
-
-/*
* rpc_call_done callback for a write to the MDS or to a filelayout Data Server
*/
static int pnfs4_write_done(struct rpc_task *task, struct nfs_write_data *data)
@@ -6063,7 +6021,6 @@ pnfs_v4_clientops_init(void)
struct nfs_rpc_ops *p = (struct nfs_rpc_ops *)&pnfs_v4_clientops;

memcpy(p, &nfs_v4_clientops, sizeof(*p));
- p->read_done = pnfs4_read_done;
p->write_setup = pnfs4_proc_write_setup;
p->write_done = pnfs4_write_done;
p->commit_setup = pnfs4_proc_commit_setup;
--
1.6.4.4


2010-06-17 14:49:31

by Benny Halevy

[permalink] [raw]
Subject: [PATCH 08/19] SQUASHME: pnfs-submit: merge pnfs4_write_done into nfs4_write_done - part 1

restore original count after retry.

Signed-off-by: Benny Halevy <[email protected]>
---
fs/nfs/nfs4proc.c | 11 ++++++++++-
1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 6a0ab6c..5948de5 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -3271,7 +3271,16 @@ static void nfs4_proc_read_setup(struct nfs_read_data *data, struct rpc_message
static int nfs4_write_done(struct rpc_task *task, struct nfs_write_data *data)
{
struct inode *inode = data->inode;
-
+
+#ifdef CONFIG_NFS_V4_1
+ /* restore original count after retry? */
+ if (data->pdata.orig_count) {
+ dprintk("%s: restoring original count %u\n", __func__,
+ data->pdata.orig_count);
+ data->args.count = data->pdata.orig_count;
+ }
+#endif /* CONFIG_NFS_V4_1 */
+
nfs4_sequence_done(NFS_SERVER(inode), &data->res.seq_res,
task->tk_status);

--
1.6.4.4


2010-06-17 14:49:41

by Benny Halevy

[permalink] [raw]
Subject: [PATCH 09/19] SQUASHME: pnfs-submit: merge pnfs4_write_done into nfs4_write_done - part 2

PNFS_NO_RPC.

Signed-off-by: Benny Halevy <[email protected]>
---
fs/nfs/nfs4proc.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 5948de5..fd2b588 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -3279,6 +3279,9 @@ static int nfs4_write_done(struct rpc_task *task, struct nfs_write_data *data)
data->pdata.orig_count);
data->args.count = data->pdata.orig_count;
}
+
+ if (data->pdata.pnfsflags & PNFS_NO_RPC)
+ return 0;
#endif /* CONFIG_NFS_V4_1 */

nfs4_sequence_done(NFS_SERVER(inode), &data->res.seq_res,
--
1.6.4.4


2010-06-17 14:49:52

by Benny Halevy

[permalink] [raw]
Subject: [PATCH 10/19] SQUASHME: pnfs-submit: merge pnfs4_write_done into nfs4_write_done - part 3

Possibly override data server nfs_client.

Signed-off-by: Benny Halevy <[email protected]>
---
fs/nfs/nfs4proc.c | 16 ++++++++++++----
1 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index fd2b588..60898f6 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -3271,6 +3271,8 @@ static void nfs4_proc_read_setup(struct nfs_read_data *data, struct rpc_message
static int nfs4_write_done(struct rpc_task *task, struct nfs_write_data *data)
{
struct inode *inode = data->inode;
+ struct nfs_server *server = NFS_SERVER(inode);
+ struct nfs_client *client = server->nfs_client;

#ifdef CONFIG_NFS_V4_1
/* restore original count after retry? */
@@ -3282,17 +3284,23 @@ static int nfs4_write_done(struct rpc_task *task, struct nfs_write_data *data)

if (data->pdata.pnfsflags & PNFS_NO_RPC)
return 0;
+
+ /* Is this a DS session */
+ if (data->fldata.ds_nfs_client) {
+ dprintk("%s DS write\n", __func__);
+ client = data->fldata.ds_nfs_client;
+ }
#endif /* CONFIG_NFS_V4_1 */

- nfs4_sequence_done(NFS_SERVER(inode), &data->res.seq_res,
+ nfs4_sequence_done(server, &data->res.seq_res,
task->tk_status);

- if (nfs4_async_handle_error(task, NFS_SERVER(inode), data->args.context->state, NULL) == -EAGAIN) {
- nfs_restart_rpc(task, NFS_SERVER(inode)->nfs_client);
+ if (nfs4_async_handle_error(task, server, data->args.context->state, client) == -EAGAIN) {
+ nfs_restart_rpc(task, client);
return -EAGAIN;
}
if (task->tk_status >= 0) {
- renew_lease(NFS_SERVER(inode), data->timestamp);
+ renew_lease(server, data->timestamp);
nfs_post_op_update_inode_force_wcc(inode, data->res.fattr);
}
return 0;
--
1.6.4.4


2010-06-17 14:50:03

by Benny Halevy

[permalink] [raw]
Subject: [PATCH 11/19] SQUASHME: pnfs-submit: merge pnfs4_write_done into nfs4_write_done - part 4

Renew lease only for MDS writes.
Update last byte written and mark for layoutcommit for DS writes.

Signed-off-by: Benny Halevy <[email protected]>
---
fs/nfs/nfs4proc.c | 20 ++++++++++++++++++--
1 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 60898f6..7b501ec 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -3268,6 +3268,14 @@ static void nfs4_proc_read_setup(struct nfs_read_data *data, struct rpc_message
msg->rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_READ];
}

+static void pnfs4_update_write_done(struct nfs_inode *nfsi, struct nfs_write_data *data)
+{
+#ifdef CONFIG_NFS_V4_1
+ pnfs_update_last_write(nfsi, data->args.offset, data->res.count);
+ pnfs_need_layoutcommit(nfsi, data->args.context);
+#endif /* CONFIG_NFS_V4_1 */
+}
+
static int nfs4_write_done(struct rpc_task *task, struct nfs_write_data *data)
{
struct inode *inode = data->inode;
@@ -3299,9 +3307,17 @@ static int nfs4_write_done(struct rpc_task *task, struct nfs_write_data *data)
nfs_restart_rpc(task, client);
return -EAGAIN;
}
+
+ /*
+ * MDS write: renew lease
+ * DS write: update lastbyte written, mark for layout commit
+ */
if (task->tk_status >= 0) {
- renew_lease(server, data->timestamp);
- nfs_post_op_update_inode_force_wcc(inode, data->res.fattr);
+ if (client == server->nfs_client) {
+ renew_lease(server, data->timestamp);
+ nfs_post_op_update_inode_force_wcc(inode, data->res.fattr);
+ } else
+ pnfs4_update_write_done(NFS_I(inode), data);
}
return 0;
}
--
1.6.4.4


2010-06-17 14:50:14

by Benny Halevy

[permalink] [raw]
Subject: [PATCH 12/19] SQUASHME: pnfs-submit: get rid of pnfs4_write_done

Now that it's fully merged into nfs4_write_done

Signed-off-by: Benny Halevy <[email protected]>
---
fs/nfs/nfs4proc.c | 59 -----------------------------------------------------
1 files changed, 0 insertions(+), 59 deletions(-)

diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 7b501ec..5c1e680 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -3171,64 +3171,6 @@ static int nfs4_read_done(struct rpc_task *task, struct nfs_read_data *data)

#ifdef CONFIG_NFS_V4_1
/*
- * rpc_call_done callback for a write to the MDS or to a filelayout Data Server
- */
-static int pnfs4_write_done(struct rpc_task *task, struct nfs_write_data *data)
-{
- struct nfs_server *mds_svr = NFS_SERVER(data->inode);
- struct nfs_client *client = mds_svr->nfs_client;
-
- /* restore original count after retry? */
- if (data->pdata.orig_count) {
- dprintk("%s: restoring original count %u\n", __func__,
- data->pdata.orig_count);
- data->args.count = data->pdata.orig_count;
- }
-
- if (data->pdata.pnfsflags & PNFS_NO_RPC)
- return 0;
-
- /* Is this a DS session */
- if (data->fldata.ds_nfs_client) {
- dprintk("%s DS write\n", __func__);
- client = data->fldata.ds_nfs_client;
- }
-
- nfs41_sequence_done(&data->res.seq_res);
-
- /*
- * Handle async errors for both data servers and MDS communication.
- */
- /* FIXME: pass data->args.context->state to nfs4_async_handle_error
- like in nfs4_write_done? */
- if (nfs4_async_handle_error(task, mds_svr, NULL, client) == -EAGAIN) {
- nfs_restart_rpc(task, client);
- dprintk("<-- %s status= %d\n", __func__, -EAGAIN);
- return -EAGAIN;
- }
-
- /*
- * MDS write: renew lease
- * DS write: update lastbyte written
- */
- if (task->tk_status > 0) {
- if (!data->fldata.ds_nfs_client) {
- nfs_post_op_update_inode_force_wcc(data->inode,
- data->res.fattr);
- renew_lease(mds_svr, data->timestamp);
- } else {
- pnfs_update_last_write(NFS_I(data->inode),
- data->args.offset,
- data->res.count);
- /* Mark for LAYOUTCOMMIT */
- pnfs_need_layoutcommit(NFS_I(data->inode),
- data->args.context);
- }
- }
- return 0;
-}
-
-/*
* rpc_call_done callback for a commit to the MDS or to a filelayout Data Server
*/
static int pnfs4_commit_done(struct rpc_task *task, struct nfs_write_data *data)
@@ -6058,7 +6000,6 @@ pnfs_v4_clientops_init(void)

memcpy(p, &nfs_v4_clientops, sizeof(*p));
p->write_setup = pnfs4_proc_write_setup;
- p->write_done = pnfs4_write_done;
p->commit_setup = pnfs4_proc_commit_setup;
p->commit_done = pnfs4_commit_done;
}
--
1.6.4.4


2010-06-17 14:50:25

by Benny Halevy

[permalink] [raw]
Subject: [PATCH 13/19] SQUASHME: pnfs-submit: merge pnfs4_commit_done into nfs4_commit_done - part 1

PNFS_NO_RPC

Signed-off-by: Benny Halevy <[email protected]>
---
fs/nfs/nfs4proc.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 5c1e680..8b88cf2 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -3279,6 +3279,11 @@ static int nfs4_commit_done(struct rpc_task *task, struct nfs_write_data *data)
{
struct inode *inode = data->inode;

+#ifdef CONFIG_NFS_V4_1
+ if (data->pdata.pnfsflags & PNFS_NO_RPC)
+ return 0;
+#endif /* CONFIG_NFS_V4_1 */
+
nfs4_sequence_done(NFS_SERVER(inode), &data->res.seq_res,
task->tk_status);
if (nfs4_async_handle_error(task, NFS_SERVER(inode), NULL, NULL) == -EAGAIN) {
--
1.6.4.4


2010-06-17 14:50:36

by Benny Halevy

[permalink] [raw]
Subject: [PATCH 14/19] SQUASHME: pnfs-submit: merge pnfs4_commit_done into nfs4_commit_done - part 2

Possibly override nfs_client with data server's.

Signed-off-by: Benny Halevy <[email protected]>
---
fs/nfs/nfs4proc.c | 14 +++++++++++---
1 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 8b88cf2..2782900 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -3278,16 +3278,24 @@ static void nfs4_proc_write_setup(struct nfs_write_data *data, struct rpc_messag
static int nfs4_commit_done(struct rpc_task *task, struct nfs_write_data *data)
{
struct inode *inode = data->inode;
+ struct nfs_server *server = NFS_SERVER(data->inode);
+ struct nfs_client *client = server->nfs_client;

#ifdef CONFIG_NFS_V4_1
if (data->pdata.pnfsflags & PNFS_NO_RPC)
return 0;
+
+ /* Is this a DS session */
+ if (data->fldata.ds_nfs_client) {
+ dprintk("%s DS commit\n", __func__);
+ client = data->fldata.ds_nfs_client;
+ }
#endif /* CONFIG_NFS_V4_1 */

- nfs4_sequence_done(NFS_SERVER(inode), &data->res.seq_res,
+ nfs4_sequence_done(server, &data->res.seq_res,
task->tk_status);
- if (nfs4_async_handle_error(task, NFS_SERVER(inode), NULL, NULL) == -EAGAIN) {
- nfs_restart_rpc(task, NFS_SERVER(inode)->nfs_client);
+ if (nfs4_async_handle_error(task, server, NULL, client) == -EAGAIN) {
+ nfs_restart_rpc(task, client);
return -EAGAIN;
}
nfs_refresh_inode(inode, data->res.fattr);
--
1.6.4.4


2010-06-17 14:50:47

by Benny Halevy

[permalink] [raw]
Subject: [PATCH 15/19] SQUASHME: pnfs-submit: merge pnfs4_commit_done into nfs4_commit_done - part 3

nfs_refresh_inode only for MDS commits.

Signed-off-by: Benny Halevy <[email protected]>
---
fs/nfs/nfs4proc.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 2782900..95de256 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -3298,7 +3298,8 @@ static int nfs4_commit_done(struct rpc_task *task, struct nfs_write_data *data)
nfs_restart_rpc(task, client);
return -EAGAIN;
}
- nfs_refresh_inode(inode, data->res.fattr);
+ if (client == server->nfs_client)
+ nfs_refresh_inode(inode, data->res.fattr);
return 0;
}

--
1.6.4.4


2010-06-17 14:50:58

by Benny Halevy

[permalink] [raw]
Subject: [PATCH 16/19] SQUASHME: pnfs-submit: get rid of pnfs4_commit_done

Now that it's fully merged into nfs4_commit_done

Signed-off-by: Benny Halevy <[email protected]>
---
fs/nfs/nfs4proc.c | 36 ------------------------------------
1 files changed, 0 insertions(+), 36 deletions(-)

diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 95de256..3d15d34 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -3169,41 +3169,6 @@ static int nfs4_read_done(struct rpc_task *task, struct nfs_read_data *data)
return 0;
}

-#ifdef CONFIG_NFS_V4_1
-/*
- * rpc_call_done callback for a commit to the MDS or to a filelayout Data Server
- */
-static int pnfs4_commit_done(struct rpc_task *task, struct nfs_write_data *data)
-{
- struct nfs_server *mds_svr = NFS_SERVER(data->inode);
- struct nfs_client *client = mds_svr->nfs_client;
-
- dprintk("--> %s task->tk_status %d\n", __func__, task->tk_status);
-
- if (data->pdata.pnfsflags & PNFS_NO_RPC)
- return 0;
-
- /* Is this a DS session */
- if (data->fldata.ds_nfs_client) {
- dprintk("%s DS commit\n", __func__);
- client = data->fldata.ds_nfs_client;
- }
-
- nfs41_sequence_done(&data->res.seq_res);
-
- if (nfs4_async_handle_error(task, mds_svr, NULL, client) == -EAGAIN) {
- nfs_restart_rpc(task, client);
- return -EAGAIN;
- }
-
- /* Update inode if commit to MDS */
- if (task->tk_status >= 0 && !data->fldata.ds_nfs_client)
- nfs_refresh_inode(data->inode, data->res.fattr);
- dprintk("<-- %s\n", __func__);
- return 0;
-}
-#endif /* CONFIG_NFS_V4_1 */
-
static void nfs4_proc_read_setup(struct nfs_read_data *data, struct rpc_message *msg)
{
data->timestamp = jiffies;
@@ -6015,7 +5980,6 @@ pnfs_v4_clientops_init(void)
memcpy(p, &nfs_v4_clientops, sizeof(*p));
p->write_setup = pnfs4_proc_write_setup;
p->commit_setup = pnfs4_proc_commit_setup;
- p->commit_done = pnfs4_commit_done;
}
#endif /* CONFIG_NFS_V4_1 */

--
1.6.4.4


2010-06-17 14:51:08

by Benny Halevy

[permalink] [raw]
Subject: [PATCH 17/19] SQUASHME: pnfs-submit: merge pnfs4_proc_write_setup into nfs4_proc_write_setup

Signed-off-by: Benny Halevy <[email protected]>
---
fs/nfs/nfs4proc.c | 30 +++++++-----------------------
1 files changed, 7 insertions(+), 23 deletions(-)

diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 3d15d34..667d525 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -3237,6 +3237,13 @@ static void nfs4_proc_write_setup(struct nfs_write_data *data, struct rpc_messag
data->res.server = server;
data->timestamp = jiffies;

+#ifdef CONFIG_NFS_V4_1
+ /* writes to DS use pnfs vector */
+ if (data->fldata.ds_nfs_client) {
+ msg->rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_PNFS_WRITE];
+ return;
+ }
+#endif /* CONFIG_NFS_V4_1 */
msg->rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_WRITE];
}

@@ -3296,28 +3303,6 @@ pnfs4_proc_commit_setup(struct nfs_write_data *data, struct rpc_message *msg)
data->res.server = server;
msg->rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_PNFS_COMMIT];
}
-
-/*
- * pNFS does not send a getattr on write.
- */
-static void pnfs4_proc_write_setup(struct nfs_write_data *data,
- struct rpc_message *msg)
-{
- struct nfs_server *server = NFS_SERVER(data->inode);
-
- dprintk("--> %s ds_nfs_client %p\n", __func__,
- data->fldata.ds_nfs_client);
-
- /* writes to MDS use non-pnfs vector */
- if (!data->fldata.ds_nfs_client)
- return nfs4_proc_write_setup(data, msg);
-
- data->args.bitmask = server->attr_bitmask;
- data->res.server = server;
- data->timestamp = jiffies;
-
- msg->rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_PNFS_WRITE];
-}
#endif /* CONFIG_NFS_V4_1 */

struct nfs4_renewdata {
@@ -5978,7 +5963,6 @@ pnfs_v4_clientops_init(void)
struct nfs_rpc_ops *p = (struct nfs_rpc_ops *)&pnfs_v4_clientops;

memcpy(p, &nfs_v4_clientops, sizeof(*p));
- p->write_setup = pnfs4_proc_write_setup;
p->commit_setup = pnfs4_proc_commit_setup;
}
#endif /* CONFIG_NFS_V4_1 */
--
1.6.4.4


2010-06-17 14:51:30

by Benny Halevy

[permalink] [raw]
Subject: [PATCH 19/19] SQUASHME: pnfs-submit: get rid of pnfs_v4_clientops

Signed-off-by: Benny Halevy <[email protected]>
---
fs/nfs/internal.h | 4 ----
fs/nfs/nfs4proc.c | 12 ------------
fs/nfs/pnfs.c | 7 -------
3 files changed, 0 insertions(+), 23 deletions(-)

diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h
index a30974a..e5f6f16 100644
--- a/fs/nfs/internal.h
+++ b/fs/nfs/internal.h
@@ -211,10 +211,6 @@ extern const u32 nfs41_maxwrite_overhead;
extern struct rpc_procinfo nfs4_procedures[];
#endif

-#ifdef CONFIG_NFS_V4_1
-extern void pnfs_v4_clientops_init(void);
-#endif /* CONFIG_NFS_V4_1 */
-
extern int nfs4_recover_expired_lease(struct nfs_client *clp);

/* proc.c */
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 915e7cb..8109692 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -5939,18 +5939,6 @@ const struct nfs_rpc_ops nfs_v4_clientops = {
.close_context = nfs4_close_context,
};

-#if defined(CONFIG_NFS_V4_1)
-const struct nfs_rpc_ops pnfs_v4_clientops;
-
-void
-pnfs_v4_clientops_init(void)
-{
- struct nfs_rpc_ops *p = (struct nfs_rpc_ops *)&pnfs_v4_clientops;
-
- memcpy(p, &nfs_v4_clientops, sizeof(*p));
-}
-#endif /* CONFIG_NFS_V4_1 */
-
/*
* Local variables:
* c-basic-offset: 8
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index 414b7dc..6dd454c 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -118,8 +118,6 @@ pnfs_initialize(void)
return -ENOMEM;
}

- pnfs_v4_clientops_init();
-
pnfs_initialized = 1;
return 0;
}
@@ -229,11 +227,6 @@ set_pnfs_layoutdriver(struct nfs_server *server, const struct nfs_fh *mntfh,
"for layout driver %u. ", __func__, id);
goto out_err;
}
- /*
- * Layout driver succeeded in initializing mountpoint
- * and has taken a reference on the nfs_client cl_devid_cache
- */
- server->nfs_client->rpc_ops = &pnfs_v4_clientops;
dprintk("%s: pNFS module for %u set\n", __func__, id);
return;
}
--
1.6.4.4


2010-06-17 14:51:19

by Benny Halevy

[permalink] [raw]
Subject: [PATCH 18/19] SQUASHME: pnfs-submit: merge pnfs4_proc_commit_setup into nfs4_proc_commit_setup

Signed-off-by: Benny Halevy <[email protected]>
---
fs/nfs/nfs4proc.c | 28 ++++++----------------------
1 files changed, 6 insertions(+), 22 deletions(-)

diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 667d525..915e7cb 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -3281,29 +3281,14 @@ static void nfs4_proc_commit_setup(struct nfs_write_data *data, struct rpc_messa

data->args.bitmask = server->cache_consistency_bitmask;
data->res.server = server;
- msg->rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_COMMIT];
-}
-
#if defined(CONFIG_NFS_V4_1)
-/*
- * pNFS doew not send a getattr to Data Servers on commit.
- */
-static void
-pnfs4_proc_commit_setup(struct nfs_write_data *data, struct rpc_message *msg)
-{
- struct nfs_server *server = NFS_SERVER(data->inode);
-
- dprintk("--> %s ds_nfs_client %p\n", __func__,
- data->fldata.ds_nfs_client);
-
- if (!data->fldata.ds_nfs_client)
- return nfs4_proc_commit_setup(data, msg);
-
- data->args.bitmask = server->attr_bitmask;
- data->res.server = server;
- msg->rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_PNFS_COMMIT];
-}
+ if (data->fldata.ds_nfs_client) {
+ msg->rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_PNFS_COMMIT];
+ return;
+ }
#endif /* CONFIG_NFS_V4_1 */
+ msg->rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_COMMIT];
+}

struct nfs4_renewdata {
struct nfs_client *client;
@@ -5963,7 +5948,6 @@ pnfs_v4_clientops_init(void)
struct nfs_rpc_ops *p = (struct nfs_rpc_ops *)&pnfs_v4_clientops;

memcpy(p, &nfs_v4_clientops, sizeof(*p));
- p->commit_setup = pnfs4_proc_commit_setup;
}
#endif /* CONFIG_NFS_V4_1 */

--
1.6.4.4


2010-06-17 15:00:47

by Fred Isaman

[permalink] [raw]
Subject: Re: [PATCH 01/19] SQUASHME: pnfs-submit: merge pnfs4_proc_setattr into nfs4_proc_setattr

On Thu, Jun 17, 2010 at 10:48 AM, Benny Halevy <[email protected]> wr=
ote:
> Signed-off-by: Benny Halevy <[email protected]>
> ---
> =A0fs/nfs/nfs4proc.c | =A0 35 +++++++++++++++--------------------
> =A01 files changed, 15 insertions(+), 20 deletions(-)
>
> diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
> index 8c02296..17a2597 100644
> --- a/fs/nfs/nfs4proc.c
> +++ b/fs/nfs/nfs4proc.c
> @@ -2333,6 +2333,19 @@ static int nfs4_proc_getattr(struct nfs_server=
*server, struct nfs_fh *fhandle,
> =A0 =A0 =A0 =A0return err;
> =A0}
>
> +static void
> +pnfs4_return_layout_on_setattr(struct inode *inode)
> +{
> +#ifdef CONFIG_NFS_V4_1
> + =A0 =A0 =A0 struct nfs_server *server =3D NFS_SERVER(inode);
> + =A0 =A0 =A0 struct nfs_inode *nfsi =3D NFS_I(inode);
> +
> + =A0 =A0 =A0 if (pnfs_enabled_sb(server) && has_layout(nfsi) &&

pnfs_enabled_sb() is not needed given the following has_layout() test.

=46red

> + =A0 =A0 =A0 =A0 =A0 pnfs_ld_layoutret_on_setattr(server->pnfs_curr_=
ld))
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 pnfs_return_layout(inode, NULL, NULL, R=
ETURN_FILE, true);
> +#endif /* CONFIG_NFS_V4_1 */
> +}
> +
> =A0/*
> =A0* The file is not closed if it is opened due to the a request to c=
hange
> =A0* the size of the file. The open call will not be needed once the
> @@ -2359,6 +2372,8 @@ nfs4_proc_setattr(struct dentry *dentry, struct=
nfs_fattr *fattr,
> =A0 =A0 =A0 =A0struct nfs4_state *state =3D NULL;
> =A0 =A0 =A0 =A0int status;
>
> + =A0 =A0 =A0 pnfs4_return_layout_on_setattr(inode);
> +
> =A0 =A0 =A0 =A0nfs_fattr_init(fattr);
>
> =A0 =A0 =A0 =A0/* Search for an existing open(O_WRITE) file */
> @@ -2378,25 +2393,6 @@ nfs4_proc_setattr(struct dentry *dentry, struc=
t nfs_fattr *fattr,
> =A0 =A0 =A0 =A0return status;
> =A0}
>
> -#ifdef CONFIG_NFS_V4_1
> -/*
> - * Return layout before issueing a setattr
> - */
> -static int
> -pnfs4_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr,
> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 struct iattr *sattr)
> -{
> - =A0 =A0 =A0 struct inode *inode =3D dentry->d_inode;
> - =A0 =A0 =A0 struct nfs_server *server =3D NFS_SERVER(inode);
> - =A0 =A0 =A0 struct nfs_inode *nfsi =3D NFS_I(inode);
> -
> - =A0 =A0 =A0 if (pnfs_enabled_sb(server) && has_layout(nfsi) &&
> - =A0 =A0 =A0 =A0 =A0 pnfs_ld_layoutret_on_setattr(server->pnfs_curr_=
ld))
> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 pnfs_return_layout(inode, NULL, NULL, R=
ETURN_FILE, true);
> - =A0 =A0 =A0 return nfs4_proc_setattr(dentry, fattr, sattr);
> -}
> -#endif /* CONFIG_NFS_V4_1 */
> -
> =A0static int _nfs4_proc_lookupfh(struct nfs_server *server, const st=
ruct nfs_fh *dirfh,
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0const struct qstr *name, struct nfs_fh=
*fhandle,
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0struct nfs_fattr *fattr)
> @@ -6068,7 +6064,6 @@ pnfs_v4_clientops_init(void)
> =A0 =A0 =A0 =A0struct nfs_rpc_ops *p =3D (struct nfs_rpc_ops *)&pnfs_=
v4_clientops;
>
> =A0 =A0 =A0 =A0memcpy(p, &nfs_v4_clientops, sizeof(*p));
> - =A0 =A0 =A0 p->setattr =A0 =A0 =A0 =A0 =A0 =A0 =A0=3D pnfs4_proc_se=
tattr;
> =A0 =A0 =A0 =A0p->read_done =A0 =A0 =A0 =A0 =A0 =A0=3D pnfs4_read_don=
e;
> =A0 =A0 =A0 =A0p->write_setup =A0 =A0 =A0 =A0 =A0=3D pnfs4_proc_write=
_setup;
> =A0 =A0 =A0 =A0p->write_done =A0 =A0 =A0 =A0 =A0 =3D pnfs4_write_done=
;
> --
> 1.6.4.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-nfs" =
in
> the body of a message to [email protected]
> More majordomo info at =A0http://vger.kernel.org/majordomo-info.html
>

2010-06-17 15:11:46

by Fred Isaman

[permalink] [raw]
Subject: Re: [PATCH 04/19] SQUASHME: pnfs-submit: merge pnfs4_read_done into nfs4_read_done - part 1

On Thu, Jun 17, 2010 at 10:48 AM, Benny Halevy <[email protected]> wr=
ote:
> deviding into several patches to assist review
>
> Signed-off-by: Benny Halevy <[email protected]>
> ---
> =A0fs/nfs/nfs4proc.c | =A0 =A05 +++++
> =A01 files changed, 5 insertions(+), 0 deletions(-)
>
> diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
> index c4f707f..a6bebbf 100644
> --- a/fs/nfs/nfs4proc.c
> +++ b/fs/nfs/nfs4proc.c
> @@ -3144,6 +3144,11 @@ static int nfs4_read_done(struct rpc_task *tas=
k, struct nfs_read_data *data)
>
> =A0 =A0 =A0 =A0dprintk("--> %s\n", __func__);
>
> +#ifdef CONFIG_NFS_V4_1
> + =A0 =A0 =A0 if (data->pdata.pnfsflags & PNFS_NO_RPC)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return 0;
> +#endif /* CONFIG_NFS_V4_1 */
> +

This shouldn't be in pnfs_submit (PFNS_NO_RPC doesn't exist there anymo=
re)

=46red

> =A0 =A0 =A0 =A0nfs4_sequence_done(server, &data->res.seq_res, task->t=
k_status);
>
> =A0 =A0 =A0 =A0if (nfs4_async_handle_error(task, server, data->args.c=
ontext->state, NULL) =3D=3D -EAGAIN) {
> --
> 1.6.4.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-nfs" =
in
> the body of a message to [email protected]
> More majordomo info at =A0http://vger.kernel.org/majordomo-info.html
>

2010-06-17 15:11:57

by Benny Halevy

[permalink] [raw]
Subject: Re: [PATCH 01/19] SQUASHME: pnfs-submit: merge pnfs4_proc_setattr into nfs4_proc_setattr

On Jun. 17, 2010, 11:00 -0400, Fred Isaman <[email protected]> wrote:
> On Thu, Jun 17, 2010 at 10:48 AM, Benny Halevy <[email protected]> wrote:
>> Signed-off-by: Benny Halevy <[email protected]>
>> ---
>> fs/nfs/nfs4proc.c | 35 +++++++++++++++--------------------
>> 1 files changed, 15 insertions(+), 20 deletions(-)
>>
>> diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
>> index 8c02296..17a2597 100644
>> --- a/fs/nfs/nfs4proc.c
>> +++ b/fs/nfs/nfs4proc.c
>> @@ -2333,6 +2333,19 @@ static int nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle,
>> return err;
>> }
>>
>> +static void
>> +pnfs4_return_layout_on_setattr(struct inode *inode)
>> +{
>> +#ifdef CONFIG_NFS_V4_1
>> + struct nfs_server *server = NFS_SERVER(inode);
>> + struct nfs_inode *nfsi = NFS_I(inode);
>> +
>> + if (pnfs_enabled_sb(server) && has_layout(nfsi) &&
>
> pnfs_enabled_sb() is not needed given the following has_layout() test.
>

Good point. I'll remove it.

Benny

> Fred
>
>> + pnfs_ld_layoutret_on_setattr(server->pnfs_curr_ld))
>> + pnfs_return_layout(inode, NULL, NULL, RETURN_FILE, true);
>> +#endif /* CONFIG_NFS_V4_1 */
>> +}
>> +
>> /*
>> * The file is not closed if it is opened due to the a request to change
>> * the size of the file. The open call will not be needed once the
>> @@ -2359,6 +2372,8 @@ nfs4_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr,
>> struct nfs4_state *state = NULL;
>> int status;
>>
>> + pnfs4_return_layout_on_setattr(inode);
>> +
>> nfs_fattr_init(fattr);
>>
>> /* Search for an existing open(O_WRITE) file */
>> @@ -2378,25 +2393,6 @@ nfs4_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr,
>> return status;
>> }
>>
>> -#ifdef CONFIG_NFS_V4_1
>> -/*
>> - * Return layout before issueing a setattr
>> - */
>> -static int
>> -pnfs4_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr,
>> - struct iattr *sattr)
>> -{
>> - struct inode *inode = dentry->d_inode;
>> - struct nfs_server *server = NFS_SERVER(inode);
>> - struct nfs_inode *nfsi = NFS_I(inode);
>> -
>> - if (pnfs_enabled_sb(server) && has_layout(nfsi) &&
>> - pnfs_ld_layoutret_on_setattr(server->pnfs_curr_ld))
>> - pnfs_return_layout(inode, NULL, NULL, RETURN_FILE, true);
>> - return nfs4_proc_setattr(dentry, fattr, sattr);
>> -}
>> -#endif /* CONFIG_NFS_V4_1 */
>> -
>> static int _nfs4_proc_lookupfh(struct nfs_server *server, const struct nfs_fh *dirfh,
>> const struct qstr *name, struct nfs_fh *fhandle,
>> struct nfs_fattr *fattr)
>> @@ -6068,7 +6064,6 @@ pnfs_v4_clientops_init(void)
>> struct nfs_rpc_ops *p = (struct nfs_rpc_ops *)&pnfs_v4_clientops;
>>
>> memcpy(p, &nfs_v4_clientops, sizeof(*p));
>> - p->setattr = pnfs4_proc_setattr;
>> p->read_done = pnfs4_read_done;
>> p->write_setup = pnfs4_proc_write_setup;
>> p->write_done = pnfs4_write_done;
>> --
>> 1.6.4.4
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
>> the body of a message to [email protected]
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>>