diff options
-rw-r--r-- | drivers/block/loop.c | 2 | ||||
-rw-r--r-- | fs/cachefiles/rdwr.c | 2 | ||||
-rw-r--r-- | fs/coda/file.c | 2 | ||||
-rw-r--r-- | fs/coredump.c | 2 | ||||
-rw-r--r-- | fs/read_write.c | 24 | ||||
-rw-r--r-- | fs/splice.c | 2 | ||||
-rw-r--r-- | kernel/acct.c | 2 | ||||
-rw-r--r-- | mm/filemap_xip.c | 3 |
8 files changed, 26 insertions, 13 deletions
diff --git a/drivers/block/loop.c b/drivers/block/loop.c index 747bb2af69dc..cd1e17460f03 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c | |||
@@ -230,9 +230,11 @@ static int __do_lo_send_write(struct file *file, | |||
230 | ssize_t bw; | 230 | ssize_t bw; |
231 | mm_segment_t old_fs = get_fs(); | 231 | mm_segment_t old_fs = get_fs(); |
232 | 232 | ||
233 | file_start_write(file); | ||
233 | set_fs(get_ds()); | 234 | set_fs(get_ds()); |
234 | bw = file->f_op->write(file, buf, len, &pos); | 235 | bw = file->f_op->write(file, buf, len, &pos); |
235 | set_fs(old_fs); | 236 | set_fs(old_fs); |
237 | file_end_write(file); | ||
236 | if (likely(bw == len)) | 238 | if (likely(bw == len)) |
237 | return 0; | 239 | return 0; |
238 | printk(KERN_ERR "loop: Write error at byte offset %llu, length %i.\n", | 240 | printk(KERN_ERR "loop: Write error at byte offset %llu, length %i.\n", |
diff --git a/fs/cachefiles/rdwr.c b/fs/cachefiles/rdwr.c index 480992259707..317f9ee9c991 100644 --- a/fs/cachefiles/rdwr.c +++ b/fs/cachefiles/rdwr.c | |||
@@ -962,12 +962,14 @@ int cachefiles_write_page(struct fscache_storage *op, struct page *page) | |||
962 | } | 962 | } |
963 | 963 | ||
964 | data = kmap(page); | 964 | data = kmap(page); |
965 | file_start_write(file); | ||
965 | old_fs = get_fs(); | 966 | old_fs = get_fs(); |
966 | set_fs(KERNEL_DS); | 967 | set_fs(KERNEL_DS); |
967 | ret = file->f_op->write( | 968 | ret = file->f_op->write( |
968 | file, (const void __user *) data, len, &pos); | 969 | file, (const void __user *) data, len, &pos); |
969 | set_fs(old_fs); | 970 | set_fs(old_fs); |
970 | kunmap(page); | 971 | kunmap(page); |
972 | file_end_write(file); | ||
971 | if (ret != len) | 973 | if (ret != len) |
972 | ret = -EIO; | 974 | ret = -EIO; |
973 | } | 975 | } |
diff --git a/fs/coda/file.c b/fs/coda/file.c index fa4c100bdc7d..380b798f8443 100644 --- a/fs/coda/file.c +++ b/fs/coda/file.c | |||
@@ -79,6 +79,7 @@ coda_file_write(struct file *coda_file, const char __user *buf, size_t count, lo | |||
79 | return -EINVAL; | 79 | return -EINVAL; |
80 | 80 | ||
81 | host_inode = file_inode(host_file); | 81 | host_inode = file_inode(host_file); |
82 | file_start_write(host_file); | ||
82 | mutex_lock(&coda_inode->i_mutex); | 83 | mutex_lock(&coda_inode->i_mutex); |
83 | 84 | ||
84 | ret = host_file->f_op->write(host_file, buf, count, ppos); | 85 | ret = host_file->f_op->write(host_file, buf, count, ppos); |
@@ -87,6 +88,7 @@ coda_file_write(struct file *coda_file, const char __user *buf, size_t count, lo | |||
87 | coda_inode->i_blocks = (coda_inode->i_size + 511) >> 9; | 88 | coda_inode->i_blocks = (coda_inode->i_size + 511) >> 9; |
88 | coda_inode->i_mtime = coda_inode->i_ctime = CURRENT_TIME_SEC; | 89 | coda_inode->i_mtime = coda_inode->i_ctime = CURRENT_TIME_SEC; |
89 | mutex_unlock(&coda_inode->i_mutex); | 90 | mutex_unlock(&coda_inode->i_mutex); |
91 | file_end_write(host_file); | ||
90 | 92 | ||
91 | return ret; | 93 | return ret; |
92 | } | 94 | } |
diff --git a/fs/coredump.c b/fs/coredump.c index c6479658d487..288e5c9f9bbe 100644 --- a/fs/coredump.c +++ b/fs/coredump.c | |||
@@ -629,9 +629,11 @@ void do_coredump(siginfo_t *siginfo) | |||
629 | goto close_fail; | 629 | goto close_fail; |
630 | if (displaced) | 630 | if (displaced) |
631 | put_files_struct(displaced); | 631 | put_files_struct(displaced); |
632 | file_start_write(cprm.file); | ||
632 | retval = binfmt->core_dump(&cprm); | 633 | retval = binfmt->core_dump(&cprm); |
633 | if (retval) | 634 | if (retval) |
634 | current->signal->group_exit_code |= 0x80; | 635 | current->signal->group_exit_code |= 0x80; |
636 | file_end_write(cprm.file); | ||
635 | 637 | ||
636 | if (ispipe && core_pipe_limit) | 638 | if (ispipe && core_pipe_limit) |
637 | wait_for_dump_helpers(cprm.file); | 639 | wait_for_dump_helpers(cprm.file); |
diff --git a/fs/read_write.c b/fs/read_write.c index e6dd1c2d0592..a1f4d44cbc03 100644 --- a/fs/read_write.c +++ b/fs/read_write.c | |||
@@ -398,7 +398,6 @@ ssize_t do_sync_write(struct file *filp, const char __user *buf, size_t len, lof | |||
398 | struct kiocb kiocb; | 398 | struct kiocb kiocb; |
399 | ssize_t ret; | 399 | ssize_t ret; |
400 | 400 | ||
401 | file_start_write(filp); | ||
402 | init_sync_kiocb(&kiocb, filp); | 401 | init_sync_kiocb(&kiocb, filp); |
403 | kiocb.ki_pos = *ppos; | 402 | kiocb.ki_pos = *ppos; |
404 | kiocb.ki_left = len; | 403 | kiocb.ki_left = len; |
@@ -414,7 +413,6 @@ ssize_t do_sync_write(struct file *filp, const char __user *buf, size_t len, lof | |||
414 | if (-EIOCBQUEUED == ret) | 413 | if (-EIOCBQUEUED == ret) |
415 | ret = wait_on_sync_kiocb(&kiocb); | 414 | ret = wait_on_sync_kiocb(&kiocb); |
416 | *ppos = kiocb.ki_pos; | 415 | *ppos = kiocb.ki_pos; |
417 | file_end_write(filp); | ||
418 | return ret; | 416 | return ret; |
419 | } | 417 | } |
420 | 418 | ||
@@ -458,6 +456,7 @@ ssize_t vfs_write(struct file *file, const char __user *buf, size_t count, loff_ | |||
458 | ret = rw_verify_area(WRITE, file, pos, count); | 456 | ret = rw_verify_area(WRITE, file, pos, count); |
459 | if (ret >= 0) { | 457 | if (ret >= 0) { |
460 | count = ret; | 458 | count = ret; |
459 | file_start_write(file); | ||
461 | if (file->f_op->write) | 460 | if (file->f_op->write) |
462 | ret = file->f_op->write(file, buf, count, pos); | 461 | ret = file->f_op->write(file, buf, count, pos); |
463 | else | 462 | else |
@@ -467,6 +466,7 @@ ssize_t vfs_write(struct file *file, const char __user *buf, size_t count, loff_ | |||
467 | add_wchar(current, ret); | 466 | add_wchar(current, ret); |
468 | } | 467 | } |
469 | inc_syscw(current); | 468 | inc_syscw(current); |
469 | file_end_write(file); | ||
470 | } | 470 | } |
471 | 471 | ||
472 | return ret; | 472 | return ret; |
@@ -758,16 +758,18 @@ static ssize_t do_readv_writev(int type, struct file *file, | |||
758 | } else { | 758 | } else { |
759 | fn = (io_fn_t)file->f_op->write; | 759 | fn = (io_fn_t)file->f_op->write; |
760 | fnv = file->f_op->aio_write; | 760 | fnv = file->f_op->aio_write; |
761 | file_start_write(file); | ||
761 | } | 762 | } |
762 | 763 | ||
763 | if (fnv) { | 764 | if (fnv) |
764 | file_start_write(file); | ||
765 | ret = do_sync_readv_writev(file, iov, nr_segs, tot_len, | 765 | ret = do_sync_readv_writev(file, iov, nr_segs, tot_len, |
766 | pos, fnv); | 766 | pos, fnv); |
767 | file_end_write(file); | 767 | else |
768 | } else | ||
769 | ret = do_loop_readv_writev(file, iov, nr_segs, pos, fn); | 768 | ret = do_loop_readv_writev(file, iov, nr_segs, pos, fn); |
770 | 769 | ||
770 | if (type != READ) | ||
771 | file_end_write(file); | ||
772 | |||
771 | out: | 773 | out: |
772 | if (iov != iovstack) | 774 | if (iov != iovstack) |
773 | kfree(iov); | 775 | kfree(iov); |
@@ -936,16 +938,18 @@ static ssize_t compat_do_readv_writev(int type, struct file *file, | |||
936 | } else { | 938 | } else { |
937 | fn = (io_fn_t)file->f_op->write; | 939 | fn = (io_fn_t)file->f_op->write; |
938 | fnv = file->f_op->aio_write; | 940 | fnv = file->f_op->aio_write; |
941 | file_start_write(file); | ||
939 | } | 942 | } |
940 | 943 | ||
941 | if (fnv) { | 944 | if (fnv) |
942 | file_start_write(file); | ||
943 | ret = do_sync_readv_writev(file, iov, nr_segs, tot_len, | 945 | ret = do_sync_readv_writev(file, iov, nr_segs, tot_len, |
944 | pos, fnv); | 946 | pos, fnv); |
945 | file_end_write(file); | 947 | else |
946 | } else | ||
947 | ret = do_loop_readv_writev(file, iov, nr_segs, pos, fn); | 948 | ret = do_loop_readv_writev(file, iov, nr_segs, pos, fn); |
948 | 949 | ||
950 | if (type != READ) | ||
951 | file_end_write(file); | ||
952 | |||
949 | out: | 953 | out: |
950 | if (iov != iovstack) | 954 | if (iov != iovstack) |
951 | kfree(iov); | 955 | kfree(iov); |
diff --git a/fs/splice.c b/fs/splice.c index 29e394e49ddd..e78a749064db 100644 --- a/fs/splice.c +++ b/fs/splice.c | |||
@@ -1052,7 +1052,9 @@ static int write_pipe_buf(struct pipe_inode_info *pipe, struct pipe_buffer *buf, | |||
1052 | loff_t tmp = sd->pos; | 1052 | loff_t tmp = sd->pos; |
1053 | 1053 | ||
1054 | data = buf->ops->map(pipe, buf, 0); | 1054 | data = buf->ops->map(pipe, buf, 0); |
1055 | file_start_write(sd->u.file); | ||
1055 | ret = __kernel_write(sd->u.file, data + buf->offset, sd->len, &tmp); | 1056 | ret = __kernel_write(sd->u.file, data + buf->offset, sd->len, &tmp); |
1057 | file_end_write(sd->u.file); | ||
1056 | buf->ops->unmap(pipe, buf, data); | 1058 | buf->ops->unmap(pipe, buf, data); |
1057 | 1059 | ||
1058 | return ret; | 1060 | return ret; |
diff --git a/kernel/acct.c b/kernel/acct.c index b9bd7f098ee5..85389fe2abd0 100644 --- a/kernel/acct.c +++ b/kernel/acct.c | |||
@@ -543,6 +543,7 @@ static void do_acct_process(struct bsd_acct_struct *acct, | |||
543 | * Kernel segment override to datasegment and write it | 543 | * Kernel segment override to datasegment and write it |
544 | * to the accounting file. | 544 | * to the accounting file. |
545 | */ | 545 | */ |
546 | file_start_write(file); | ||
546 | fs = get_fs(); | 547 | fs = get_fs(); |
547 | set_fs(KERNEL_DS); | 548 | set_fs(KERNEL_DS); |
548 | /* | 549 | /* |
@@ -554,6 +555,7 @@ static void do_acct_process(struct bsd_acct_struct *acct, | |||
554 | sizeof(acct_t), &file->f_pos); | 555 | sizeof(acct_t), &file->f_pos); |
555 | current->signal->rlim[RLIMIT_FSIZE].rlim_cur = flim; | 556 | current->signal->rlim[RLIMIT_FSIZE].rlim_cur = flim; |
556 | set_fs(fs); | 557 | set_fs(fs); |
558 | file_end_write(file); | ||
557 | out: | 559 | out: |
558 | revert_creds(orig_cred); | 560 | revert_creds(orig_cred); |
559 | } | 561 | } |
diff --git a/mm/filemap_xip.c b/mm/filemap_xip.c index a912da6ddfd4..28fe26b64f8a 100644 --- a/mm/filemap_xip.c +++ b/mm/filemap_xip.c | |||
@@ -404,8 +404,6 @@ xip_file_write(struct file *filp, const char __user *buf, size_t len, | |||
404 | loff_t pos; | 404 | loff_t pos; |
405 | ssize_t ret; | 405 | ssize_t ret; |
406 | 406 | ||
407 | sb_start_write(inode->i_sb); | ||
408 | |||
409 | mutex_lock(&inode->i_mutex); | 407 | mutex_lock(&inode->i_mutex); |
410 | 408 | ||
411 | if (!access_ok(VERIFY_READ, buf, len)) { | 409 | if (!access_ok(VERIFY_READ, buf, len)) { |
@@ -439,7 +437,6 @@ xip_file_write(struct file *filp, const char __user *buf, size_t len, | |||
439 | current->backing_dev_info = NULL; | 437 | current->backing_dev_info = NULL; |
440 | out_up: | 438 | out_up: |
441 | mutex_unlock(&inode->i_mutex); | 439 | mutex_unlock(&inode->i_mutex); |
442 | sb_end_write(inode->i_sb); | ||
443 | return ret; | 440 | return ret; |
444 | } | 441 | } |
445 | EXPORT_SYMBOL_GPL(xip_file_write); | 442 | EXPORT_SYMBOL_GPL(xip_file_write); |