Skip to contentSkip to conversation

Subject: [PATCH] Restore 'fsync' functionality on block devices.

PATCH NeilBrown 2 participants 4 messages Aug 5, 2011 VFS

lore
Share & tools
lore

NeilBrown

author
#0 lore 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.

Cc Jan Kara <[email protected]>
Cc Josef Bacik <[email protected]>
Cc Al Viro <[email protected]>
fs/block_dev.c +0 -0
index f286805..532fefe 100644
@@ -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;
}

maintainer
#1 lore raw
Quoted 2 lines · NeilBrown

Commit 02c24a82187d5a628c68edfe71ae60dc135cd178:

see da5aa861bea09197e6ae4d7c46618616064891e4 in mainline

author
#2 lore raw
Quoted 5 lines · On Fri, 5 Aug 2011 04:48:59 +0100 Al Viro <[email protected]> wrote:
Quoted 2 lines · NeilBrown

Commit 02c24a82187d5a628c68edfe71ae60dc135cd178:

see da5aa861bea09197e6ae4d7c46618616064891e4 in mainline

http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=commitdiff;h=da5aa861bea09197e6ae4d7c46618616064891e4

gives me

404 - Unknown commit object

(as does a 'git show').

But I'll take your word for it that it is on it's way.

Thanks,
NeilBrown

maintainer
#3 lore raw
Quoted 9 lines · NeilBrown

http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=commitdiff;h=da5aa861bea09197e6ae4d7c46618616064891e4

gives me

404 - Unknown commit object

(as does a 'git show').

But I'll take your word for it that it is on it's way.

Charming... the diff between what's on hera and what's on git.kernel.org is not small -

 arch/arm/kernel/process.c |    2 +-
 arch/ia64/kernel/efi.c    |    2 +-
 arch/sh/kernel/idle.c     |    2 +-
 drivers/dma/dmaengine.c   |    4 +-
 drivers/dma/ioat/dma_v3.c |    8 ++--
 drivers/dma/ioat/pci.c    |   11 +++++
 fs/block_dev.c            |    4 ++
 fs/namei.c                |   17 +++-----
 include/linux/pci_ids.h   |   10 +++++
 include/linux/posix_acl.h |   74 +++++++++++++-----------------------
 kernel/futex.c            |   54 ++++++++++++++++++++------
 kernel/lockdep.c          |   37 +++++++++---------
 mm/slab.c                 |   92 ++++++++++++++++++++++++++++++++++----------
 13 files changed, 196 insertions(+), 121 deletions(-)

and the latest is actually commit 24f0eed2668b059e847ff145848ddacb75419acc
Merge: 8b6b462 3567866
Author: Linus Torvalds <[email protected]>
Date: Thu Aug 4 16:44:40 2011 -1000

(with several more merges between git.kernel.org tip and this one)