diff options
author | Anton Blanchard <anton@samba.org> | 2010-04-06 14:34:58 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-04-26 07:41:19 -0700 |
commit | 957c93832c0f484ced1fbeca058375fa939b0ff9 (patch) | |
tree | 76f57c8ff449b9c5034316c7832b78426dc4be93 /fs | |
parent | 6e313203f4198d3bae98045cbb52d233a9b05e40 (diff) | |
download | lwn-957c93832c0f484ced1fbeca058375fa939b0ff9.tar.gz lwn-957c93832c0f484ced1fbeca058375fa939b0ff9.zip |
raw: fsync method is now required
commit 55ab3a1ff843e3f0e24d2da44e71bffa5d853010 upstream.
Commit 148f948ba877f4d3cdef036b1ff6d9f68986706a (vfs: Introduce new
helpers for syncing after writing to O_SYNC file or IS_SYNC inode) broke
the raw driver.
We now call through generic_file_aio_write -> generic_write_sync ->
vfs_fsync_range. vfs_fsync_range has:
if (!fop || !fop->fsync) {
ret = -EINVAL;
goto out;
}
But drivers/char/raw.c doesn't set an fsync method.
We have two options: fix it or remove the raw driver completely. I'm
happy to do either, the fact this has been broken for so long suggests it
is rarely used.
The patch below adds an fsync method to the raw driver. My knowledge of
the block layer is pretty sketchy so this could do with a once over.
If we instead decide to remove the raw driver, this patch might still be
useful as a backport to 2.6.33 and 2.6.32.
Signed-off-by: Anton Blanchard <anton@samba.org>
Reviewed-by: Jan Kara <jack@suse.cz>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Jens Axboe <jens.axboe@oracle.com>
Reviewed-by: Jeff Moyer <jmoyer@redhat.com>
Tested-by: Jeff Moyer <jmoyer@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/block_dev.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/block_dev.c b/fs/block_dev.c index 34e2d2033765..9b9e3dc56926 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c @@ -404,7 +404,7 @@ static loff_t block_llseek(struct file *file, loff_t offset, int origin) * NULL first argument is nfsd_sync_dir() and that's not a directory. */ -static int block_fsync(struct file *filp, struct dentry *dentry, int datasync) +int block_fsync(struct file *filp, struct dentry *dentry, int datasync) { return sync_blockdev(I_BDEV(filp->f_mapping->host)); } @@ -423,6 +423,7 @@ static struct inode *bdev_alloc_inode(struct super_block *sb) return NULL; return &ei->vfs_inode; } +EXPORT_SYMBOL(block_fsync); static void bdev_destroy_inode(struct inode *inode) { |