Messages in this thread |  | | | Date | Tue, 6 Jan 2009 19:28:16 -0500 | | Subject | Re: nfsd stuckage | | From | "J. Bruce Fields" <> | |
On Tue, Jan 06, 2009 at 04:23:28PM -0800, Andrew Morton wrote:
> On Tue, 6 Jan 2009 19:15:01 -0500
> "J. Bruce Fields" <bfields@fieldses.org> wrote:
>
> > nfsd: fix double-locks of directory mutex
>
> grumble.
This is literally just a revert of part of 4c728ef583b3d822; if you'd
like me to clean up this stuff while I'm there, I'm happy to.
--b.
> > +/*
> > + * Sync a file
> > + * As this calls fsync (not fdatasync) there is no need for a write_inode
> > + * after it.
> > + */
> > +static inline int nfsd_dosync(struct file *filp, struct dentry *dp,
> > + const struct file_operations *fop)
> > +{
> > + struct inode *inode = dp->d_inode;
> > + int (*fsync) (struct file *, struct dentry *, int);
> > + int err;
> > +
> > + err = filemap_fdatawrite(inode->i_mapping);
> > + if (err == 0 && fop && (fsync = fop->fsync))
> > + err = fsync(filp, dp, 0);
> > + if (err == 0)
> > + err = filemap_fdatawait(inode->i_mapping);
> > +
> > + return err;
> > +}
>
> This function is HUGE! And hardly a fastpath.
>
> > static int
> > nfsd_sync(struct file *filp)
> > {
> > - return vfs_fsync(filp, filp->f_path.dentry, 0);
> > + int err;
> > + struct inode *inode = filp->f_path.dentry->d_inode;
> > + dprintk("nfsd: sync file %s\n", filp->f_path.dentry->d_name.name);
> > + mutex_lock(&inode->i_mutex);
> > + err=nfsd_dosync(filp, filp->f_path.dentry, filp->f_op);
>
> (checkpatch?)
>
> > + mutex_unlock(&inode->i_mutex);
> > +
> > + return err;
> > }
> >
> > int
> > -nfsd_sync_dir(struct dentry *dentry)
> > +nfsd_sync_dir(struct dentry *dp)
> > {
> > - return vfs_fsync(NULL, dentry, 0);
> > + return nfsd_dosync(NULL, dp, dp->d_inode->i_fop);
> > }
>
> And we expand it twice.
|  |