pnfs: unlock lo_lock spinlock before calling specific layoutdriver's setup_layoutcommit() operation.
Subsystems (2)
RFC PATCH 1/1 pnfs: unlock lo_lock spinlock before calling specific layoutdriver's setup_layoutcommit() operation.
So in blocklayoutdriver, we can use GFP_KERNEL to do memory allocation in bl_setup_layoutcommit().
--- fs/nfs/pnfs.c | 42 +++++++++++++++++++++--------------------- 1 files changed, 21 insertions(+), 21 deletions(-)
fs/nfs/pnfs.c +21 -21
@@ -2073,15 +2073,23 @@ pnfs_layoutcommit_done(struct pnfs_layoutcommit_data *data)* Set up the argument/result storage required for the RPC call. */ static int -pnfs_layoutcommit_setup (struct pnfs_layoutcommit_data *data,int sync) +pnfs_layoutcommit_setup (struct inode *inode, +struct pnfs_layoutcommit_data *data,int sync) { -struct nfs_inode *nfsi =NFS_I (data->args.inode); -struct nfs_server *nfss =NFS_SERVER (data->args.inode); +struct nfs_inode *nfsi =NFS_I (inode); +struct nfs_server *nfss =NFS_SERVER (inode);int result =0 ;dprintk ("%s Begin (sync:%d)\n" , __func__, sync); + data->is_sync = sync; + data->cred = nfsi->layoutcommit_ctx->cred; + data->ctx = nfsi->layoutcommit_ctx; + data->args.inode = inode; data->args.fh =NFS_FH (data->args.inode); data->args.layout_type = nfss->pnfs_curr_ld->id; +pnfs_get_layout_stateid (&data->args.stateid, &nfsi->layout); + data->res.fattr = &data->fattr; +nfs_fattr_init (&data->fattr);/* TODO: Need to determine the correct values */ data->args.time_modify_changed =0 ;
@@ -2095,6 +2103,7 @@ pnfs_layoutcommit_setup(struct pnfs_layoutcommit_data *data, int sync) i_size_read(&nfsi->vfs_inode) - 1); data->args.bitmask = nfss->attr_bitmask; data->res.server = nfss; +spin_unlock (&nfsi->lo_lock);/* Call layout driver to set the arguments. */
@@ -2104,10 +2113,6 @@ pnfs_layoutcommit_setup(struct pnfs_layoutcommit_data *data, int sync)if (result) goto out; } -pnfs_get_layout_stateid (&data->args.stateid, &nfsi->layout); - data->res.fattr = &data->fattr; -nfs_fattr_init (&data->fattr); - out:dprintk ("%s End Status %d\n" , __func__, result);return result;
@@ -2131,36 +2136,31 @@ pnfs_layoutcommit_inode(struct inode *inode, int sync)return -ENOMEM ;spin_lock (&nfsi->lo_lock); -if (!nfsi->layoutcommit_ctx) - goto out_unlock; - - data->args.inode = inode; - data->cred = nfsi->layoutcommit_ctx->cred; - data->ctx = nfsi->layoutcommit_ctx; +if (!nfsi->layoutcommit_ctx) { +spin_unlock (&nfsi->lo_lock); + goto out_free; + } -/* Set up layout commit args*/ - status =pnfs_layoutcommit_setup (data, sync); +/* Set up layout commit args */ + status =pnfs_layoutcommit_setup (inode, data, sync);if (status) - goto out_unlock; + goto out_free;/* Clear layoutcommit properties in the inode so * new lc info can be generated */ +spin_lock (&nfsi->lo_lock); nfsi->pnfs_write_begin_pos =0 ; nfsi->pnfs_write_end_pos =0 ; nfsi->layoutcommit_ctx =NULL ; - -/* release lock on pnfs layoutcommit attrs */ spin_unlock (&nfsi->lo_lock); - data->is_sync = sync; status =pnfs4_proc_layoutcommit (data); out:dprintk ("%s end (err:%d)\n" , __func__, status);return status; -out_unlock: +out_free:pnfs_layoutcommit_free (data); -spin_unlock (&nfsi->lo_lock); goto out; }
Signature · 1 line
1.6.3.3
Quoted 83 lines · Tao Guo
So in blocklayoutdriver, we can use
GFP_KERNELto do memory allocation inbl_setup_layoutcommit().Signed-off-by Tao Guo <[email protected]>---
fs/nfs/pnfs.c| 42 +++++++++++++++++++++---------------------1 files changed, 21 insertions(+), 21 deletions(-)fs/nfs/pnfs.c +0
-0@@ -2073,15 +2073,23 @@ pnfs_layoutcommit_done(structpnfs_layoutcommit_data *data) * Set up the argument/result storage required for the RPC call. */ static int
-pnfs_layoutcommit_setup(structpnfs_layoutcommit_data*data, int sync)fs/nfs/pnfs.c +2
-0+pnfs_layoutcommit_setup(struct inode *inode, + struct pnfs_layoutcommit_data *data, int sync){
fs/nfs/pnfs.c +2
-2-struct nfs_inode *nfsi =NFS_I (data->args.inode); -struct nfs_server *nfss =NFS_SERVER (data->args.inode); +struct nfs_inode *nfsi =NFS_I (inode); +struct nfs_server *nfss =NFS_SERVER (inode);int result = 0; dprintk("%s Begin (sync:%d)\n", __func__, sync);fs/nfs/pnfs.c +4
-0+ data->is_sync = sync; + data->cred = nfsi->layoutcommit_ctx->cred; + data->ctx = nfsi->layoutcommit_ctx; + data->args.inode = inode;data->args.fh = NFS_FH(data->args.inode); data->args.layout_type = nfss->pnfs_curr_ld->id;fs/nfs/pnfs.c +3
-0+pnfs_get_layout_stateid (&data->args.stateid, &nfsi->layout); + data->res.fattr = &data->fattr; +nfs_fattr_init (&data->fattr);/* TODO: Need to determine the correct values */ data->args.time_modify_changed = 0;fs/nfs/pnfs.c +1
-0@@ -2095,6 +2103,7 @@ pnfs_layoutcommit_setup(struct pnfs_layoutcommit_data *data, int sync) i_size_read(&nfsi->vfs_inode) - 1); data->args.bitmask = nfss->attr_bitmask; data->res.server = nfss; +spin_unlock (&nfsi->lo_lock);/* Call layout driver to set the arguments. */fs/nfs/pnfs.c +0
-4@@ -2104,10 +2113,6 @@ pnfs_layoutcommit_setup(struct pnfs_layoutcommit_data *data, int sync) if (result) goto out; } -pnfs_get_layout_stateid (&data->args.stateid, &nfsi->layout); - data->res.fattr = &data->fattr; -nfs_fattr_init (&data->fattr); -out:
dprintk("%s End Status %d\n", __func__, result); return result;fs/nfs/pnfs.c +6
-8@@ -2131,36 +2136,31 @@ pnfs_layoutcommit_inode(struct inode *inode, int sync)return -ENOMEM ;spin_lock (&nfsi->lo_lock); -if (!nfsi->layoutcommit_ctx) - goto out_unlock; - - data->args.inode = inode; - data->cred = nfsi->layoutcommit_ctx->cred; - data->ctx = nfsi->layoutcommit_ctx; +if (!nfsi->layoutcommit_ctx) { +spin_unlock (&nfsi->lo_lock); + goto out_free; + } -/* Set up layout commit args*/ - status =pnfs_layoutcommit_setup (data, sync); +/* Set up layout commit args */ + status =pnfs_layoutcommit_setup (inode, data, sync);if (status)
fs/nfs/pnfs.c pnfs_layoutcommit_inode(struct inode *inode, · line 2156
Quoted 10 lines
fs/nfs/pnfs.c +2
-1- goto out_unlock; + goto out_free;/* Clear layoutcommit properties in the inode so * new lc info can be generated */ +spin_lock (&nfsi->lo_lock); nfsi->pnfs_write_begin_pos =0 ; nfsi->pnfs_write_end_pos =0 ; nfsi->layoutcommit_ctx =NULL ;
These should be cleared before the spin_lock is released in pnfs_layoutcommit_setup. They should be cleared (and the layoutcommit_cxt put) upon a layoutdriver setup_layoutcommit failure.
-->Andy
Quoted 23 lines
fs/nfs/pnfs.c +0
-3- -/* release lock on pnfs layoutcommit attrs */ spin_unlock (&nfsi->lo_lock); - data->is_sync = sync; status =pnfs4_proc_layoutcommit (data);out:
dprintk("%s end (err:%d)\n", __func__, status); return status;fs/nfs/pnfs.c +1
-1-out_unlock: +out_free:pnfs_layoutcommit_free(data);fs/nfs/pnfs.c +0
-1-spin_unlock (&nfsi->lo_lock);goto out; }Signature · 6 lines
1.6.3.3 -- 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 Fri, May 21, 2010 at 12:13 AM, Andy Adamson <[email protected]> wrot= e:
Quoted 11 lines · Tao Guo
Quoted 9 lines
So in blocklayoutdriver, we can use
GFP_KERNELto do memory allocation inbl_setup_layoutcommit().Signed-off-by Tao Guo <[email protected]>---
fs/nfs/pnfs.c| =C2=A0 42 +++++++++++++++++++++---------------------1 files changed, 21 insertions(+), 21 deletions(-)
Quoted 7 lines
Quoted 7 lines
fs/nfs/pnfs.c +0
-0@@ -2073,15 +2073,23 @@ pnfs_layoutcommit_done(struct pnfs_layoutcommit_data *data)=C2=A0* Set up the argument/result storage required for the RPC call=
=2E
Quoted 3 lines
Quoted 3 lines
=C2=A0*/
static int
-pnfs_layoutcommit_setup(structpnfs_layoutcommit_data*data, int sy=
nc)
Quoted 2 lines
Quoted 2 lines
+pnfs_layoutcommit_setup(struct inode *inode,
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 struct pnfs_layoutcommit_data *data, int sync)
Quoted 2 lines
Quoted 2 lines
{
- =C2=A0 =C2=A0 =C2=A0 structnfs_inode*nfsi =3D NFS_I(data->args.i=
node);
Quoted 1 line
Quoted 1 line
- =C2=A0 =C2=A0 =C2=A0 struct
nfs_server*nfss =3D NFS_SERVER(data->=
args.inode);
Quoted 2 lines
Quoted 2 lines
+ =C2=A0 =C2=A0 =C2=A0 struct
nfs_inode*nfsi =3DNFS_I(inode);
+ =C2=A0 =C2=A0 =C2=A0 structnfs_server*nfss =3D NFS_SERVER(inode)=
;
Quoted 3 lines
Quoted 3 lines
=C2=A0 =C2=A0 =C2=A0 =C2=A0int result =3D 0;
=C2=A0 =C2=A0 =C2=A0 =C2=A0dprintk("%s Begin (sync:%d)\n", __func__,=
sync);
Quoted 2 lines
Quoted 2 lines
+ =C2=A0 =C2=A0 =C2=A0
data->is_sync=3D sync;
+ =C2=A0 =C2=A0 =C2=A0data->cred=C2=A0=3D nfsi->layoutcommit_ctx->=
cred;
Quoted 3 lines
Quoted 3 lines
+ =C2=A0 =C2=A0 =C2=A0
data->ctx=3Dnfsi->layoutcommit_ctx;
+ =C2=A0 =C2=A0 =C2=A0data->args.inode=3D inode;
=C2=A0 =C2=A0 =C2=A0 =C2=A0data->args.fh =3D NFS_FH(data->args.inode=
);
Quoted 1 line
Quoted 1 line
=C2=A0 =C2=A0 =C2=A0 =C2=A0data->args.layout_type =3D nfss->pnfs_cur=
r_ld->id;
Quoted 1 line
Quoted 1 line
+ =C2=A0 =C2=A0 =C2=A0 pnfs_get_layout_stateid(&data->args.stateid, =
&nfsi->layout);
Quoted 4 lines
Quoted 4 lines
+ =C2=A0 =C2=A0 =C2=A0
data->res.fattr=3D&data->fattr;
+ =C2=A0 =C2=A0 =C2=A0nfs_fattr_init(&data->fattr);=C2=A0 =C2=A0 =C2=A0 =C2=A0/* TODO: Need to determine the correct va=
lues */
Quoted 4 lines
Quoted 4 lines
=C2=A0 =C2=A0 =C2=A0 =C2=A0data->args.time_modify_changed =3D 0;
fs/nfs/pnfs.c +0
-0@@ -2095,6 +2103,7 @@ pnfs_layoutcommit_setup(struct pnfs_layoutcommit_data *data, int sync)=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0i=_size_read(&nfsi->vfs_inode) - 1);
Quoted 1 line
Quoted 1 line
=C2=A0 =C2=A0 =C2=A0 =C2=A0data->args.bitmask =3D nfss->attr_bitmask=
;
Quoted 4 lines
Quoted 4 lines
=C2=A0 =C2=A0 =C2=A0 =C2=A0data->res.server =3D nfss;
+ =C2=A0 =C2=A0 =C2=A0spin_unlock(&nfsi->lo_lock);=C2=A0 =C2=A0 =C2=A0 =C2=A0/* Call layout driver to set the argument=
s.
Quoted 5 lines
Quoted 5 lines
=C2=A0 =C2=A0 =C2=A0 =C2=A0 */
fs/nfs/pnfs.c +0
-0@@ -2104,10 +2113,6 @@ pnfs_layoutcommit_setup(struct pnfs_layoutcommit_data *data, int sync) =C2 =A0 =C2 =A0 =C2 =A0 =C2 =A0 =C2 =A0 =C2 =A0 =C2 =A0 =C2 =A0if (result)=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
=C2=A0 =C2=A0goto out;
Quoted 2 lines
Quoted 2 lines
=C2=A0 =C2=A0 =C2=A0 =C2=A0}
- =C2=A0 =C2=A0 =C2=A0 pnfs_get_layout_stateid(&data->args.stateid, =
&nfsi->layout);
Quoted 5 lines
Quoted 5 lines
- =C2=A0 =C2=A0 =C2=A0
data->res.fattr=3D&data->fattr;
- =C2=A0 =C2=A0 =C2=A0nfs_fattr_init(&data->fattr);
-
out:
=C2=A0 =C2=A0 =C2=A0 =C2=A0dprintk("%s End Status %d\n",__func__, r=
esult);
Quoted 2 lines
fs/nfs/pnfs.c pnfs_layoutcommit_inode(struct inode *inode,=
Quoted 2 lines
=C2=A0 =C2=A0 =C2=A0 =C2=A0return result;
fs/nfs/pnfs.c +0
-0@@ -2131,36 +2136,31 @@ pnfs_layoutcommit_inode(struct inode *inode,=
int
Quoted 2 lines
Quoted 2 lines
fs/nfs/pnfs.c +0
-0sync)=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return -ENOME=
M;
Quoted 7 lines
Quoted 7 lines
=C2=A0 =C2=A0 =C2=A0 =C2=A0spin_lock(&nfsi->lo_lock);
- =C2=A0 =C2=A0 =C2=A0 if (!nfsi->layoutcommit_ctx)
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 gotoout_unlock; -
- =C2=A0 =C2=A0 =C2=A0data->args.inode=3D inode;
- =C2=A0 =C2=A0 =C2=A0data->cred=C2=A0=3D nfsi->layoutcommit_ctx->=
cred;
Quoted 3 lines
Quoted 3 lines
- =C2=A0 =C2=A0 =C2=A0
data->ctx=3Dnfsi->layoutcommit_ctx;
+ =C2=A0 =C2=A0 =C2=A0 if (!nfsi->layoutcommit_ctx) {
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 spin_unlock(&nfsi=
->lo_lock);
Quoted 5 lines
Quoted 5 lines
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 goto
out_free;
+ =C2=A0 =C2=A0 =C2=A0 }- =C2=A0 =C2=A0 =C2=A0 /* Set up layout commit args*/
- =C2=A0 =C2=A0 =C2=A0 status =3D pnfs_layoutcommit_setup(data, sync=
);
Quoted 2 lines
Quoted 2 lines
+ =C2=A0 =C2=A0 =C2=A0 /* Set up layout commit args */
+ =C2=A0 =C2=A0 =C2=A0 status =3D pnfs_layoutcommit_setup(inode, dat=
a, sync);
Quoted 5 lines
Quoted 5 lines
=C2=A0 =C2=A0 =C2=A0 =C2=A0if (status)
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 gotoout_unlock;
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 gotoout_free;=C2=A0 =C2=A0 =C2=A0 =C2=A0/* Clear layoutcommit properties in the i=
node so
Quoted 10 lines
Quoted 6 lines
=C2=A0 =C2=A0 =C2=A0 =C2=A0 * new lc info can be generated =C2=A0 =C2=A0 =C2=A0 =C2=A0 */
+ =C2=A0 =C2=A0 =C2=A0spin_lock(&nfsi->lo_lock); =C2=A0 =C2=A0 =C2=A0 =C2=A0nfsi->pnfs_write_begin_pos =3D 0; =C2=A0 =C2=A0 =C2=A0 =C2=A0nfsi->pnfs_write_end_pos =3D 0; =C2=A0 =C2=A0 =C2=A0 =C2=A0nfsi->layoutcommit_ctx =3D NULL;These should be cleared before the
spin_lockis released inpnfs_layoutcommit_setup.
They should be cleared (and thelayoutcommit_cxtput) upon a layoutdr=
iver
Quoted 3 lines
setup_layoutcommitfailure.-->Andy
I just followed the old code's logic: if a layoutdriver's setup_layoutcommit call failed(like return -ENOMEM), we just keep nfs_inode's everything unchanged, so maybe next time we can try again later. However, this will lead to lock lo_lock two times as in the above code.
Maybe I should break the code's logic...
Quoted 9 lines
Quoted 9 lines
-
- =C2=A0 =C2=A0 =C2=A0 /* release lock on pnfs layoutcommit attrs */ =C2=A0 =C2=A0 =C2=A0 =C2=A0spin_unlock(&nfsi->lo_lock);- =C2=A0 =C2=A0 =C2=A0
data->is_sync=3D sync;
=C2=A0 =C2=A0 =C2=A0 =C2=A0status =3Dpnfs4_proc_layoutcommit(data); out:
=C2=A0 =C2=A0 =C2=A0 =C2=A0dprintk("%s end (err:%d)\n",__func__, st=
atus);
Quoted 10 lines
Quoted 10 lines
=C2=A0 =C2=A0 =C2=A0 =C2=A0return status;
fs/nfs/pnfs.c +1
-1-out_unlock: +out_free:=C2=A0 =C2=A0 =C2=A0 =C2=A0pnfs_layoutcommit_free(data);
- =C2=A0 =C2=A0 =C2=A0spin_unlock(&nfsi->lo_lock); =C2=A0 =C2=A0 =C2=A0 =C2=A0goto out;
}--
1.6.3.3
--=20
tao.
Quoted 1 line · Tao Guo
On Fri, May 21, 2010 at 12:13 AM, Andy Adamson <[email protected]> wr=
ote:
Quoted 11 lines
Quoted 11 lines · Tao Guo
Quoted 9 lines
So in blocklayoutdriver, we can use
GFP_KERNELto do memory allocation inbl_setup_layoutcommit().Signed-off-by Tao Guo <[email protected]>---
fs/nfs/pnfs.c| =A0 42 +++++++++++++++++++++---------------------1 files changed, 21 insertions(+), 21 deletions(-)
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
fs/nfs/pnfs.c +0
-0@@ -2073,15 +2073,23 @@ pnfs_layoutcommit_done(struct pnfs_layoutcommit_data *data)=A0* Set up the argument/result storage required for the RPC call. =A0*/
static int
-pnfs_layoutcommit_setup(structpnfs_layoutcommit_data*data, int s=
ync)
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
+pnfs_layoutcommit_setup(struct inode *inode,
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 struct pnfs_layoutcom=
mit_data *data, int sync)
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
{
- =A0 =A0 =A0 structnfs_inode*nfsi =3DNFS_I(data->args.inode);
- =A0 =A0 =A0 structnfs_server*nfss =3D NFS_SERVER(data->args.ino=
de);
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
+ =A0 =A0 =A0 struct
nfs_inode*nfsi =3DNFS_I(inode);
+ =A0 =A0 =A0 structnfs_server*nfss =3DNFS_SERVER(inode); =A0 =A0 =A0 =A0int result =3D 0;
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
=A0 =A0 =A0 =A0dprintk("%s Begin (sync:%d)\n",
__func__, sync);
+ =A0 =A0 =A0data->is_sync=3D sync;
+ =A0 =A0 =A0data->cred=A0=3Dnfsi->layoutcommit_ctx->cred;
+ =A0 =A0 =A0data->ctx=3Dnfsi->layoutcommit_ctx;
+ =A0 =A0 =A0data->args.inode=3D inode;
=A0 =A0 =A0 =A0data->args.fh =3DNFS_FH(data->args.inode); =A0 =A0 =A0 =A0data->args.layout_type =3Dnfss->pnfs_curr_ld->id;
+ =A0 =A0 =A0 pnfs_get_layout_stateid(&data->args.stateid, &nfsi->l=
ayout);
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
+ =A0 =A0 =A0
data->res.fattr=3D&data->fattr;
+ =A0 =A0 =A0nfs_fattr_init(&data->fattr);=A0 =A0 =A0 =A0/* TODO: Need to determine the correct values */ =A0 =A0 =A0 =A0data->args.time_modify_changed =3D 0;
fs/nfs/pnfs.c +0
-0@@ -2095,6 +2103,7 @@ pnfs_layoutcommit_setup(struct pnfs_layoutcommit_data *data, int sync)=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=
=A0 =A0 =A0i_size_read(&nfsi->vfs_inode) - 1);
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
=A0 =A0 =A0 =A0data->args.bitmask =3D
nfss->attr_bitmask; =A0 =A0 =A0 =A0data->res.server =3D nfss;
+ =A0 =A0 =A0spin_unlock(&nfsi->lo_lock);
Quoted 8 lines
Quoted 8 lines
fs/nfs/pnfs.c pnfs_layoutcommit_setup(struct · line 2108
Quoted 8 lines
=A0 =A0 =A0 =A0/* Call layout driver to set the arguments. =A0 =A0 =A0 =A0 */
fs/nfs/pnfs.c +0
-1@@ -2104,10 +2113,6 @@ pnfs_layoutcommit_setup(struct pnfs_layoutcommit_data *data, int sync) =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0if (result) =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0goto out; =A0 =A0 =A0 =A0} - =A0 =A0 =A0 pnfs_get_layout_stateid(&data->args.stateid, &nfsi->l=
ayout);
Quoted 7 lines
Quoted 7 lines
fs/nfs/pnfs.c pnfs_layoutcommit_inode(struct inode *inode=
Quoted 7 lines
fs/nfs/pnfs.c +0
-3- =A0 =A0 =A0 data->res.fattr =3D &data->fattr; - =A0 =A0 =A0 nfs_fattr_init(&data->fattr); -out:
=A0 =A0 =A0 =A0dprintk("%s End Status %d\n",__func__, result); =A0 =A0 =A0 =A0return result;fs/nfs/pnfs.c +0
-0@@ -2131,36 +2136,31 @@ pnfs_layoutcommit_inode(struct inode *inode=
, int
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
fs/nfs/pnfs.c +4
-6sync) =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0return -ENOMEM ; =A0 =A0 =A0 =A0spin_lock(&nfsi->lo_lock); - =A0 =A0 =A0 if (!nfsi->layoutcommit_ctx) - =A0 =A0 =A0 =A0 =A0 =A0 =A0 goto out_unlock; - - =A0 =A0 =A0 data->args.inode =3D inode; - =A0 =A0 =A0 data->cred =A0=3D nfsi->layoutcommit_ctx->cred; - =A0 =A0 =A0 data->ctx =3D nfsi->layoutcommit_ctx; + =A0 =A0 =A0 if (!nfsi->layoutcommit_ctx) { + =A0 =A0 =A0 =A0 =A0 =A0 =A0 spin_unlock(&nfsi->lo_lock); + =A0 =A0 =A0 =A0 =A0 =A0 =A0 goto out_free; + =A0 =A0 =A0 }
Quoted 4 lines
Quoted 4 lines
fs/nfs/pnfs.c pnfs_layoutcommit_inode(struct inode *inode= · line 2146
Quoted 4 lines
fs/nfs/pnfs.c +2
-2- =A0 =A0 =A0 /* Set up layout commit args*/ - =A0 =A0 =A0 status =3D pnfs_layoutcommit_setup(data, sync); + =A0 =A0 =A0 /* Set up layout commit args */ + =A0 =A0 =A0 status =3D pnfs_layoutcommit_setup(inode, data, sync)=
;
Quoted 12 lines
Quoted 12 lines
Quoted 11 lines
fs/nfs/pnfs.c +1
-1=A0 =A0 =A0 =A0if (status) - =A0 =A0 =A0 =A0 =A0 =A0 =A0 goto out_unlock; + =A0 =A0 =A0 =A0 =A0 =A0 =A0 goto out_free;=A0 =A0 =A0 =A0/* Clear layoutcommit properties in the inode so =A0 =A0 =A0 =A0 * new lc info can be generated
=A0 =A0 =A0 =A0 */
+ =A0 =A0 =A0spin_lock(&nfsi->lo_lock);
=A0 =A0 =A0 =A0nfsi->pnfs_write_begin_pos =3D 0;
=A0 =A0 =A0 =A0nfsi->pnfs_write_end_pos =3D 0;
=A0 =A0 =A0 =A0nfsi->layoutcommit_ctx =3D NULL;
Quoted 3 lines
Quoted 3 lines
These should be cleared before the
spin_lockis released inpnfs_layoutcommit_setup.
They should be cleared (and thelayoutcommit_cxtput) upon a layoutd=
river
Quoted 7 lines
Quoted 3 lines
setup_layoutcommitfailure.-->Andy
I just followed the old code's logic: if a layoutdriver's
setup_layoutcommitcall failed(like return-ENOMEM), we just keep nfs_inode's everything unchanged, so maybe next time we can try again later.
With a chance of another call immediately which will probably fail and = so on
Quoted 2 lines
However, this will lead to lock
lo_locktwo times as in the above code.
Note that when the setup_layoutcommit call succeeds, this code changes the logic in that the old code did not give up the spin lock before resetting the layout properties.
Quoted 1 line
Maybe I should break the code's logic...
I think so. If the layoutdriver has an error that it can recover from, it should do so before returning. An ENOMEM error means that things are really bad, and that the layoutdriver won't be able to do much of anything.
Generally, we need to review the response to layoutcommit errors.
-->Andy
Quoted 17 lines
Quoted 17 lines
Quoted 17 lines
-
- =A0 =A0 =A0 /* release lock on pnfs layoutcommit attrs */ =A0 =A0 =A0 =A0spin_unlock(&nfsi->lo_lock);- =A0 =A0 =A0
data->is_sync=3D sync;
=A0 =A0 =A0 =A0status =3Dpnfs4_proc_layoutcommit(data); out:
=A0 =A0 =A0 =A0dprintk("%s end (err:%d)\n",__func__, status); =A0 =A0 =A0 =A0return status;fs/nfs/pnfs.c +1
-1-out_unlock: +out_free:=A0 =A0 =A0 =A0pnfs_layoutcommit_free(data);
- =A0 =A0 =A0spin_unlock(&nfsi->lo_lock);
=A0 =A0 =A0 =A0goto out;
}
Quoted 9 lines
Quoted 2 lines
Quoted 2 lines
--
1.6.3.3--
tao.
--
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