public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "J. Bruce Fields" <bfields@fieldses.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: hch@lst.de, linux-nfs@vger.kernel.org,
	linux-kernel@vger.kernel.org, neilb@suse.de, snakebyte@gmx.de
Subject: Re: nfsd stuckage
Date: Tue, 6 Jan 2009 19:28:16 -0500	[thread overview]
Message-ID: <20090107002816.GL13785@fieldses.org> (raw)
In-Reply-To: <20090106162328.1b4511a6.akpm@linux-foundation.org>

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.  

  reply	other threads:[~2009-01-07  0:28 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-06 22:56 nfsd stuckage Andrew Morton
2009-01-06 23:02 ` J. Bruce Fields
2009-01-06 23:03   ` Christoph Hellwig
2009-01-06 23:05     ` J. Bruce Fields
2009-01-07  0:15       ` J. Bruce Fields
2009-01-07  0:23         ` Andrew Morton
2009-01-07  0:28           ` J. Bruce Fields [this message]
2009-01-07  7:42             ` Christoph Hellwig
2009-01-07 16:56               ` J. Bruce Fields
2009-01-07 17:22                 ` Christoph Hellwig
2009-01-08 14:57 ` Peter Zijlstra
2009-01-08 16:05   ` J. Bruce Fields

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090107002816.GL13785@fieldses.org \
    --to=bfields@fieldses.org \
    --cc=akpm@linux-foundation.org \
    --cc=hch@lst.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=neilb@suse.de \
    --cc=snakebyte@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox