diff options
-rw-r--r-- | fs/reiserfs/file.c | 20 | ||||
-rw-r--r-- | fs/reiserfs/inode.c | 2 | ||||
-rw-r--r-- | include/linux/reiserfs_fs_i.h | 2 |
3 files changed, 23 insertions, 1 deletions
diff --git a/fs/reiserfs/file.c b/fs/reiserfs/file.c index 99b6f329ba23..5109f1d5e7ff 100644 --- a/fs/reiserfs/file.c +++ b/fs/reiserfs/file.c | |||
@@ -48,6 +48,11 @@ static int reiserfs_file_release(struct inode *inode, struct file *filp) | |||
48 | } | 48 | } |
49 | 49 | ||
50 | mutex_lock(&inode->i_mutex); | 50 | mutex_lock(&inode->i_mutex); |
51 | |||
52 | mutex_lock(&(REISERFS_I(inode)->i_mmap)); | ||
53 | if (REISERFS_I(inode)->i_flags & i_ever_mapped) | ||
54 | REISERFS_I(inode)->i_flags &= ~i_pack_on_close_mask; | ||
55 | |||
51 | reiserfs_write_lock(inode->i_sb); | 56 | reiserfs_write_lock(inode->i_sb); |
52 | /* freeing preallocation only involves relogging blocks that | 57 | /* freeing preallocation only involves relogging blocks that |
53 | * are already in the current transaction. preallocation gets | 58 | * are already in the current transaction. preallocation gets |
@@ -100,11 +105,24 @@ static int reiserfs_file_release(struct inode *inode, struct file *filp) | |||
100 | err = reiserfs_truncate_file(inode, 0); | 105 | err = reiserfs_truncate_file(inode, 0); |
101 | } | 106 | } |
102 | out: | 107 | out: |
108 | mutex_unlock(&(REISERFS_I(inode)->i_mmap)); | ||
103 | mutex_unlock(&inode->i_mutex); | 109 | mutex_unlock(&inode->i_mutex); |
104 | reiserfs_write_unlock(inode->i_sb); | 110 | reiserfs_write_unlock(inode->i_sb); |
105 | return err; | 111 | return err; |
106 | } | 112 | } |
107 | 113 | ||
114 | static int reiserfs_file_mmap(struct file *file, struct vm_area_struct *vma) | ||
115 | { | ||
116 | struct inode *inode; | ||
117 | |||
118 | inode = file->f_path.dentry->d_inode; | ||
119 | mutex_lock(&(REISERFS_I(inode)->i_mmap)); | ||
120 | REISERFS_I(inode)->i_flags |= i_ever_mapped; | ||
121 | mutex_unlock(&(REISERFS_I(inode)->i_mmap)); | ||
122 | |||
123 | return generic_file_mmap(file, vma); | ||
124 | } | ||
125 | |||
108 | static void reiserfs_vfs_truncate_file(struct inode *inode) | 126 | static void reiserfs_vfs_truncate_file(struct inode *inode) |
109 | { | 127 | { |
110 | reiserfs_truncate_file(inode, 1); | 128 | reiserfs_truncate_file(inode, 1); |
@@ -1527,7 +1545,7 @@ const struct file_operations reiserfs_file_operations = { | |||
1527 | #ifdef CONFIG_COMPAT | 1545 | #ifdef CONFIG_COMPAT |
1528 | .compat_ioctl = reiserfs_compat_ioctl, | 1546 | .compat_ioctl = reiserfs_compat_ioctl, |
1529 | #endif | 1547 | #endif |
1530 | .mmap = generic_file_mmap, | 1548 | .mmap = reiserfs_file_mmap, |
1531 | .open = generic_file_open, | 1549 | .open = generic_file_open, |
1532 | .release = reiserfs_file_release, | 1550 | .release = reiserfs_file_release, |
1533 | .fsync = reiserfs_sync_file, | 1551 | .fsync = reiserfs_sync_file, |
diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c index f3d1c4a77979..9fcbfe316977 100644 --- a/fs/reiserfs/inode.c +++ b/fs/reiserfs/inode.c | |||
@@ -1125,6 +1125,7 @@ static void init_inode(struct inode *inode, struct treepath *path) | |||
1125 | REISERFS_I(inode)->i_prealloc_count = 0; | 1125 | REISERFS_I(inode)->i_prealloc_count = 0; |
1126 | REISERFS_I(inode)->i_trans_id = 0; | 1126 | REISERFS_I(inode)->i_trans_id = 0; |
1127 | REISERFS_I(inode)->i_jl = NULL; | 1127 | REISERFS_I(inode)->i_jl = NULL; |
1128 | mutex_init(&(REISERFS_I(inode)->i_mmap)); | ||
1128 | reiserfs_init_acl_access(inode); | 1129 | reiserfs_init_acl_access(inode); |
1129 | reiserfs_init_acl_default(inode); | 1130 | reiserfs_init_acl_default(inode); |
1130 | reiserfs_init_xattr_rwsem(inode); | 1131 | reiserfs_init_xattr_rwsem(inode); |
@@ -1832,6 +1833,7 @@ int reiserfs_new_inode(struct reiserfs_transaction_handle *th, | |||
1832 | REISERFS_I(inode)->i_attrs = | 1833 | REISERFS_I(inode)->i_attrs = |
1833 | REISERFS_I(dir)->i_attrs & REISERFS_INHERIT_MASK; | 1834 | REISERFS_I(dir)->i_attrs & REISERFS_INHERIT_MASK; |
1834 | sd_attrs_to_i_attrs(REISERFS_I(inode)->i_attrs, inode); | 1835 | sd_attrs_to_i_attrs(REISERFS_I(inode)->i_attrs, inode); |
1836 | mutex_init(&(REISERFS_I(inode)->i_mmap)); | ||
1835 | reiserfs_init_acl_access(inode); | 1837 | reiserfs_init_acl_access(inode); |
1836 | reiserfs_init_acl_default(inode); | 1838 | reiserfs_init_acl_default(inode); |
1837 | reiserfs_init_xattr_rwsem(inode); | 1839 | reiserfs_init_xattr_rwsem(inode); |
diff --git a/include/linux/reiserfs_fs_i.h b/include/linux/reiserfs_fs_i.h index 5b3b297aa2c5..ce3663fb0101 100644 --- a/include/linux/reiserfs_fs_i.h +++ b/include/linux/reiserfs_fs_i.h | |||
@@ -25,6 +25,7 @@ typedef enum { | |||
25 | i_link_saved_truncate_mask = 0x0020, | 25 | i_link_saved_truncate_mask = 0x0020, |
26 | i_has_xattr_dir = 0x0040, | 26 | i_has_xattr_dir = 0x0040, |
27 | i_data_log = 0x0080, | 27 | i_data_log = 0x0080, |
28 | i_ever_mapped = 0x0100 | ||
28 | } reiserfs_inode_flags; | 29 | } reiserfs_inode_flags; |
29 | 30 | ||
30 | struct reiserfs_inode_info { | 31 | struct reiserfs_inode_info { |
@@ -52,6 +53,7 @@ struct reiserfs_inode_info { | |||
52 | ** flushed */ | 53 | ** flushed */ |
53 | unsigned long i_trans_id; | 54 | unsigned long i_trans_id; |
54 | struct reiserfs_journal_list *i_jl; | 55 | struct reiserfs_journal_list *i_jl; |
56 | struct mutex i_mmap; | ||
55 | #ifdef CONFIG_REISERFS_FS_POSIX_ACL | 57 | #ifdef CONFIG_REISERFS_FS_POSIX_ACL |
56 | struct posix_acl *i_acl_access; | 58 | struct posix_acl *i_acl_access; |
57 | struct posix_acl *i_acl_default; | 59 | struct posix_acl *i_acl_default; |