pnfs callback fixes
Subsystems (2)
cover pnfs callback fixes
A small crop of fixes for pnfs callbacks.
[PATCH 1/3] SQUASHME: pnfsd: move kfree of the cb_layout rpc_args to release time [PATCH 2/3] SQUASHME: pnfsd: move kfree of the cb_device rpc_args to release time [PATCH 3/3] pnfsd: reset status on NFS4ERR_NOMATCHING_LAYOUT
All of these patches, plus
bc210d8 pnfs: Fix num_ds bug in nfsd4_set_pnfs_dlm_device() 3baf7bf SQUASHME: pnfs-obj: use NFSDBG_PNFS_LD also in pnfs_osd_xdr_cli.c
are in pnfs-all-latest at pnfs-all-2.6.35-rc3-2010-06-18
I'll rebase them onto their respective branches after the Bakethon...
Benny
PATCH 1/3 SQUASHME: pnfsd: move kfree of the cb_layout rpc_args to release time
--- fs/nfsd/nfs4callback.c | 4 +++- include/linux/nfsd/nfsd4_pnfs.h | 2 ++ 2 files changed, 5 insertions(+), 1 deletions(-)
fs/nfsd/nfs4callback.c +3 -1
@@ -1020,7 +1020,6 @@ static void nfsd4_cb_layout_done(struct rpc_task *task, void *calldata)struct nfs4_client *clp = clr->clr_client;nfsd4_cb_done_sequence (task, clp); -kfree (task->tk_msg.rpc_argp);if (!task->tk_status)return ;
@@ -1057,6 +1056,8 @@ static void nfsd4_cb_layout_done(struct rpc_task *task, void *calldata)static void nfsd4_cb_layout_release (void *calldata) {struct nfs4_layoutrecall *clr = calldata; +kfree (clr->clr_args); + clr->clr_args =NULL ;put_layoutrecall (clr); }
@@ -1086,6 +1087,7 @@ nfsd4_cb_layout(struct nfs4_layoutrecall *clr) status = -ENOMEM ; goto out; } + clr->clr_args = args; args->args_op = clr; msg.rpc_argp = args; status = rpc_call_async(clnt, &msg, RPC_TASK_SOFT,
include/linux/nfsd/nfsd4_pnfs.h +2 -0
@@ -234,6 +234,8 @@ struct nfs4_layoutrecall {struct timespec clr_time;/* last activity */ struct super_block *clr_sb;/* We might not have a file */ struct nfs4_layoutrecall *parent;/* The initiating recall */ + +void *clr_args;/* nfsd internal */ };struct nfsd4_pnfs_cb_dev_item {
Signature · 1 line
1.6.4.4
PATCH 2/3 SQUASHME: pnfsd: move kfree of the cb_device rpc_args to release time
In reply to Benny HalevyAlso, fix a bug in nfsd_device_notify_cb where the nfs4_notify_device structure was kfreed while the async callback was in progress.
--- fs/nfsd/nfs4callback.c | 10 +++++++++- fs/nfsd/nfs4pnfsd.c | 5 +++-- fs/nfsd/pnfsd.h | 2 ++ 3 files changed, 14 insertions(+), 3 deletions(-)
fs/nfsd/nfs4callback.c +9 -1
@@ -1113,7 +1113,6 @@ static void nfsd4_cb_device_done(struct rpc_task *task, void *calldata)struct nfs4_client *clp = cbnd->nd_client;nfsd4_cb_done_sequence (task, clp); -kfree (task->tk_msg.rpc_argp); dprintk("%s: clp %p cb_client %p: status %d\n", __func__,
@@ -1128,9 +1127,18 @@ static void nfsd4_cb_device_done(struct rpc_task *task, void *calldata) } } +static void nfsd4_cb_device_release (void *calldata) +{ +struct nfs4_notify_device *cbnd = calldata; +kfree (cbnd->nd_args); + cbnd->nd_args =NULL ; +kfree (cbnd); +} +static const struct rpc_call_ops nfsd4_cb_device_ops = { .rpc_call_prepare = nfsd4_cb_device_prepare, .rpc_call_done = nfsd4_cb_device_done, + .rpc_release = nfsd4_cb_device_release, };/*
fs/nfsd/nfs4pnfsd.c +3 -2
@@ -1666,10 +1666,11 @@ int nfsd_device_notify_cb(struct super_block *sb,list_del_init (&cbnd->nd_perclnt); status2 =nfsd4_cb_notify_device (cbnd);pnfs_clear_device_notify (cbnd->nd_client); -if (status2) +if (status2) { +kfree (cbnd); status = status2; + } notify_num++; -kfree (cbnd); } dprintk("NFSD %s: status %d clients %u\n",
fs/nfsd/pnfsd.h +2 -0
@@ -109,6 +109,8 @@ struct nfs4_notify_device {struct nfsd4_pnfs_cb_dev_list *nd_list;struct nfs4_client *nd_client;struct list_head nd_perclnt; + +void *nd_args;/* nfsd internal */ };u64 find_create_sbid (struct super_block *);
Signature · 1 line
1.6.4.4
PATCH 3/3 pnfsd: reset status on NFS4ERR_NOMATCHING_LAYOUT
In reply to Benny HalevyAlthough it's encoded as an error on the protocol level it's actualy a success, just short circuited.
--- fs/nfsd/nfs4callback.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
fs/nfsd/nfs4callback.c +1 -0
@@ -1049,6 +1049,7 @@ static void nfsd4_cb_layout_done(struct rpc_task *task, void *calldata)rpc_restart_call (task);break ;case -NFS4ERR_NOMATCHING_LAYOUT : + task->tk_status =0 ;nomatching_layout (clr); } }
Signature · 1 line
1.6.4.4