Skip to contentSkip to conversation

: merge pnfs client ops into nfs4's

PATCH In review Benny Halevy 2 participants 27 messages Jun 17, 2010 3 messages not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover : 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

#1 lore raw

PATCH 1/19 SQUASHME: pnfs-submit: merge pnfs4_proc_setattr into nfs4_proc_setattr

---
 fs/nfs/nfs4proc.c |   35 +++++++++++++++--------------------
 1 files changed, 15 insertions(+), 20 deletions(-)
fs/nfs/nfs4proc.c +15 -20
index 8c02296..17a2597 100644
@@ -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;
Signature · 1 line
1.6.4.4
#2 lore raw

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:

fs/nfs/nfs4proc.c static int nfs4_proc_getattr(struct nfs_server=

Quoted 10 lines

---
=A0fs/nfs/nfs4proc.c | =A0 35 +++++++++++++++-------------------- =A01 files changed, 15 insertions(+), 20 deletions(-)

fs/nfs/nfs4proc.c +0 -0
index 8c02296..17a2597 100644
@@ -2333,6 +2333,19 @@ static int nfs4_proc_getattr(struct nfs_server=

*server, struct nfs_fh *fhandle,

fs/nfs/nfs4proc.c static int nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle,

Quoted 11 lines
fs/nfs/nfs4proc.c +8 -0
 =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

fs/nfs/nfs4proc.c static int nfs4_proc_getattr(struct nfs_server= · line 2344

Quoted 1 line
fs/nfs/nfs4proc.c +1 -0
+ =A0 =A0 =A0 =A0 =A0 pnfs_ld_layoutret_on_setattr(server->pnfs_curr_=

ld))

fs/nfs/nfs4proc.c static int nfs4_proc_getattr(struct nfs_server= · line 2345

Quoted 1 line
fs/nfs/nfs4proc.c +1 -0
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 pnfs_return_layout(inode, NULL, NULL, R=

ETURN_FILE, true);

Quoted 5 lines
fs/nfs/nfs4proc.c +3 -0
+#endif /* CONFIG_NFS_V4_1 */
+}
+

=A0/*
=A0* The file is not closed if it is opened due to the a request to c=

hange

fs/nfs/nfs4proc.c nfs4_proc_setattr(struct dentry *dentry, struct=

Quoted 2 lines

=A0* the size of the file. The open call will not be needed once the

fs/nfs/nfs4proc.c +0 -0
@@ -2359,6 +2372,8 @@ nfs4_proc_setattr(struct dentry *dentry, struct=

nfs_fattr *fattr,

fs/nfs/nfs4proc.c nfs4_proc_setattr(struct dentry *dentry, struc=

Quoted 9 lines
fs/nfs/nfs4proc.c +2 -0
 =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 */

fs/nfs/nfs4proc.c +0 -0
@@ -2378,25 +2393,6 @@ nfs4_proc_setattr(struct dentry *dentry, struc=

t nfs_fattr *fattr,

Quoted 7 lines
fs/nfs/nfs4proc.c +0 -4
 =A0 =A0 =A0 =A0return status;
 =A0}
 
-#ifdef CONFIG_NFS_V4_1
-/*
- * Return layout before issueing a setattr
- */

fs/nfs/nfs4proc.c nfs4_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr,

Quoted 10 lines
fs/nfs/nfs4proc.c +0 -10
-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))

fs/nfs/nfs4proc.c nfs4_proc_setattr(struct dentry *dentry, struc= · line 2395

Quoted 1 line
fs/nfs/nfs4proc.c +0 -1
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 pnfs_return_layout(inode, NULL, NULL, R=

ETURN_FILE, true);

Quoted 5 lines
fs/nfs/nfs4proc.c +0 -4
- =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,

Quoted 1 line

=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0const struct qstr *name, struct nfs_fh=

*fhandle,

Quoted 3 lines

=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0struct nfs_fattr *fattr)

