Commit ef402268 authored by OGAWA Hirofumi's avatar OGAWA Hirofumi Committed by Linus Torvalds

[PATCH] FAT: miss-sync issues on sync mount (miss-sync on write)

This patch fixes miss-sync issue on write() system call.  This updates
inode attrs flags, mtime and ctime on every comit_write call, due to
locking.
Signed-off-by: default avatarHiroyuki Machida <machida@sm.sony.co.jp>
Signed-off-by: default avatarOGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 4fb3a538
...@@ -12,39 +12,6 @@ ...@@ -12,39 +12,6 @@
#include <linux/smp_lock.h> #include <linux/smp_lock.h>
#include <linux/buffer_head.h> #include <linux/buffer_head.h>
static ssize_t fat_file_aio_write(struct kiocb *iocb, const char __user *buf,
size_t count, loff_t pos)
{
struct inode *inode = iocb->ki_filp->f_dentry->d_inode;
int retval;
retval = generic_file_aio_write(iocb, buf, count, pos);
if (retval > 0) {
inode->i_mtime = inode->i_ctime = CURRENT_TIME_SEC;
MSDOS_I(inode)->i_attrs |= ATTR_ARCH;
mark_inode_dirty(inode);
// check the locking rules
// if (IS_SYNC(inode))
// fat_sync_inode(inode);
}
return retval;
}
static ssize_t fat_file_writev(struct file *filp, const struct iovec *iov,
unsigned long nr_segs, loff_t *ppos)
{
struct inode *inode = filp->f_dentry->d_inode;
int retval;
retval = generic_file_writev(filp, iov, nr_segs, ppos);
if (retval > 0) {
inode->i_mtime = inode->i_ctime = CURRENT_TIME_SEC;
MSDOS_I(inode)->i_attrs |= ATTR_ARCH;
mark_inode_dirty(inode);
}
return retval;
}
int fat_generic_ioctl(struct inode *inode, struct file *filp, int fat_generic_ioctl(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
...@@ -148,9 +115,9 @@ struct file_operations fat_file_operations = { ...@@ -148,9 +115,9 @@ struct file_operations fat_file_operations = {
.read = do_sync_read, .read = do_sync_read,
.write = do_sync_write, .write = do_sync_write,
.readv = generic_file_readv, .readv = generic_file_readv,
.writev = fat_file_writev, .writev = generic_file_writev,
.aio_read = generic_file_aio_read, .aio_read = generic_file_aio_read,
.aio_write = fat_file_aio_write, .aio_write = generic_file_aio_write,
.mmap = generic_file_mmap, .mmap = generic_file_mmap,
.ioctl = fat_generic_ioctl, .ioctl = fat_generic_ioctl,
.fsync = file_fsync, .fsync = file_fsync,
......
...@@ -102,6 +102,19 @@ static int fat_prepare_write(struct file *file, struct page *page, ...@@ -102,6 +102,19 @@ static int fat_prepare_write(struct file *file, struct page *page,
&MSDOS_I(page->mapping->host)->mmu_private); &MSDOS_I(page->mapping->host)->mmu_private);
} }
static int fat_commit_write(struct file *file, struct page *page,
unsigned from, unsigned to)
{
struct inode *inode = page->mapping->host;
int err = generic_commit_write(file, page, from, to);
if (!err && !(MSDOS_I(inode)->i_attrs & ATTR_ARCH)) {
inode->i_mtime = inode->i_ctime = CURRENT_TIME_SEC;
MSDOS_I(inode)->i_attrs |= ATTR_ARCH;
mark_inode_dirty(inode);
}
return err;
}
static sector_t _fat_bmap(struct address_space *mapping, sector_t block) static sector_t _fat_bmap(struct address_space *mapping, sector_t block)
{ {
return generic_block_bmap(mapping, block, fat_get_block); return generic_block_bmap(mapping, block, fat_get_block);
...@@ -112,7 +125,7 @@ static struct address_space_operations fat_aops = { ...@@ -112,7 +125,7 @@ static struct address_space_operations fat_aops = {
.writepage = fat_writepage, .writepage = fat_writepage,
.sync_page = block_sync_page, .sync_page = block_sync_page,
.prepare_write = fat_prepare_write, .prepare_write = fat_prepare_write,
.commit_write = generic_commit_write, .commit_write = fat_commit_write,
.bmap = _fat_bmap .bmap = _fat_bmap
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment