[PATCH 1/2][FAT] miss-sync issues on sync mount (miss-sync on write)

From: Machida, Hiroyuki (machida_at_sm.sony.co.jp)
Date: 09/14/05

  • Next message: Peter Staubach: "Re: [PATCH] nfs client, kernel 2.4.31: readlink result overflow"
    Date:	Thu, 15 Sep 2005 05:34:44 +0900
    To: hirofumi@mail.parknet.co.jp
    
    
    

    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.

    ---
    Hiroyuki Machida
    
    

    Signed-off-by: Hiroyuki Machida <machida@sm.sony.co.jp>
     ---

     file.c | 20 +-------------------
     inode.c | 21 ++++++++++++++++++++-
     2 files changed, 21 insertions(+), 20 deletions(-)

    --- linux-2.6.13.org/fs/fat/inode.c 2005-08-29 08:41:01.000000000 +0900
    +++ linux-2.6.13/fs/fat/inode.c 2005-09-09 17:22:44.305189111 +0900
    @@ -107,12 +107,31 @@ static sector_t _fat_bmap(struct address
             return generic_block_bmap(mapping, block, fat_get_block);
     }
     
    +static int fat_commit_write(struct file *file, struct page *page,
    + unsigned from, unsigned to)
    +{
    + struct inode *inode = page->mapping->host;
    + loff_t pos = ((loff_t)page->index << PAGE_CACHE_SHIFT) + to;
    + block_commit_write(page,from,to);
    + /*
    + * No need to use i_size_read() here, the i_size
    + * cannot change under us because we hold i_sem.
    + */
    + if (pos > inode->i_size) {
    + i_size_write(inode, pos);
    + }
    + inode->i_mtime = inode->i_ctime = CURRENT_TIME_SEC;
    + MSDOS_I(inode)->i_attrs |= ATTR_ARCH;
    + mark_inode_dirty(inode);
    + return 0;
    +}
    +
     static struct address_space_operations fat_aops = {
             .readpage = fat_readpage,
             .writepage = fat_writepage,
             .sync_page = block_sync_page,
             .prepare_write = fat_prepare_write,
    - .commit_write = generic_commit_write,
    + .commit_write = fat_commit_write,
             .bmap = _fat_bmap
     };
     
    --- linux-2.6.13.org/fs/fat/file.c 2005-08-29 08:41:01.000000000 +0900
    +++ linux-2.6.13/fs/fat/file.c 2005-09-08 17:13:03.000000000 +0900
    @@ -12,24 +12,6 @@
     #include <linux/smp_lock.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)
     {
    @@ -150,7 +132,7 @@ struct file_operations fat_file_operatio
             .readv = generic_file_readv,
             .writev = fat_file_writev,
             .aio_read = generic_file_aio_read,
    - .aio_write = fat_file_aio_write,
    + .aio_write = generic_file_aio_write,
             .mmap = generic_file_mmap,
             .ioctl = fat_generic_ioctl,
             .fsync = file_fsync,
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/


  • Next message: Peter Staubach: "Re: [PATCH] nfs client, kernel 2.4.31: readlink result overflow"

    Relevant Pages

    • Re: modprobe + request_module() deadlock
      ... calls request_moduleonce the depending module went to LIVE state. ... +static int pending_call(struct notifier_block *self, unsigned long state, ... +static struct notifier_block pending_notifier = { ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • [PATCH 2.6.7-rc3] Adds class support to msr.c
      ... | `-- dev ... +static struct class_simple *msr_class; ... +static int msr_class_simple_device_add ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: [PATCH 2.6.7-rc3] Adds class support to msr.c
      ... Thanks to Randy Dunlap for pointing out the unnecessary tabs. ... +static struct class_simple *msr_class; ... +static int msr_class_simple_device_add ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: 2.6.12-rc1-mm1: resume regression [update] (was: Re:2.6.12-rc1-mm1: Kernel BUG at pci:389)
      ... :-) I'm not sure if the patch that I have reverted is related ... static struct sysdev_class irqrouter_sysdev_class = { ... To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ ...
      (Linux-Kernel)
    • [PATCH] 2.6.0-rc1 - Watchdog patches
      ... ibwdt_open(struct inode *inode, struct file *file) ... static struct semaphore open_sem; ... static void eurwdt_activate_timer ...
      (Linux-Kernel)