fs/nfs/nfs4proc.c +0 -0
@@ -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;

Quoted 3 lines

=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;

Quoted 1 line

=A0 =A0 =A0 =A0p->read_done =A0 =A0 =A0 =A0 =A0 =A0=3D pnfs4_read_don=

e;

Quoted 1 line

=A0 =A0 =A0 =A0p->write_setup =A0 =A0 =A0 =A0 =A0=3D pnfs4_proc_write=

_setup;

Quoted 1 line

=A0 =A0 =A0 =A0p->write_done =A0 =A0 =A0 =A0 =A0 =3D pnfs4_write_done=

;

Quoted 5 lines

--
1.6.4.4

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" =

in

Quoted 3 lines

the body of a message to [email protected]
More majordomo info at =A0http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): AANLkTika4BAGrDg0CnUPRy9Qji6rThr5zcZ0S8ciAr29-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#4 lore raw

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

Quoted 14 lines · Fred Isaman
Quoted 13 lines · Benny Halevy
---
 fs/nfs/nfs4proc.c |   35 +++++++++++++++--------------------
 1 files changed, 15 insertions(+), 20 deletions(-)
fs/nfs/nfs4proc.c +0 -0
index 8c02296..17a2597 100644
@@ -2333,6 +2333,19 @@ static int nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle,
       return err;
 }
 
Quoted 11 lines

fs/nfs/nfs4proc.c static int nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle, · line 2343

Quoted 8 lines
fs/nfs/nfs4proc.c +8 -0
+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

Quoted 61 lines

Fred

Quoted 59 lines
fs/nfs/nfs4proc.c +7 -21
+           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

#5 lore raw

PATCH 2/19 SQUASHME: pnfs4_read_done status variable is unused

In reply to Benny Halevy
---
 fs/nfs/nfs4proc.c |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)
fs/nfs/nfs4proc.c +0 -3
index 17a2597..8ab30d5 100644
@@ -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__);
Signature · 1 line
1.6.4.4
#6 lore raw

PATCH 3/19 SQUASHME: pnfs-submit: optionally pass nfs_client to nfs4_async_handle_error

In reply to Benny Halevy

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

---
 fs/nfs/nfs4proc.c |   22 ++++++----------------
 1 files changed, 6 insertions(+), 16 deletions(-)
fs/nfs/nfs4proc.c +6 -16
index 8ab30d5..c4f707f 100644
@@ -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)
Signature · 1 line
1.6.4.4
#7 lore raw

PATCH 4/19 SQUASHME: pnfs-submit: merge pnfs4_read_done into nfs4_read_done - part 1

In reply to Benny Halevy

deviding into several patches to assist review

---
 fs/nfs/nfs4proc.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
fs/nfs/nfs4proc.c +5 -0
index c4f707f..a6bebbf 100644
@@ -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) {
Signature · 1 line
1.6.4.4
#8 lore raw

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:

fs/nfs/nfs4proc.c static int nfs4_read_done(struct rpc_task *tas=

Quoted 12 lines

deviding into several patches to assist review

---
=A0fs/nfs/nfs4proc.c | =A0 =A05 +++++
=A01 files changed, 5 insertions(+), 0 deletions(-)

fs/nfs/nfs4proc.c +0 -0
index c4f707f..a6bebbf 100644
@@ -3144,6 +3144,11 @@ static int nfs4_read_done(struct rpc_task *tas=

k, struct nfs_read_data *data)

fs/nfs/nfs4proc.c static int nfs4_read_done(struct rpc_task *task, struct nfs_read_data *data) · line 3151

Quoted 8 lines
fs/nfs/nfs4proc.c +5 -0
 =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

Quoted 1 line

=A0 =A0 =A0 =A0nfs4_sequence_done(server, &data->res.seq_res, task->t=

k_status);

Quoted 2 lines

=A0 =A0 =A0 =A0if (nfs4_async_handle_error(task, server, data->args.c=

ontext->state, NULL) =3D=3D -EAGAIN) {

Quoted 5 lines

--
1.6.4.4

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" =

in

Quoted 3 lines

the body of a message to [email protected]
More majordomo info at =A0http://vger.kernel.org/majordomo-info.html

#9 lore raw

PATCH 5/19 SQUASHME: pnfs-submit: merge pnfs4_read_done into nfs4_read_done - part 2

In reply to Benny Halevy

Possibly override nfs_client with ds_nfs_client

---
 fs/nfs/nfs4proc.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)
fs/nfs/nfs4proc.c +9 -2
index a6bebbf..77b7182 100644
@@ -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;
 	}
 
Signature · 1 line
1.6.4.4
#10 lore raw

PATCH 6/19 SQUASHME: pnfs-submit: merge pnfs4_read_done into nfs4_read_done - part 3

In reply to Benny Halevy

Do not renew the data server lease.

---
 fs/nfs/nfs4proc.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
fs/nfs/nfs4proc.c +1 -1
index 77b7182..e8b0f33 100644
@@ -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;
 }
