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
These are various minor touchups to the devinfo submission code
Signed-off-by: Fred Isaman <[email protected]>
---
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(-)
diff --git a/fs/nfs/nfs4filelayout.c b/fs/nfs/nfs4filelayout.c
index a33c47e..2b6e3c9 100644
--- a/fs/nfs/nfs4filelayout.c
+++ b/fs/nfs/nfs4filelayout.c
@@ -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;
diff --git a/fs/nfs/nfs4filelayoutdev.c b/fs/nfs/nfs4filelayoutdev.c
index e4f91f6..5da6fec 100644
--- a/fs/nfs/nfs4filelayoutdev.c
+++ b/fs/nfs/nfs4filelayoutdev.c
@@ -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)
{
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index 333b7db..131602c 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -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);
diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h
index 9500aa4..4ea3ae0 100644
--- a/fs/nfs/pnfs.h
+++ b/fs/nfs/pnfs.h
@@ -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)
diff --git a/fs/nfs/read.c b/fs/nfs/read.c
index be29689..c34f97d 100644
--- a/fs/nfs/read.c
+++ b/fs/nfs/read.c
@@ -29,7 +29,6 @@
#include "internal.h"
#include "iostat.h"
#include "fscache.h"
-#include "pnfs.h"
#define NFSDBG_FACILITY NFSDBG_PAGECACHE
--
1.7.2.1
Signed-off-by: Fred Isaman <[email protected]>
---
fs/nfs/nfs4proc.c | 15 +--------------
1 files changed, 1 insertions(+), 14 deletions(-)
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 0ac77a6..d29ed4b 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -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)
{
--
1.7.2.1
This corrects the problem where a retry uses freed memory.
Signed-off-by: Fred Isaman <[email protected]>
---
fs/nfs/nfs4proc.c | 38 +++++++++++++++-----------------------
1 files changed, 15 insertions(+), 23 deletions(-)
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index aad6fdc..e28da81 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -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 =
--
1.7.2.1
Signed-off-by: Fred Isaman <[email protected]>
---
fs/nfs/nfs4proc.c | 18 ++----------------
1 files changed, 2 insertions(+), 16 deletions(-)
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index e28da81..0ac77a6 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -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)
{
--
1.7.2.1
Signed-off-by: Fred Isaman <[email protected]>
---
fs/nfs/nfs4filelayoutdev.c | 2 +-
fs/nfs/pnfs.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/fs/nfs/nfs4filelayoutdev.c b/fs/nfs/nfs4filelayoutdev.c
index 5da6fec..e0edf93 100644
--- a/fs/nfs/nfs4filelayoutdev.c
+++ b/fs/nfs/nfs4filelayoutdev.c
@@ -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);
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index 131602c..5ba2c45 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -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;
--
1.7.2.1
Fix a copy-paste error from a previous code reorg.
Signed-off-by: Fred Isaman <[email protected]>
---
fs/nfs/nfs4proc.c | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 61a110d..aad6fdc 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -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))
--
1.7.2.1
comments were not changed with the functions
Signed-off-by: Fred Isaman <[email protected]>
---
fs/nfs/pnfs.c | 12 ++----------
1 files changed, 2 insertions(+), 10 deletions(-)
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index 5ba2c45..7013916 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -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);
}
--
1.7.2.1
Thanks. I'm merging all 7 and rebasing
so we can have a new tree before I fly out tomorrow morning.
Benny
On 2010-10-01 18:02, Fred Isaman wrote:
> 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
On 2010-10-01 18:30, Benny Halevy wrote:
> 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
>
> Benny
>
> On 2010-10-01 18:02, Fred Isaman wrote:
>> 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
> --
> 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