diff options
Diffstat (limited to 'fs/reiserfs')
-rw-r--r-- | fs/reiserfs/file.c | 3 | ||||
-rw-r--r-- | fs/reiserfs/inode.c | 15 | ||||
-rw-r--r-- | fs/reiserfs/reiserfs.h | 1 |
3 files changed, 13 insertions, 6 deletions
diff --git a/fs/reiserfs/file.c b/fs/reiserfs/file.c index 8375c922c0d5..50302d6f8895 100644 --- a/fs/reiserfs/file.c +++ b/fs/reiserfs/file.c | |||
@@ -126,7 +126,7 @@ static int reiserfs_file_open(struct inode *inode, struct file *file) | |||
126 | return err; | 126 | return err; |
127 | } | 127 | } |
128 | 128 | ||
129 | static void reiserfs_vfs_truncate_file(struct inode *inode) | 129 | void reiserfs_vfs_truncate_file(struct inode *inode) |
130 | { | 130 | { |
131 | mutex_lock(&(REISERFS_I(inode)->tailpack)); | 131 | mutex_lock(&(REISERFS_I(inode)->tailpack)); |
132 | reiserfs_truncate_file(inode, 1); | 132 | reiserfs_truncate_file(inode, 1); |
@@ -312,7 +312,6 @@ const struct file_operations reiserfs_file_operations = { | |||
312 | }; | 312 | }; |
313 | 313 | ||
314 | const struct inode_operations reiserfs_file_inode_operations = { | 314 | const struct inode_operations reiserfs_file_inode_operations = { |
315 | .truncate = reiserfs_vfs_truncate_file, | ||
316 | .setattr = reiserfs_setattr, | 315 | .setattr = reiserfs_setattr, |
317 | .setxattr = reiserfs_setxattr, | 316 | .setxattr = reiserfs_setxattr, |
318 | .getxattr = reiserfs_getxattr, | 317 | .getxattr = reiserfs_getxattr, |
diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c index d83736fbc26c..95d7680ead47 100644 --- a/fs/reiserfs/inode.c +++ b/fs/reiserfs/inode.c | |||
@@ -3085,8 +3085,10 @@ static ssize_t reiserfs_direct_IO(int rw, struct kiocb *iocb, | |||
3085 | loff_t isize = i_size_read(inode); | 3085 | loff_t isize = i_size_read(inode); |
3086 | loff_t end = offset + iov_length(iov, nr_segs); | 3086 | loff_t end = offset + iov_length(iov, nr_segs); |
3087 | 3087 | ||
3088 | if (end > isize) | 3088 | if ((end > isize) && inode_newsize_ok(inode, isize) == 0) { |
3089 | vmtruncate(inode, isize); | 3089 | truncate_setsize(inode, isize); |
3090 | reiserfs_vfs_truncate_file(inode); | ||
3091 | } | ||
3090 | } | 3092 | } |
3091 | 3093 | ||
3092 | return ret; | 3094 | return ret; |
@@ -3200,8 +3202,13 @@ int reiserfs_setattr(struct dentry *dentry, struct iattr *attr) | |||
3200 | */ | 3202 | */ |
3201 | reiserfs_write_unlock_once(inode->i_sb, depth); | 3203 | reiserfs_write_unlock_once(inode->i_sb, depth); |
3202 | if ((attr->ia_valid & ATTR_SIZE) && | 3204 | if ((attr->ia_valid & ATTR_SIZE) && |
3203 | attr->ia_size != i_size_read(inode)) | 3205 | attr->ia_size != i_size_read(inode)) { |
3204 | error = vmtruncate(inode, attr->ia_size); | 3206 | error = inode_newsize_ok(inode, attr->ia_size); |
3207 | if (!error) { | ||
3208 | truncate_setsize(inode, attr->ia_size); | ||
3209 | reiserfs_vfs_truncate_file(inode); | ||
3210 | } | ||
3211 | } | ||
3205 | 3212 | ||
3206 | if (!error) { | 3213 | if (!error) { |
3207 | setattr_copy(inode, attr); | 3214 | setattr_copy(inode, attr); |
diff --git a/fs/reiserfs/reiserfs.h b/fs/reiserfs/reiserfs.h index 33215f57ea06..157e474ab303 100644 --- a/fs/reiserfs/reiserfs.h +++ b/fs/reiserfs/reiserfs.h | |||
@@ -2455,6 +2455,7 @@ struct reiserfs_transaction_handle *reiserfs_persistent_transaction(struct | |||
2455 | *, | 2455 | *, |
2456 | int count); | 2456 | int count); |
2457 | int reiserfs_end_persistent_transaction(struct reiserfs_transaction_handle *); | 2457 | int reiserfs_end_persistent_transaction(struct reiserfs_transaction_handle *); |
2458 | void reiserfs_vfs_truncate_file(struct inode *inode); | ||
2458 | int reiserfs_commit_page(struct inode *inode, struct page *page, | 2459 | int reiserfs_commit_page(struct inode *inode, struct page *page, |
2459 | unsigned from, unsigned to); | 2460 | unsigned from, unsigned to); |
2460 | void reiserfs_flush_old_commits(struct super_block *); | 2461 | void reiserfs_flush_old_commits(struct super_block *); |