Signature · 1 line
1.6.4.4
#11 lore raw

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:

fs/nfs/nfs4proc.c static int nfs4_read_done(struct rpc_task *task=

Quoted 12 lines

Do not renew the data server lease.

---
=A0fs/nfs/nfs4proc.c | =A0 =A02 +-
=A01 files changed, 1 insertions(+), 1 deletions(-)

fs/nfs/nfs4proc.c +0 -0
index 77b7182..e8b0f33 100644
@@ -3164,7 +3164,7 @@ static int nfs4_read_done(struct rpc_task *task=

, struct nfs_read_data *data)

fs/nfs/nfs4proc.c static int nfs4_read_done(struct rpc_task *task= · line 3167

Quoted 5 lines
fs/nfs/nfs4proc.c +1 -1
 =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

Quoted 8 lines
fs/nfs/nfs4proc.c +0 -1
 =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

Quoted 3 lines

the body of a message to [email protected]
More majordomo info at =A0http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): AANLkTikvo8qP_B23suRB-lKNCcCQv4W6Vw8kBmPC_6SX-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#13 lore raw

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

Quoted 15 lines · Fred Isaman
Quoted 14 lines · Benny Halevy

Do not renew the data server lease.

---
 fs/nfs/nfs4proc.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
fs/nfs/nfs4proc.c +0 -0
index 77b7182..e8b0f33 100644
@@ -3164,7 +3164,7 @@ static int nfs4_read_done(struct rpc_task *task, struct nfs_read_data *data)
       }
 
Quoted 6 lines

fs/nfs/nfs4proc.c static int nfs4_read_done(struct rpc_task *task, struct nfs_read_data *data) · line 3167

Quoted 3 lines
fs/nfs/nfs4proc.c +1 -1
       nfs_invalidate_atime(data->inode);
-       if (task->tk_status > 0)
+       if (task->tk_status > 0 && client == server->nfs_client)

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

The filehandle determines the "DS personality" as per 13.6. Operations Sent to NFSv4.1 Data Servers so the dual role server should act no different than any other DS with this respect.

Benny

Quoted 13 lines

Fred

Quoted 11 lines
fs/nfs/nfs4proc.c +0 -1
               renew_lease(server, data->timestamp);
       return 0;
 }
--

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

#14 lore raw

PATCH 7/19 SQUASHME: pnfs-submit: get rid of pnfs4_read_done

In reply to Benny Halevy

Now that its funcitonality if fully merged into nfs4_read_done

---
 fs/nfs/nfs4proc.c |   43 -------------------------------------------
 1 files changed, 0 insertions(+), 43 deletions(-)
fs/nfs/nfs4proc.c +0 -43
index e8b0f33..6a0ab6c 100644
@@ -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;
Signature · 1 line
1.6.4.4
#15 lore raw

