linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Trond Myklebust <trond.myklebust@primarydata.com>
Cc: linux-nfs@vger.kernel.org
Subject: [PATCH] nfs: commit layouts in fdatasync
Date: Mon, 21 Apr 2014 10:29:17 -0700	[thread overview]
Message-ID: <20140421172917.GA20036@infradead.org> (raw)

>From fdatasync(2):

 "fdatasync() is similar to fsync(), but does not flush modified metadata
  unless that metadata is needed in order  to  allow  a  subsequent  data
  retrieval to be correctly handled."

We absolutely need to commit the layouts to be able to retrieve the data
in case either the client, the server or the storage subsystem go down.

Signed-off-by: Christoph Hellwig <hch@lst.de>

diff --git a/fs/nfs/nfs4file.c b/fs/nfs/nfs4file.c
index 8de3407..464db9d 100644
--- a/fs/nfs/nfs4file.c
+++ b/fs/nfs/nfs4file.c
@@ -100,8 +100,7 @@ nfs4_file_fsync(struct file *file, loff_t start, loff_t end, int datasync)
 			break;
 		mutex_lock(&inode->i_mutex);
 		ret = nfs_file_fsync_commit(file, start, end, datasync);
-		if (!ret && !datasync)
-			/* application has asked for meta-data sync */
+		if (!ret)
 			ret = pnfs_layoutcommit_inode(inode, true);
 		mutex_unlock(&inode->i_mutex);
 		/*

             reply	other threads:[~2014-04-21 17:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-21 17:29 Christoph Hellwig [this message]
2014-05-05  6:56 ` [PATCH] nfs: commit layouts in fdatasync Christoph Hellwig
2014-05-27 16:00   ` Christoph Hellwig
2014-05-28 23:00     ` Trond Myklebust
2014-06-02  8:19       ` Christoph Hellwig

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=20140421172917.GA20036@infradead.org \
    --to=hch@infradead.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=trond.myklebust@primarydata.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).