diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-12-20 21:14:31 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-12-20 21:14:31 -0500 |
commit | 1f0377ff088ed2971c57debc9b0c3b846ec431fd (patch) | |
tree | cd53c8981269e57e38e4285abd71cc990e1cfc67 /fs/jfs | |
parent | 54d46ea993744c5408e39ce0cb4851e13cbea716 (diff) | |
parent | b729d75d19777a5dd34672020516eada43ff026f (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull VFS update from Al Viro:
"fscache fixes, ESTALE patchset, vmtruncate removal series, assorted
misc stuff."
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (79 commits)
vfs: make lremovexattr retry once on ESTALE error
vfs: make removexattr retry once on ESTALE
vfs: make llistxattr retry once on ESTALE error
vfs: make listxattr retry once on ESTALE error
vfs: make lgetxattr retry once on ESTALE
vfs: make getxattr retry once on an ESTALE error
vfs: allow lsetxattr() to retry once on ESTALE errors
vfs: allow setxattr to retry once on ESTALE errors
vfs: allow utimensat() calls to retry once on an ESTALE error
vfs: fix user_statfs to retry once on ESTALE errors
vfs: make fchownat retry once on ESTALE errors
vfs: make fchmodat retry once on ESTALE errors
vfs: have chroot retry once on ESTALE error
vfs: have chdir retry lookup and call once on ESTALE error
vfs: have faccessat retry once on an ESTALE error
vfs: have do_sys_truncate retry once on an ESTALE error
vfs: fix renameat to retry on ESTALE errors
vfs: make do_unlinkat retry once on ESTALE errors
vfs: make do_rmdir retry once on ESTALE errors
vfs: add a flags argument to user_path_parent
...
Diffstat (limited to 'fs/jfs')
-rw-r--r-- | fs/jfs/file.c | 6 | ||||
-rw-r--r-- | fs/jfs/inode.c | 20 |
2 files changed, 18 insertions, 8 deletions
diff --git a/fs/jfs/file.c b/fs/jfs/file.c index 9d3afd157f99..dd7442c58358 100644 --- a/fs/jfs/file.c +++ b/fs/jfs/file.c | |||
@@ -119,9 +119,12 @@ int jfs_setattr(struct dentry *dentry, struct iattr *iattr) | |||
119 | iattr->ia_size != i_size_read(inode)) { | 119 | iattr->ia_size != i_size_read(inode)) { |
120 | inode_dio_wait(inode); | 120 | inode_dio_wait(inode); |
121 | 121 | ||
122 | rc = vmtruncate(inode, iattr->ia_size); | 122 | rc = inode_newsize_ok(inode, iattr->ia_size); |
123 | if (rc) | 123 | if (rc) |
124 | return rc; | 124 | return rc; |
125 | |||
126 | truncate_setsize(inode, iattr->ia_size); | ||
127 | jfs_truncate(inode); | ||
125 | } | 128 | } |
126 | 129 | ||
127 | setattr_copy(inode, iattr); | 130 | setattr_copy(inode, iattr); |
@@ -133,7 +136,6 @@ int jfs_setattr(struct dentry *dentry, struct iattr *iattr) | |||
133 | } | 136 | } |
134 | 137 | ||
135 | const struct inode_operations jfs_file_inode_operations = { | 138 | const struct inode_operations jfs_file_inode_operations = { |
136 | .truncate = jfs_truncate, | ||
137 | .setxattr = jfs_setxattr, | 139 | .setxattr = jfs_setxattr, |
138 | .getxattr = jfs_getxattr, | 140 | .getxattr = jfs_getxattr, |
139 | .listxattr = jfs_listxattr, | 141 | .listxattr = jfs_listxattr, |
diff --git a/fs/jfs/inode.c b/fs/jfs/inode.c index 4692bf3ca8cb..b7dc47ba675e 100644 --- a/fs/jfs/inode.c +++ b/fs/jfs/inode.c | |||
@@ -300,6 +300,16 @@ static int jfs_readpages(struct file *file, struct address_space *mapping, | |||
300 | return mpage_readpages(mapping, pages, nr_pages, jfs_get_block); | 300 | return mpage_readpages(mapping, pages, nr_pages, jfs_get_block); |
301 | } | 301 | } |
302 | 302 | ||
303 | static void jfs_write_failed(struct address_space *mapping, loff_t to) | ||
304 | { | ||
305 | struct inode *inode = mapping->host; | ||
306 | |||
307 | if (to > inode->i_size) { | ||
308 | truncate_pagecache(inode, to, inode->i_size); | ||
309 | jfs_truncate(inode); | ||
310 | } | ||
311 | } | ||
312 | |||
303 | static int jfs_write_begin(struct file *file, struct address_space *mapping, | 313 | static int jfs_write_begin(struct file *file, struct address_space *mapping, |
304 | loff_t pos, unsigned len, unsigned flags, | 314 | loff_t pos, unsigned len, unsigned flags, |
305 | struct page **pagep, void **fsdata) | 315 | struct page **pagep, void **fsdata) |
@@ -308,11 +318,8 @@ static int jfs_write_begin(struct file *file, struct address_space *mapping, | |||
308 | 318 | ||
309 | ret = nobh_write_begin(mapping, pos, len, flags, pagep, fsdata, | 319 | ret = nobh_write_begin(mapping, pos, len, flags, pagep, fsdata, |
310 | jfs_get_block); | 320 | jfs_get_block); |
311 | if (unlikely(ret)) { | 321 | if (unlikely(ret)) |
312 | loff_t isize = mapping->host->i_size; | 322 | jfs_write_failed(mapping, pos + len); |
313 | if (pos + len > isize) | ||
314 | vmtruncate(mapping->host, isize); | ||
315 | } | ||
316 | 323 | ||
317 | return ret; | 324 | return ret; |
318 | } | 325 | } |
@@ -326,6 +333,7 @@ static ssize_t jfs_direct_IO(int rw, struct kiocb *iocb, | |||
326 | const struct iovec *iov, loff_t offset, unsigned long nr_segs) | 333 | const struct iovec *iov, loff_t offset, unsigned long nr_segs) |
327 | { | 334 | { |
328 | struct file *file = iocb->ki_filp; | 335 | struct file *file = iocb->ki_filp; |
336 | struct address_space *mapping = file->f_mapping; | ||
329 | struct inode *inode = file->f_mapping->host; | 337 | struct inode *inode = file->f_mapping->host; |
330 | ssize_t ret; | 338 | ssize_t ret; |
331 | 339 | ||
@@ -341,7 +349,7 @@ static ssize_t jfs_direct_IO(int rw, struct kiocb *iocb, | |||
341 | loff_t end = offset + iov_length(iov, nr_segs); | 349 | loff_t end = offset + iov_length(iov, nr_segs); |
342 | 350 | ||
343 | if (end > isize) | 351 | if (end > isize) |
344 | vmtruncate(inode, isize); | 352 | jfs_write_failed(mapping, end); |
345 | } | 353 | } |
346 | 354 | ||
347 | return ret; | 355 | return ret; |