PATCH 8/19 SQUASHME: pnfs-submit: merge pnfs4_write_done into nfs4_write_done - part 1

In reply to Benny Halevy

restore original count after retry.

---
 fs/nfs/nfs4proc.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)
fs/nfs/nfs4proc.c +10 -1
index 6a0ab6c..5948de5 100644
@@ -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);
 
Signature · 1 line
1.6.4.4
#16 lore raw

PATCH 9/19 SQUASHME: pnfs-submit: merge pnfs4_write_done into nfs4_write_done - part 2

In reply to Benny Halevy

PNFS_NO_RPC.

---
 fs/nfs/nfs4proc.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
fs/nfs/nfs4proc.c +3 -0
index 5948de5..fd2b588 100644
@@ -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,
Signature · 1 line
1.6.4.4
#17 lore raw

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:

fs/nfs/nfs4proc.c static int nfs4_write_done(struct rpc_task *tas=

Quoted 12 lines

PNFS_NO_RPC.

---
=A0fs/nfs/nfs4proc.c | =A0 =A03 +++
=A01 files changed, 3 insertions(+), 0 deletions(-)

fs/nfs/nfs4proc.c +0 -0
index 5948de5..fd2b588 100644
@@ -3279,6 +3279,9 @@ static int nfs4_write_done(struct rpc_task *tas=

k, struct nfs_write_data *data)

Quoted 1 line

=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0data->pdata.orig_count=

);

Quoted 1 line

=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0data->args.count =3D data->pdata.orig_=

count;

Quoted 5 lines

=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

Quoted 2 lines

=A0 =A0 =A0 =A0nfs4_sequence_done(NFS_SERVER(inode), &data->res.seq_r=

es,

Quoted 5 lines

--
1.6.4.4

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" =

in

Quoted 3 lines

the body of a message to [email protected]
More majordomo info at =A0http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): AANLkTimHng4urMH5CTn68aZJ_NKIasCH6VJOTCI-2zRQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#19 lore raw

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

Quoted 8 lines · Fred Isaman
Quoted 7 lines · Benny Halevy

PNFS_NO_RPC.

---
 fs/nfs/nfs4proc.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
Quoted 14 lines

fs/nfs/nfs4proc.c static int nfs4_write_done(struct rpc_task *task, struct nfs_write_data *data) · line 3285

Quoted 12 lines
fs/nfs/nfs4proc.c +3 -0
index 5948de5..fd2b588 100644
@@ -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 */

Again, this is is a post-submit patch

Right. sorry for badly naming it.
It will applied against the post-submit pnfs branch.

Benny

Quoted 13 lines

Fred

Quoted 10 lines
fs/nfs/nfs4proc.c +0 -1
       nfs4_sequence_done(NFS_SERVER(inode), &data->res.seq_res,
--

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

#20 lore raw

PATCH 10/19 SQUASHME: pnfs-submit: merge pnfs4_write_done into nfs4_write_done - part 3

In reply to Benny Halevy

Possibly override data server nfs_client.

---
 fs/nfs/nfs4proc.c |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)
fs/nfs/nfs4proc.c +12 -4
index fd2b588..60898f6 100644
@@ -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;
Signature · 1 line
1.6.4.4
#21 lore raw

PATCH 11/19 SQUASHME: pnfs-submit: merge pnfs4_write_done into nfs4_write_done - part 4

In reply to Benny Halevy

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

---
 fs/nfs/nfs4proc.c |   20 ++++++++++++++++++--
 1 files changed, 18 insertions(+), 2 deletions(-)
fs/nfs/nfs4proc.c +18 -2
index 60898f6..7b501ec 100644
@@ -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;
 }
Signature · 1 line
1.6.4.4
#22 lore raw

PATCH 12/19 SQUASHME: pnfs-submit: get rid of pnfs4_write_done

