linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton@redhat.com>
To: martin@omnibond.com
Cc: hubcap@omnibond.com, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH 11/13] orangefs: lock inode during fsync
Date: Fri, 26 May 2017 12:58:07 -0400	[thread overview]
Message-ID: <1495817887.4299.6.camel@redhat.com> (raw)
In-Reply-To: <20170526162150.GA17804@pamir.hexium.org>

On Fri, 2017-05-26 at 12:21 -0400, martin@omnibond.com wrote:
> On Thu, May 25, 2017 at 11:58:57AM -0400, Jeff Layton wrote:
> > On Mon, 2017-05-22 at 05:58 -0400, Martin Brandenburg wrote:
> > > Signed-off-by: Martin Brandenburg <martin@omnibond.com>
> > > ---
> > >  fs/orangefs/file.c | 2 ++
> > >  1 file changed, 2 insertions(+)
> > > 
> > > diff --git a/fs/orangefs/file.c b/fs/orangefs/file.c
> > > index cd126dd..f8536a7 100644
> > > --- a/fs/orangefs/file.c
> > > +++ b/fs/orangefs/file.c
> > > @@ -652,7 +652,9 @@ static int orangefs_fsync(struct file *file,
> > >  	struct orangefs_kernel_op_s *new_op = NULL;
> > >  
> > >  	/* required call */
> > > +	inode_lock(file_inode(file));
> > >  	filemap_write_and_wait_range(file->f_mapping, start, end);
> > > +	inode_unlock(file_inode(file));
> > >  
> > >  	new_op = op_alloc(ORANGEFS_VFS_OP_FSYNC);
> > >  	if (!new_op)
> > 
> > Why? You're just writing back the cached file data here. There's no
> > reason to lock the inode for that, AFAICS.
> > 
> > -- 
> > Jeff Layton <jlayton@redhat.com>
> 
> Because FUSE does.  Now I see FUSE needs it for fuse_sync_writes.
> 
> 	/*
> 	 * Wait for all pending writepages on the inode to finish.
> 	 *
> 	 * This is currently done by blocking further writes with FUSE_NOWRITE
> 	 * and waiting for all sent writes to complete.
> 	 *
> 	 * This must be called under i_mutex, otherwise the FUSE_NOWRITE usage
> 	 * could conflict with truncation.
> 	 */
> 	static void fuse_sync_writes(struct inode *inode)
> 
> I think OrangeFS is okay because writepage does not return until the
> write has completed.  Does that sound right?
> 

I think so.

> I'm not sure about the truncate conflict.  Truncates are sent to the
> server immediately.  Can a pending write show past the end of the file
> show up later?  I don't handle that at all.
> 

IIUC, the danger there is generally that the write and truncate could
get reordered. If they're both synchronous though then I don't see how
that could happen
-- 
Jeff Layton <jlayton@redhat.com>

  reply	other threads:[~2017-05-26 16:58 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-22  9:58 [PATCH 00/13] [RFC] orangefs page cache Martin Brandenburg
2017-05-22  9:58 ` [PATCH 01/13] orangefs: move orangefs_address_operations to file.c Martin Brandenburg
2017-05-22  9:58 ` [PATCH 02/13] orangefs: remove orangefs_readpages Martin Brandenburg
2017-05-22  9:58 ` [PATCH 03/13] orangefs: make orangefs_inode_read static Martin Brandenburg
2017-05-22  9:58 ` [PATCH 04/13] orangefs: only set a_ops for regular files Martin Brandenburg
2017-05-22  9:58 ` [PATCH 05/13] orangefs: BUG_ON if i_mode invalid Martin Brandenburg
2017-05-22  9:58 ` [PATCH 06/13] orangefs: remove mapping_nrpages macro Martin Brandenburg
2017-05-22  9:58 ` [PATCH 07/13] orangefs: set up and use backing_dev_info Martin Brandenburg
2017-05-22  9:58 ` [PATCH 08/13] orangefs: initialize new inode size to zero Martin Brandenburg
2017-05-22  9:58 ` [PATCH 09/13] orangefs: inodes linger in cache Martin Brandenburg
2017-05-22  9:58 ` [PATCH 10/13] orangefs: implement direct_IO for the read case Martin Brandenburg
2017-05-22  9:58 ` [PATCH 11/13] orangefs: lock inode during fsync Martin Brandenburg
2017-05-25 15:58   ` Jeff Layton
2017-05-26 16:21     ` martin
2017-05-26 16:58       ` Jeff Layton [this message]
2017-05-22  9:59 ` [PATCH 12/13] orangefs: call generic_file_read_iter Martin Brandenburg
2017-05-22  9:59 ` [PATCH 13/13] orangefs: implement write through the page cache Martin Brandenburg
2017-05-25 16:09   ` Jeff Layton
2017-05-26 18:09     ` martin
2017-05-26 18:48       ` Jeff Layton

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=1495817887.4299.6.camel@redhat.com \
    --to=jlayton@redhat.com \
    --cc=hubcap@omnibond.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=martin@omnibond.com \
    /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;
as well as URLs for NNTP newsgroup(s).