Skip to contentSkip to conversation

misc fixes and cleanup

PATCH In review Fred Isaman 2 participants 10 messages Oct 1, 2010

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

cover misc fixes and cleanup

The first 3 do some cleanup preparing for the hopefully final devinfo submission.

The last 3 fix some use of freed memory problems using the synch error handler (that were never being triggered because the asynch error handler got there first, at least until the LAYOUTGET code got restructured.)

Fred

#1 lore raw

PATCH 1/7 SQUASHME: pnfs-devinfo-submit: misc small fixes

These are various minor touchups to the devinfo submission code

---
 fs/nfs/nfs4filelayout.c    |    2 +-
 fs/nfs/nfs4filelayoutdev.c |    4 +---
 fs/nfs/pnfs.c              |    4 ++--
 fs/nfs/pnfs.h              |    5 -----
 fs/nfs/read.c              |    1 -
 5 files changed, 4 insertions(+), 12 deletions(-)
fs/nfs/nfs4filelayout.c +1 -1
index a33c47e..2b6e3c9 100644
@@ -631,7 +631,7 @@ filelayout_get_stripesize(struct pnfs_layout_hdr *lo)
 	lseg = pnfs_has_layout(lo, &range);
 	if (!lseg)
 		return 0;
-	fl = container_of(lseg, struct nfs4_filelayout_segment, generic_hdr);
+	fl = FILELAYOUT_LSEG(lseg);
 	size = fl->stripe_unit;
 	put_lseg_locked(lseg);
 	return size;
fs/nfs/nfs4filelayoutdev.c +1 -3
index e4f91f6..5da6fec 100644
@@ -355,9 +355,7 @@ out_err:
 	return ds;
 }
 
