summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>2017-05-08 18:58:59 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2017-05-08 20:15:14 -0400
commitc718a97514e4d77c97a35734b728aaf541a0621b (patch)
treeee3ecc300b4f02c8e27af51a24607068b54a0f61
parentf44a2920c84af809883ecbbd08d47fb5fe47c8ad (diff)
fs: semove set but not checked AOP_FLAG_UNINTERRUPTIBLE flag
Commit afddba49d18f ("fs: introduce write_begin, write_end, and perform_write aops") introduced AOP_FLAG_UNINTERRUPTIBLE flag which was checked in pagecache_write_begin(), but that check was removed by 4e02ed4b4a2f ("fs: remove prepare_write/commit_write"). Between these two commits, commit d9414774dc0c ("cifs: Convert cifs to new aops.") added a check in cifs_write_begin(), but that check was soon removed by commit a98ee8c1c707 ("[CIFS] fix regression in cifs_write_begin/cifs_write_end"). Therefore, AOP_FLAG_UNINTERRUPTIBLE flag is checked nowhere. Let's remove this flag. This patch has no functionality changes. Link: http://lkml.kernel.org/r/1489294781-53494-1-git-send-email-penguin-kernel@I-love.SAKURA.ne.jp Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> Reviewed-by: Jeff Layton <jlayton@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Cc: Nick Piggin <npiggin@gmail.com> Cc: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--Documentation/filesystems/vfs.txt3
-rw-r--r--fs/buffer.c13
-rw-r--r--fs/exofs/dir.c3
-rw-r--r--fs/hfs/extent.c4
-rw-r--r--fs/hfsplus/extents.c5
-rw-r--r--fs/iomap.c13
-rw-r--r--fs/namei.c2
-rw-r--r--include/linux/fs.h5
-rw-r--r--mm/filemap.c6
9 files changed, 17 insertions, 37 deletions
diff --git a/Documentation/filesystems/vfs.txt b/Documentation/filesystems/vfs.txt
index 94dd27ef4a76..f42b90687d40 100644
--- a/Documentation/filesystems/vfs.txt
+++ b/Documentation/filesystems/vfs.txt
@@ -694,8 +694,7 @@ struct address_space_operations {
694 694
695 write_end: After a successful write_begin, and data copy, write_end must 695 write_end: After a successful write_begin, and data copy, write_end must
696 be called. len is the original len passed to write_begin, and copied 696 be called. len is the original len passed to write_begin, and copied
697 is the amount that was able to be copied (copied == len is always true 697 is the amount that was able to be copied.
698 if write_begin was called with the AOP_FLAG_UNINTERRUPTIBLE flag).
699 698
700 The filesystem must take care of unlocking the page and releasing it 699 The filesystem must take care of unlocking the page and releasing it
701 refcount, and updating i_size. 700 refcount, and updating i_size.
diff --git a/fs/buffer.c b/fs/buffer.c
index 9196f2a270da..c3c7455efa3f 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -2379,8 +2379,7 @@ int generic_cont_expand_simple(struct inode *inode, loff_t size)
2379 goto out; 2379 goto out;
2380 2380
2381 err = pagecache_write_begin(NULL, mapping, size, 0, 2381 err = pagecache_write_begin(NULL, mapping, size, 0,
2382 AOP_FLAG_UNINTERRUPTIBLE|AOP_FLAG_CONT_EXPAND, 2382 AOP_FLAG_CONT_EXPAND, &page, &fsdata);
2383 &page, &fsdata);
2384 if (err) 2383 if (err)
2385 goto out; 2384 goto out;
2386 2385
@@ -2415,9 +2414,8 @@ static int cont_expand_zero(struct file *file, struct address_space *mapping,
2415 } 2414 }
2416 len = PAGE_SIZE - zerofrom; 2415 len = PAGE_SIZE - zerofrom;
2417 2416
2418 err = pagecache_write_begin(file, mapping, curpos, len, 2417 err = pagecache_write_begin(file, mapping, curpos, len, 0,
2419 AOP_FLAG_UNINTERRUPTIBLE, 2418 &page, &fsdata);
2420 &page, &fsdata);
2421 if (err) 2419 if (err)
2422 goto out; 2420 goto out;
2423 zero_user(page, zerofrom, len); 2421 zero_user(page, zerofrom, len);
@@ -2449,9 +2447,8 @@ static int cont_expand_zero(struct file *file, struct address_space *mapping,
2449 } 2447 }
2450 len = offset - zerofrom; 2448 len = offset - zerofrom;
2451 2449
2452 err = pagecache_write_begin(file, mapping, curpos, len, 2450 err = pagecache_write_begin(file, mapping, curpos, len, 0,
2453 AOP_FLAG_UNINTERRUPTIBLE, 2451 &page, &fsdata);
2454 &page, &fsdata);
2455 if (err) 2452 if (err)
2456 goto out; 2453 goto out;
2457 zero_user(page, zerofrom, len); 2454 zero_user(page, zerofrom, len);
diff --git a/fs/exofs/dir.c b/fs/exofs/dir.c
index 42f9a0a0c4ca..8eeb694332fe 100644
--- a/fs/exofs/dir.c
+++ b/fs/exofs/dir.c
@@ -405,8 +405,7 @@ int exofs_set_link(struct inode *dir, struct exofs_dir_entry *de,
405 int err; 405 int err;
406 406
407 lock_page(page); 407 lock_page(page);
408 err = exofs_write_begin(NULL, page->mapping, pos, len, 408 err = exofs_write_begin(NULL, page->mapping, pos, len, 0, &page, NULL);
409 AOP_FLAG_UNINTERRUPTIBLE, &page, NULL);
410 if (err) 409 if (err)
411 EXOFS_ERR("exofs_set_link: exofs_write_begin FAILED => %d\n", 410 EXOFS_ERR("exofs_set_link: exofs_write_begin FAILED => %d\n",
412 err); 411 err);
diff --git a/fs/hfs/extent.c b/fs/hfs/extent.c
index e33a0d36a93e..5d0182654580 100644
--- a/fs/hfs/extent.c
+++ b/fs/hfs/extent.c
@@ -485,8 +485,8 @@ void hfs_file_truncate(struct inode *inode)
485 485
486 /* XXX: Can use generic_cont_expand? */ 486 /* XXX: Can use generic_cont_expand? */
487 size = inode->i_size - 1; 487 size = inode->i_size - 1;
488 res = pagecache_write_begin(NULL, mapping, size+1, 0, 488 res = pagecache_write_begin(NULL, mapping, size+1, 0, 0,
489 AOP_FLAG_UNINTERRUPTIBLE, &page, &fsdata); 489 &page, &fsdata);
490 if (!res) { 490 if (!res) {
491 res = pagecache_write_end(NULL, mapping, size+1, 0, 0, 491 res = pagecache_write_end(NULL, mapping, size+1, 0, 0,
492 page, fsdata); 492 page, fsdata);
diff --git a/fs/hfsplus/extents.c b/fs/hfsplus/extents.c
index feca524ce2a5..a3eb640b4f8f 100644
--- a/fs/hfsplus/extents.c
+++ b/fs/hfsplus/extents.c
@@ -545,9 +545,8 @@ void hfsplus_file_truncate(struct inode *inode)
545 void *fsdata; 545 void *fsdata;
546 loff_t size = inode->i_size; 546 loff_t size = inode->i_size;
547 547
548 res = pagecache_write_begin(NULL, mapping, size, 0, 548 res = pagecache_write_begin(NULL, mapping, size, 0, 0,
549 AOP_FLAG_UNINTERRUPTIBLE, 549 &page, &fsdata);
550 &page, &fsdata);
551 if (res) 550 if (res)
552 return; 551 return;
553 res = pagecache_write_end(NULL, mapping, size, 552 res = pagecache_write_end(NULL, mapping, size,
diff --git a/fs/iomap.c b/fs/iomap.c
index 1faabe09b8fd..4b10892967a5 100644
--- a/fs/iomap.c
+++ b/fs/iomap.c
@@ -158,12 +158,6 @@ iomap_write_actor(struct inode *inode, loff_t pos, loff_t length, void *data,
158 ssize_t written = 0; 158 ssize_t written = 0;
159 unsigned int flags = AOP_FLAG_NOFS; 159 unsigned int flags = AOP_FLAG_NOFS;
160 160
161 /*
162 * Copies from kernel address space cannot fail (NFSD is a big user).
163 */
164 if (!iter_is_iovec(i))
165 flags |= AOP_FLAG_UNINTERRUPTIBLE;
166
167 do { 161 do {
168 struct page *page; 162 struct page *page;
169 unsigned long offset; /* Offset into pagecache page */ 163 unsigned long offset; /* Offset into pagecache page */
@@ -291,8 +285,7 @@ iomap_dirty_actor(struct inode *inode, loff_t pos, loff_t length, void *data,
291 return PTR_ERR(rpage); 285 return PTR_ERR(rpage);
292 286
293 status = iomap_write_begin(inode, pos, bytes, 287 status = iomap_write_begin(inode, pos, bytes,
294 AOP_FLAG_NOFS | AOP_FLAG_UNINTERRUPTIBLE, 288 AOP_FLAG_NOFS, &page, iomap);
295 &page, iomap);
296 put_page(rpage); 289 put_page(rpage);
297 if (unlikely(status)) 290 if (unlikely(status))
298 return status; 291 return status;
@@ -343,8 +336,8 @@ static int iomap_zero(struct inode *inode, loff_t pos, unsigned offset,
343 struct page *page; 336 struct page *page;
344 int status; 337 int status;
345 338
346 status = iomap_write_begin(inode, pos, bytes, 339 status = iomap_write_begin(inode, pos, bytes, AOP_FLAG_NOFS, &page,
347 AOP_FLAG_UNINTERRUPTIBLE | AOP_FLAG_NOFS, &page, iomap); 340 iomap);
348 if (status) 341 if (status)
349 return status; 342 return status;
350 343
diff --git a/fs/namei.c b/fs/namei.c
index 9a7f8bd748d8..7286f87ce863 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -4766,7 +4766,7 @@ int __page_symlink(struct inode *inode, const char *symname, int len, int nofs)
4766 struct page *page; 4766 struct page *page;
4767 void *fsdata; 4767 void *fsdata;
4768 int err; 4768 int err;
4769 unsigned int flags = AOP_FLAG_UNINTERRUPTIBLE; 4769 unsigned int flags = 0;
4770 if (nofs) 4770 if (nofs)
4771 flags |= AOP_FLAG_NOFS; 4771 flags |= AOP_FLAG_NOFS;
4772 4772
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 5d62d2c47939..249dad4e8d26 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -250,9 +250,8 @@ enum positive_aop_returns {
250 AOP_TRUNCATED_PAGE = 0x80001, 250 AOP_TRUNCATED_PAGE = 0x80001,
251}; 251};
252 252
253#define AOP_FLAG_UNINTERRUPTIBLE 0x0001 /* will not do a short write */ 253#define AOP_FLAG_CONT_EXPAND 0x0001 /* called from cont_expand */
254#define AOP_FLAG_CONT_EXPAND 0x0002 /* called from cont_expand */ 254#define AOP_FLAG_NOFS 0x0002 /* used by filesystem to direct
255#define AOP_FLAG_NOFS 0x0004 /* used by filesystem to direct
256 * helper code (eg buffer layer) 255 * helper code (eg buffer layer)
257 * to clear GFP_FS from alloc */ 256 * to clear GFP_FS from alloc */
258 257
diff --git a/mm/filemap.c b/mm/filemap.c
index 681da61080bc..b7b973b47d8d 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -2791,12 +2791,6 @@ ssize_t generic_perform_write(struct file *file,
2791 ssize_t written = 0; 2791 ssize_t written = 0;
2792 unsigned int flags = 0; 2792 unsigned int flags = 0;
2793 2793
2794 /*
2795 * Copies from kernel address space cannot fail (NFSD is a big user).
2796 */
2797 if (!iter_is_iovec(i))
2798 flags |= AOP_FLAG_UNINTERRUPTIBLE;
2799
2800 do { 2794 do {
2801 struct page *page; 2795 struct page *page;
2802 unsigned long offset; /* Offset into pagecache page */ 2796 unsigned long offset; /* Offset into pagecache page */