In reply to Benny Halevy

Now that it's fully merged into nfs4_write_done

---
 fs/nfs/nfs4proc.c |   59 -----------------------------------------------------
 1 files changed, 0 insertions(+), 59 deletions(-)
fs/nfs/nfs4proc.c +0 -59
index 7b501ec..5c1e680 100644
@@ -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;
 }
Signature · 1 line
1.6.4.4
#23 lore raw

PATCH 13/19 SQUASHME: pnfs-submit: merge pnfs4_commit_done into nfs4_commit_done - part 1

In reply to Benny Halevy

PNFS_NO_RPC

---
 fs/nfs/nfs4proc.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
fs/nfs/nfs4proc.c +5 -0
index 5c1e680..8b88cf2 100644
@@ -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) {
Signature · 1 line
1.6.4.4
#24 lore raw

PATCH 14/19 SQUASHME: pnfs-submit: merge pnfs4_commit_done into nfs4_commit_done - part 2

In reply to Benny Halevy

Possibly override nfs_client with data server's.

---
 fs/nfs/nfs4proc.c |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)
fs/nfs/nfs4proc.c +11 -3
index 8b88cf2..2782900 100644
@@ -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);
Signature · 1 line
1.6.4.4
#25 lore raw

PATCH 15/19 SQUASHME: pnfs-submit: merge pnfs4_commit_done into nfs4_commit_done - part 3

In reply to Benny Halevy

nfs_refresh_inode only for MDS commits.

---
 fs/nfs/nfs4proc.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
fs/nfs/nfs4proc.c +2 -1
index 2782900..95de256 100644
@@ -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;
 }
 
Signature · 1 line
1.6.4.4
#26 lore raw

PATCH 16/19 SQUASHME: pnfs-submit: get rid of pnfs4_commit_done

In reply to Benny Halevy

Now that it's fully merged into nfs4_commit_done

---
 fs/nfs/nfs4proc.c |   36 ------------------------------------
 1 files changed, 0 insertions(+), 36 deletions(-)
fs/nfs/nfs4proc.c +0 -36
index 95de256..3d15d34 100644
@@ -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 */
 
Signature · 1 line
1.6.4.4
#27 lore raw

PATCH 17/19 SQUASHME: pnfs-submit: merge pnfs4_proc_write_setup into nfs4_proc_write_setup

In reply to Benny Halevy
---
 fs/nfs/nfs4proc.c |   30 +++++++-----------------------
 1 files changed, 7 insertions(+), 23 deletions(-)
fs/nfs/nfs4proc.c +7 -23
index 3d15d34..667d525 100644
@@ -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 */
Signature · 1 line
1.6.4.4
#28 lore raw

PATCH 18/19 SQUASHME: pnfs-submit: merge pnfs4_proc_commit_setup into nfs4_proc_commit_setup

In reply to Benny Halevy
---
 fs/nfs/nfs4proc.c |   28 ++++++----------------------
 1 files changed, 6 insertions(+), 22 deletions(-)
fs/nfs/nfs4proc.c +6 -22
index 667d525..915e7cb 100644
@@ -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 */
 
Signature · 1 line
1.6.4.4
#29 lore raw

PATCH 19/19 SQUASHME: pnfs-submit: get rid of pnfs_v4_clientops

In reply to Benny Halevy
---
 fs/nfs/internal.h |    4 ----
 fs/nfs/nfs4proc.c |   12 ------------
 fs/nfs/pnfs.c     |    7 -------
 3 files changed, 0 insertions(+), 23 deletions(-)
fs/nfs/internal.h +0 -4
index a30974a..e5f6f16 100644
@@ -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 */
fs/nfs/nfs4proc.c +0 -12
index 915e7cb..8109692 100644
@@ -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
fs/nfs/pnfs.c +0 -7
index 414b7dc..6dd454c 100644
@@ -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;
 	}
Signature · 1 line
1.6.4.4