-
-
-/*Decode opaque device data and return the result */
+/* Decode opaque device data and return the result */
 static struct nfs4_file_layout_dsaddr*
 decode_device(struct inode *ino, struct pnfs_device *pdev)
 {
fs/nfs/pnfs.c +2 -2
index 333b7db..131602c 100644
@@ -50,7 +50,7 @@ static LIST_HEAD(pnfs_modules_tbl);
 static struct pnfs_layoutdriver_type *
 find_pnfs_driver_locked(u32 id)
 {
-	struct  pnfs_layoutdriver_type *local;
+	struct pnfs_layoutdriver_type *local;
 
 	list_for_each_entry(local, &pnfs_modules_tbl, pnfs_tblid)
 		if (local->id == id)
@@ -64,7 +64,7 @@ out:
 static struct pnfs_layoutdriver_type *
 find_pnfs_driver(u32 id)
 {
-	struct  pnfs_layoutdriver_type *local;
+	struct pnfs_layoutdriver_type *local;
 
 	spin_lock(&pnfs_spinlock);
 	local = find_pnfs_driver_locked(id);
fs/nfs/pnfs.h +0 -5
index 9500aa4..4ea3ae0 100644
@@ -153,7 +153,6 @@ struct pnfs_deviceid_cache {
 	atomic_t		dc_ref;
 	void			(*dc_free_callback)(struct pnfs_deviceid_node *);
 	struct hlist_head	dc_deviceids[NFS4_DEVICE_ID_HASH_SIZE];
-	struct hlist_head	dc_to_free;
 };
 
 extern int pnfs_alloc_init_deviceid_cache(struct nfs_client *,
@@ -295,10 +294,6 @@ static inline void put_lseg(struct pnfs_layout_segment *lseg)
 {
 }
 
-static inline void put_lseg_locked(struct pnfs_layout_segment *lseg)
-{
-}
-
 static inline struct pnfs_layout_segment *
 pnfs_update_layout(struct inode *ino, struct nfs_open_context *ctx,
 		   enum pnfs_iomode access_type)
fs/nfs/read.c +0 -1
index be29689..c34f97d 100644
@@ -29,7 +29,6 @@
 #include "internal.h"
 #include "iostat.h"
 #include "fscache.h"
-#include "pnfs.h"
 
 #define NFSDBG_FACILITY		NFSDBG_PAGECACHE
 
Signature · 1 line
1.7.2.1
#2 lore raw

PATCH 2/7 SQUASHME: pnfs_submit: remove inlines from *.c files

In reply to Fred Isaman
---
 fs/nfs/nfs4filelayoutdev.c |    2 +-
 fs/nfs/pnfs.c              |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
fs/nfs/nfs4filelayoutdev.c +1 -1
index 5da6fec..e0edf93 100644
@@ -559,7 +559,7 @@ nfs4_fl_find_get_deviceid(struct nfs_client *clp, struct nfs4_deviceid *id)
  * Want res = (offset - layout->pattern_offset)/ layout->stripe_unit
  * Then: ((res + fsi) % dsaddr->stripe_count)
  */
-static inline u32
+static u32
 _nfs4_fl_calc_j_index(struct pnfs_layout_segment *lseg, loff_t offset)
 {
 	struct nfs4_filelayout_segment *flseg = FILELAYOUT_LSEG(lseg);
fs/nfs/pnfs.c +2 -2
index 131602c..5ba2c45 100644
@@ -336,7 +336,7 @@ EXPORT_SYMBOL_GPL(put_lseg);
  * READ		READ	true
  * READ		RW	false
  */
-static inline int
+static int
 should_free_lseg(struct pnfs_layout_segment *lseg,
 		   struct pnfs_layout_range *range)
 {
@@ -344,7 +344,7 @@ should_free_lseg(struct pnfs_layout_segment *lseg,
 		lseg->range.iomode == range->iomode);
 }
 
-static inline bool
+static bool
 _pnfs_can_return_lseg(struct pnfs_layout_segment *lseg)
 {
 	return atomic_read(&lseg->kref.refcount) == 1;
Signature · 1 line
1.7.2.1
#3 lore raw

PATCH 3/7 SQUASHME: pnfs-devinfo-submit: fix comments in pnfs_layout*_release

In reply to Fred Isaman

comments were not changed with the functions

---
 fs/nfs/pnfs.c |   12 ++----------
 1 files changed, 2 insertions(+), 10 deletions(-)
fs/nfs/pnfs.c +2 -10
index 5ba2c45..7013916 100644
@@ -390,11 +390,7 @@ pnfs_layoutget_release(struct pnfs_layout_hdr *lo)
 	struct nfs_inode *nfsi = NFS_I(lo->inode);
 
 	spin_lock(&nfsi->vfs_inode.i_lock);
-	/*
-	 * Matched in _pnfs_update_layout for layoutget
-	 * and by get_layout in _pnfs_return_layout for layoutreturn
-	 */
-	put_layout_hdr_locked(lo);
+	put_layout_hdr_locked(lo); /* Matched in _pnfs_update_layout */
 	spin_unlock(&nfsi->vfs_inode.i_lock);
 	wake_up_all(&nfsi->lo_waitq);
 }
@@ -408,11 +404,7 @@ pnfs_layoutreturn_release(struct pnfs_layout_hdr *lo,
 	spin_lock(&nfsi->vfs_inode.i_lock);
 	if (range)
 		pnfs_clear_lseg_list(lo, range);
-	/*
-	 * Matched in _pnfs_update_layout for layoutget
-	 * and by get_layout in _pnfs_return_layout for layoutreturn
-	 */
-	put_layout_hdr_locked(lo);
+	put_layout_hdr_locked(lo); /* Matched in _pnfs_return_layout */
 	spin_unlock(&nfsi->vfs_inode.i_lock);
 	wake_up_all(&nfsi->lo_waitq);
 }
Signature · 1 line
1.7.2.1
#4 lore raw

PATCH 4/7 nfs: change end of line commas to semicolons

In reply to Fred Isaman

Fix a copy-paste error from a previous code reorg.

---
 fs/nfs/nfs4proc.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
fs/nfs/nfs4proc.c +6 -6
index 61a110d..aad6fdc 100644
@@ -1983,8 +1983,8 @@ int nfs4_do_close(struct path *path, struct nfs4_state *state, gfp_t gfp_mask, i
 	path_get(path);
 	calldata->path = *path;
 
-	msg.rpc_argp = &calldata->arg,
-	msg.rpc_resp = &calldata->res,
+	msg.rpc_argp = &calldata->arg;
+	msg.rpc_resp = &calldata->res;
 	task_setup_data.callback_data = calldata;
 	task = rpc_run_task(&task_setup_data);
 	if (IS_ERR(task))
@@ -4048,8 +4048,8 @@ static struct rpc_task *nfs4_do_unlck(struct file_lock *fl,
 		return ERR_PTR(-ENOMEM);
 	}
 
-	msg.rpc_argp = &data->arg,
-	msg.rpc_resp = &data->res,
+	msg.rpc_argp = &data->arg;
+	msg.rpc_resp = &data->res;
 	task_setup_data.callback_data = data;
 	return rpc_run_task(&task_setup_data);
 }
@@ -4286,8 +4286,8 @@ static int _nfs4_do_setlk(struct nfs4_state *state, int cmd, struct file_lock *f
 			data->arg.reclaim = NFS_LOCK_RECLAIM;
 		task_setup_data.callback_ops = &nfs4_recover_lock_ops;
 	}
-	msg.rpc_argp = &data->arg,
-	msg.rpc_resp = &data->res,
+	msg.rpc_argp = &data->arg;
+	msg.rpc_resp = &data->res;
 	task_setup_data.callback_data = data;
 	task = rpc_run_task(&task_setup_data);
 	if (IS_ERR(task))
Signature · 1 line
1.7.2.1
#5 lore raw

PATCH 5/7 SQUASHME: pnfs-devinfo-submit: Use only asynch error handler for LAYOUTGET

In reply to Fred Isaman

This corrects the problem where a retry uses freed memory.

---
 fs/nfs/nfs4proc.c |   38 +++++++++++++++-----------------------
 1 files changed, 15 insertions(+), 23 deletions(-)
fs/nfs/nfs4proc.c +15 -23
index aad6fdc..e28da81 100644
@@ -5426,15 +5426,26 @@ nfs4_layoutget_prepare(struct rpc_task *task, void *calldata)
 static void nfs4_layoutget_done(struct rpc_task *task, void *calldata)
 {
 	struct nfs4_layoutget *lgp = calldata;
+	struct nfs_server *server = NFS_SERVER(lgp->args.inode);
 
 	dprintk("--> %s\n", __func__);
 
 	if (!nfs4_sequence_done(task, &lgp->res.seq_res))
 		return;
 
-	/* Error handling done later using nfs4_handle_exception to get
-	 * exponential backoff.
-	 */
+	switch (task->tk_status) {
+	case 0:
+		break;
+	case -NFS4ERR_LAYOUTTRYLATER:
+	case -NFS4ERR_RECALLCONFLICT:
+		task->tk_status = -NFS4ERR_DELAY;
+		/* Fall through */
+	default:
+		if (nfs4_async_handle_error(task, server, NULL, NULL) == -EAGAIN) {
+			rpc_restart_call_prepare(task);
+			return;
+		}
+	}
 	lgp->status = task->tk_status;
 	dprintk("<-- %s\n", __func__);
 }
@@ -5458,7 +5469,7 @@ static const struct rpc_call_ops nfs4_layoutget_call_ops = {
 	.rpc_release = nfs4_layoutget_release,
 };
 
-static int _nfs4_proc_layoutget(struct nfs4_layoutget *lgp)
+int nfs4_proc_layoutget(struct nfs4_layoutget *lgp)
 {
 	struct nfs_server *server = NFS_SERVER(lgp->args.inode);
 	struct rpc_task *task;
@@ -5501,25 +5512,6 @@ out:
 	return status;
 }
 
-int nfs4_proc_layoutget(struct nfs4_layoutget *lgp)
-{
-	struct nfs_server *server = NFS_SERVER(lgp->args.inode);
-	struct nfs4_exception exception = { };
-	int err;
-	do {
-		err = _nfs4_proc_layoutget(lgp);
-		switch (err) {
-		case -NFS4ERR_LAYOUTTRYLATER:
-		case -NFS4ERR_RECALLCONFLICT:
-			err = -NFS4ERR_DELAY;
-			/* Fall through */
-		default:
-			err = nfs4_handle_exception(server, err, &exception);
-		}
-	} while (exception.retry);
-	return err;
-}
-
 static void nfs4_layoutcommit_prepare(struct rpc_task *task, void *data)
 {
 	struct nfs4_layoutcommit_data *ldata =
Signature · 1 line
1.7.2.1
#6 lore raw

PATCH 6/7 SQUASHME: pnfs_submit: Only use asynch error handler for LAYOUTCOMMIT

In reply to Fred Isaman
---
 fs/nfs/nfs4proc.c |   18 ++----------------
 1 files changed, 2 insertions(+), 16 deletions(-)
fs/nfs/nfs4proc.c +2 -16
index e28da81..0ac77a6 100644
@@ -5561,8 +5561,8 @@ static const struct rpc_call_ops nfs4_layoutcommit_ops = {
 };
 
 /* Execute a layoutcommit to the server */
-static int
-_nfs4_proc_layoutcommit(struct nfs4_layoutcommit_data *data, int issync)
+int
+nfs4_proc_layoutcommit(struct nfs4_layoutcommit_data *data, int issync)
 {
 	struct rpc_message msg = {
 		.rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_LAYOUTCOMMIT],
@@ -5605,20 +5605,6 @@ out:
 	return 0;
 }
 
-int nfs4_proc_layoutcommit(struct nfs4_layoutcommit_data *data, int issync)
-{
-	struct nfs4_exception exception = { };
-	struct nfs_server *server = NFS_SERVER(data->args.inode);
-	int err;
-
-	do {
-		err = nfs4_handle_exception(server,
-					_nfs4_proc_layoutcommit(data, issync),
-					&exception);
-	} while (exception.retry);
-	return err;
-}
-
 static void
 nfs4_layoutreturn_prepare(struct rpc_task *task, void *calldata)
 {
Signature · 1 line
1.7.2.1
#7 lore raw

PATCH 7/7 SQUASHME: pnfs_submit: only use asynch error handler for LAYOUTRETURN

In reply to Fred Isaman
---
 fs/nfs/nfs4proc.c |   15 +--------------
 1 files changed, 1 insertions(+), 14 deletions(-)
fs/nfs/nfs4proc.c +1 -14
index 0ac77a6..d29ed4b 100644
@@ -5662,7 +5662,7 @@ static const struct rpc_call_ops nfs4_layoutreturn_call_ops = {
 	.rpc_release = nfs4_layoutreturn_release,
 };
 
-int _nfs4_proc_layoutreturn(struct nfs4_layoutreturn *lrp, bool issync)
+int nfs4_proc_layoutreturn(struct nfs4_layoutreturn *lrp, bool issync)
 {
 	struct inode *ino = lrp->args.inode;
 	struct nfs_server *server = NFS_SERVER(ino);
@@ -5698,19 +5698,6 @@ out:
 	return status;
 }
 
-int nfs4_proc_layoutreturn(struct nfs4_layoutreturn *lrp, bool issync)
-{
-	struct nfs_server *server = NFS_SERVER(lrp->args.inode);
-	struct nfs4_exception exception = { };
-	int err;
-	do {
-		err = nfs4_handle_exception(server,
-				_nfs4_proc_layoutreturn(lrp, issync),
-				&exception);
-	} while (exception.retry);
-	return err;
-}
-
 static int
 _nfs4_proc_getdeviceinfo(struct nfs_server *server, struct pnfs_device *pdev)
 {
Signature · 1 line
1.7.2.1
#8 lore raw
In reply to Fred Isaman

Thanks. I'm merging all 7 and rebasing
so we can have a new tree before I fly out tomorrow morning.

Benny

Quoted 12 lines · Fred Isaman

The first 3 do some cleanup preparing for the hopefully final devinfo submission.

The last 3 fix some use of freed memory problems using the synch error handler (that were never being triggered because the asynch error handler got there first, at least until the LAYOUTGET code got restructured.)

Fred

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

#9 lore raw
Quoted 2 lines · Benny Halevy

Thanks. I'm merging all 7 and rebasing
so we can have a new tree before I fly out tomorrow morning.

merged (in pnfs-submit, pnfs-submit-all) at pnfs-all-2.6.36-rc6-2010-10-01

Thanks!

Benny

Quoted 20 lines

Benny

Quoted 6 lines · Fred Isaman

The first 3 do some cleanup preparing for the hopefully final devinfo submission.

The last 3 fix some use of freed memory problems using the synch error handler (that were never being triggered because the asynch error handler got there first, at least until the LAYOUTGET code got restructured.)

Quoted 6 lines

Fred

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

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