All of lore.kernel.org
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.de>
To: Al Viro <viro@zeniv.linux.org.uk>
Cc: Josef Bacik <josef@redhat.com>, Jan Kara <jack@suse.cz>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Subject: [PATCH] Restore 'fsync' functionality on block devices.
Date: Fri, 5 Aug 2011 13:34:56 +1000	[thread overview]
Message-ID: <20110805133456.5aa0c568@notabene.brown> (raw)


Commit 02c24a82187d5a628c68edfe71ae60dc135cd178:

  fs: push i_mutex and filemap_write_and_wait down into ->fsync() handlers

broke fsync on block devices as it did not push the
"filemap_write_and_wait" call down into blkdev_fsync.

(it didn't push it down into ps3flash_flush either, but maybe there is
a reason for that).

So call filemap_write_and_wait from blkdev_fsync following the pattern
that was originally in vfs_fsync_range.

Signed-off-by: NeilBrown <neilb@suse.de>
Cc: Jan Kara <jack@suse.cz>
Cc: Josef Bacik <josef@redhat.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>

diff --git a/fs/block_dev.c b/fs/block_dev.c
index f286805..532fefe 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -386,8 +386,10 @@ int blkdev_fsync(struct file *filp, loff_t start, loff_t
end, int datasync) {
 	struct inode *bd_inode = filp->f_mapping->host;
 	struct block_device *bdev = I_BDEV(bd_inode);
-	int error;
+	int error, ret;
+
 
+	ret = filemap_write_and_wait_range(filp->f_mapping, start, end);
 	/*
 	 * There is no need to serialise calls to blkdev_issue_flush with
 	 * i_mutex and doing so causes performance issues with concurrent
@@ -396,6 +398,8 @@ int blkdev_fsync(struct file *filp, loff_t start, loff_t
end, int datasync) error = blkdev_issue_flush(bdev, GFP_KERNEL, NULL);
 	if (error == -EOPNOTSUPP)
 		error = 0;
+	if (ret)
+		return ret;
 
 	return error;
 }

             reply	other threads:[~2011-08-05  3:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-05  3:34 NeilBrown [this message]
2011-08-05  3:48 ` Subject: [PATCH] Restore 'fsync' functionality on block devices Al Viro
2011-08-05  4:35   ` NeilBrown
2011-08-05  4:49     ` Al Viro

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=20110805133456.5aa0c568@notabene.brown \
    --to=neilb@suse.de \
    --cc=jack@suse.cz \
    --cc=josef@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.