fs: move inode_dio_wait calls into ->setattr
[deliverable/linux.git] / fs / fat / file.c
index 7018e1d8902dee6c4b38f7247a38e9315cba27f5..e1587c54d3c1398373a027c01fc81dd4083e2146 100644 (file)
@@ -397,6 +397,8 @@ int fat_setattr(struct dentry *dentry, struct iattr *attr)
         * sequence.
         */
        if (attr->ia_valid & ATTR_SIZE) {
+               inode_dio_wait(inode);
+
                if (attr->ia_size > inode->i_size) {
                        error = fat_cont_expand(inode, attr->ia_size);
                        if (error || attr->ia_valid == ATTR_SIZE)
@@ -429,8 +431,10 @@ int fat_setattr(struct dentry *dentry, struct iattr *attr)
        }
 
        if (attr->ia_valid & ATTR_SIZE) {
+               down_write(&MSDOS_I(inode)->truncate_lock);
                truncate_setsize(inode, attr->ia_size);
                fat_truncate_blocks(inode, attr->ia_size);
+               up_write(&MSDOS_I(inode)->truncate_lock);
        }
 
        setattr_copy(inode, attr);
This page took 0.025756 seconds and 5 git commands to generate.