On Thu, Jun 17, 2010 at 10:48 AM, Benny Halevy <bhalevy@xxxxxxxxxxx> wrote: > Signed-off-by: Benny Halevy <bhalevy@xxxxxxxxxxx> > --- > fs/nfs/nfs4proc.c | 35 +++++++++++++++-------------------- > 1 files changed, 15 insertions(+), 20 deletions(-) > > diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c > index 8c02296..17a2597 100644 > --- a/fs/nfs/nfs4proc.c > +++ b/fs/nfs/nfs4proc.c > @@ -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_enabled_sb() is not needed given the following has_layout() test. Fred > + 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 majordomo@xxxxxxxxxxxxxxx > 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 majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html