[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20090106162328.1b4511a6.akpm@linux-foundation.org>
Date: Tue, 6 Jan 2009 16:23:28 -0800
From: Andrew Morton <akpm@...ux-foundation.org>
To: "J. Bruce Fields" <bfields@...ldses.org>
Cc: hch@....de, linux-nfs@...r.kernel.org,
linux-kernel@...r.kernel.org, neilb@...e.de, snakebyte@....de
Subject: Re: nfsd stuckage
On Tue, 6 Jan 2009 19:15:01 -0500
"J. Bruce Fields" <bfields@...ldses.org> wrote:
> nfsd: fix double-locks of directory mutex
grumble.
>
> +/*
> + * 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.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists