diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2015-11-11 12:45:24 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-11-11 12:45:24 -0500 |
commit | 842cf0b9525813b084720a82d0d3aabc750b7ccc (patch) | |
tree | 6352aecf79924ef8ba8e2a963c5f5da03822087f | |
parent | 65d57b3050eed3d848e51761904668b5d156743c (diff) | |
parent | 7c7afc440c8ec311ae135df892cc489436a1ff00 (diff) |
Merge branch 'for-linus-2' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull vfs update from Al Viro:
- misc stable fixes
- trivial kernel-doc and comment fixups
- remove never-used block_page_mkwrite() wrapper function, and rename
the function that is _actually_ used to not have double underscores.
* 'for-linus-2' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
fs: 9p: cache.h: Add #define of include guard
vfs: remove stale comment in inode_operations
vfs: remove unused wrapper block_page_mkwrite()
binfmt_elf: Correct `arch_check_elf's description
fs: fix writeback.c kernel-doc warnings
fs: fix inode.c kernel-doc warning
fs/pipe.c: return error code rather than 0 in pipe_write()
fs/pipe.c: preserve alloc_file() error code
binfmt_elf: Don't clobber passed executable's file header
FS-Cache: Handle a write to the page immediately beyond the EOF marker
cachefiles: perform test on s_blocksize when opening cache file.
FS-Cache: Don't override netfs's primary_index if registering failed
FS-Cache: Increase reference of parent after registering, netfs success
debugfs: fix refcount imbalance in start_creating
-rw-r--r-- | fs/9p/cache.h | 1 | ||||
-rw-r--r-- | fs/binfmt_elf.c | 12 | ||||
-rw-r--r-- | fs/buffer.c | 24 | ||||
-rw-r--r-- | fs/cachefiles/namei.c | 2 | ||||
-rw-r--r-- | fs/cachefiles/rdwr.c | 73 | ||||
-rw-r--r-- | fs/debugfs/inode.c | 6 | ||||
-rw-r--r-- | fs/ext4/inode.c | 4 | ||||
-rw-r--r-- | fs/fscache/netfs.c | 38 | ||||
-rw-r--r-- | fs/fscache/page.c | 2 | ||||
-rw-r--r-- | fs/nilfs2/file.c | 2 | ||||
-rw-r--r-- | fs/pipe.c | 18 | ||||
-rw-r--r-- | fs/xfs/xfs_file.c | 2 | ||||
-rw-r--r-- | include/linux/buffer_head.h | 2 | ||||
-rw-r--r-- | include/linux/fs.h | 2 |
14 files changed, 86 insertions, 102 deletions
diff --git a/fs/9p/cache.h b/fs/9p/cache.h index 2f9675491095..247e47e54bcc 100644 --- a/fs/9p/cache.h +++ b/fs/9p/cache.h | |||
@@ -21,6 +21,7 @@ | |||
21 | */ | 21 | */ |
22 | 22 | ||
23 | #ifndef _9P_CACHE_H | 23 | #ifndef _9P_CACHE_H |
24 | #define _9P_CACHE_H | ||
24 | #ifdef CONFIG_9P_FSCACHE | 25 | #ifdef CONFIG_9P_FSCACHE |
25 | #include <linux/fscache.h> | 26 | #include <linux/fscache.h> |
26 | #include <linux/spinlock.h> | 27 | #include <linux/spinlock.h> |
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c index 5f399ea1d20a..3a93755e880f 100644 --- a/fs/binfmt_elf.c +++ b/fs/binfmt_elf.c | |||
@@ -488,7 +488,7 @@ static inline int arch_elf_pt_proc(struct elfhdr *ehdr, | |||
488 | } | 488 | } |
489 | 489 | ||
490 | /** | 490 | /** |
491 | * arch_check_elf() - check a PT_LOPROC..PT_HIPROC ELF program header | 491 | * arch_check_elf() - check an ELF executable |
492 | * @ehdr: The main ELF header | 492 | * @ehdr: The main ELF header |
493 | * @has_interp: True if the ELF has an interpreter, else false. | 493 | * @has_interp: True if the ELF has an interpreter, else false. |
494 | * @state: Architecture-specific state preserved throughout the process | 494 | * @state: Architecture-specific state preserved throughout the process |
@@ -760,16 +760,16 @@ static int load_elf_binary(struct linux_binprm *bprm) | |||
760 | */ | 760 | */ |
761 | would_dump(bprm, interpreter); | 761 | would_dump(bprm, interpreter); |
762 | 762 | ||
763 | retval = kernel_read(interpreter, 0, bprm->buf, | 763 | /* Get the exec headers */ |
764 | BINPRM_BUF_SIZE); | 764 | retval = kernel_read(interpreter, 0, |
765 | if (retval != BINPRM_BUF_SIZE) { | 765 | (void *)&loc->interp_elf_ex, |
766 | sizeof(loc->interp_elf_ex)); | ||
767 | if (retval != sizeof(loc->interp_elf_ex)) { | ||
766 | if (retval >= 0) | 768 | if (retval >= 0) |
767 | retval = -EIO; | 769 | retval = -EIO; |
768 | goto out_free_dentry; | 770 | goto out_free_dentry; |
769 | } | 771 | } |
770 | 772 | ||
771 | /* Get the exec headers */ | ||
772 | loc->interp_elf_ex = *((struct elfhdr *)bprm->buf); | ||
773 | break; | 773 | break; |
774 | } | 774 | } |
775 | elf_ppnt++; | 775 | elf_ppnt++; |
diff --git a/fs/buffer.c b/fs/buffer.c index 51aff0296ce2..4f4cd959da7c 100644 --- a/fs/buffer.c +++ b/fs/buffer.c | |||
@@ -2420,9 +2420,9 @@ EXPORT_SYMBOL(block_commit_write); | |||
2420 | * unlock the page. | 2420 | * unlock the page. |
2421 | * | 2421 | * |
2422 | * Direct callers of this function should protect against filesystem freezing | 2422 | * Direct callers of this function should protect against filesystem freezing |
2423 | * using sb_start_write() - sb_end_write() functions. | 2423 | * using sb_start_pagefault() - sb_end_pagefault() functions. |
2424 | */ | 2424 | */ |
2425 | int __block_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf, | 2425 | int block_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf, |
2426 | get_block_t get_block) | 2426 | get_block_t get_block) |
2427 | { | 2427 | { |
2428 | struct page *page = vmf->page; | 2428 | struct page *page = vmf->page; |
@@ -2459,26 +2459,6 @@ out_unlock: | |||
2459 | unlock_page(page); | 2459 | unlock_page(page); |
2460 | return ret; | 2460 | return ret; |
2461 | } | 2461 | } |
2462 | EXPORT_SYMBOL(__block_page_mkwrite); | ||
2463 | |||
2464 | int block_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf, | ||
2465 | get_block_t get_block) | ||
2466 | { | ||
2467 | int ret; | ||
2468 | struct super_block *sb = file_inode(vma->vm_file)->i_sb; | ||
2469 | |||
2470 | sb_start_pagefault(sb); | ||
2471 | |||
2472 | /* | ||
2473 | * Update file times before taking page lock. We may end up failing the | ||
2474 | * fault so this update may be superfluous but who really cares... | ||
2475 | */ | ||
2476 | file_update_time(vma->vm_file); | ||
2477 | |||
2478 | ret = __block_page_mkwrite(vma, vmf, get_block); | ||
2479 | sb_end_pagefault(sb); | ||
2480 | return block_page_mkwrite_return(ret); | ||
2481 | } | ||
2482 | EXPORT_SYMBOL(block_page_mkwrite); | 2462 | EXPORT_SYMBOL(block_page_mkwrite); |
2483 | 2463 | ||
2484 | /* | 2464 | /* |
diff --git a/fs/cachefiles/namei.c b/fs/cachefiles/namei.c index fc1056f5c96a..c4b893453e0e 100644 --- a/fs/cachefiles/namei.c +++ b/fs/cachefiles/namei.c | |||
@@ -655,6 +655,8 @@ lookup_again: | |||
655 | aops = d_backing_inode(object->dentry)->i_mapping->a_ops; | 655 | aops = d_backing_inode(object->dentry)->i_mapping->a_ops; |
656 | if (!aops->bmap) | 656 | if (!aops->bmap) |
657 | goto check_error; | 657 | goto check_error; |
658 | if (object->dentry->d_sb->s_blocksize > PAGE_SIZE) | ||
659 | goto check_error; | ||
658 | 660 | ||
659 | object->backer = object->dentry; | 661 | object->backer = object->dentry; |
660 | } else { | 662 | } else { |
diff --git a/fs/cachefiles/rdwr.c b/fs/cachefiles/rdwr.c index 3cbb0e834694..7a6b02f72787 100644 --- a/fs/cachefiles/rdwr.c +++ b/fs/cachefiles/rdwr.c | |||
@@ -414,9 +414,6 @@ int cachefiles_read_or_alloc_page(struct fscache_retrieval *op, | |||
414 | ASSERT(inode->i_mapping->a_ops->readpages); | 414 | ASSERT(inode->i_mapping->a_ops->readpages); |
415 | 415 | ||
416 | /* calculate the shift required to use bmap */ | 416 | /* calculate the shift required to use bmap */ |
417 | if (inode->i_sb->s_blocksize > PAGE_SIZE) | ||
418 | goto enobufs; | ||
419 | |||
420 | shift = PAGE_SHIFT - inode->i_sb->s_blocksize_bits; | 417 | shift = PAGE_SHIFT - inode->i_sb->s_blocksize_bits; |
421 | 418 | ||
422 | op->op.flags &= FSCACHE_OP_KEEP_FLAGS; | 419 | op->op.flags &= FSCACHE_OP_KEEP_FLAGS; |
@@ -711,9 +708,6 @@ int cachefiles_read_or_alloc_pages(struct fscache_retrieval *op, | |||
711 | ASSERT(inode->i_mapping->a_ops->readpages); | 708 | ASSERT(inode->i_mapping->a_ops->readpages); |
712 | 709 | ||
713 | /* calculate the shift required to use bmap */ | 710 | /* calculate the shift required to use bmap */ |
714 | if (inode->i_sb->s_blocksize > PAGE_SIZE) | ||
715 | goto all_enobufs; | ||
716 | |||
717 | shift = PAGE_SHIFT - inode->i_sb->s_blocksize_bits; | 711 | shift = PAGE_SHIFT - inode->i_sb->s_blocksize_bits; |
718 | 712 | ||
719 | pagevec_init(&pagevec, 0); | 713 | pagevec_init(&pagevec, 0); |
@@ -905,6 +899,15 @@ int cachefiles_write_page(struct fscache_storage *op, struct page *page) | |||
905 | cache = container_of(object->fscache.cache, | 899 | cache = container_of(object->fscache.cache, |
906 | struct cachefiles_cache, cache); | 900 | struct cachefiles_cache, cache); |
907 | 901 | ||
902 | pos = (loff_t)page->index << PAGE_SHIFT; | ||
903 | |||
904 | /* We mustn't write more data than we have, so we have to beware of a | ||
905 | * partial page at EOF. | ||
906 | */ | ||
907 | eof = object->fscache.store_limit_l; | ||
908 | if (pos >= eof) | ||
909 | goto error; | ||
910 | |||
908 | /* write the page to the backing filesystem and let it store it in its | 911 | /* write the page to the backing filesystem and let it store it in its |
909 | * own time */ | 912 | * own time */ |
910 | path.mnt = cache->mnt; | 913 | path.mnt = cache->mnt; |
@@ -912,40 +915,38 @@ int cachefiles_write_page(struct fscache_storage *op, struct page *page) | |||
912 | file = dentry_open(&path, O_RDWR | O_LARGEFILE, cache->cache_cred); | 915 | file = dentry_open(&path, O_RDWR | O_LARGEFILE, cache->cache_cred); |
913 | if (IS_ERR(file)) { | 916 | if (IS_ERR(file)) { |
914 | ret = PTR_ERR(file); | 917 | ret = PTR_ERR(file); |
915 | } else { | 918 | goto error_2; |
916 | pos = (loff_t) page->index << PAGE_SHIFT; | ||
917 | |||
918 | /* we mustn't write more data than we have, so we have | ||
919 | * to beware of a partial page at EOF */ | ||
920 | eof = object->fscache.store_limit_l; | ||
921 | len = PAGE_SIZE; | ||
922 | if (eof & ~PAGE_MASK) { | ||
923 | ASSERTCMP(pos, <, eof); | ||
924 | if (eof - pos < PAGE_SIZE) { | ||
925 | _debug("cut short %llx to %llx", | ||
926 | pos, eof); | ||
927 | len = eof - pos; | ||
928 | ASSERTCMP(pos + len, ==, eof); | ||
929 | } | ||
930 | } | ||
931 | |||
932 | data = kmap(page); | ||
933 | ret = __kernel_write(file, data, len, &pos); | ||
934 | kunmap(page); | ||
935 | if (ret != len) | ||
936 | ret = -EIO; | ||
937 | fput(file); | ||
938 | } | 919 | } |
939 | 920 | ||
940 | if (ret < 0) { | 921 | len = PAGE_SIZE; |
941 | if (ret == -EIO) | 922 | if (eof & ~PAGE_MASK) { |
942 | cachefiles_io_error_obj( | 923 | if (eof - pos < PAGE_SIZE) { |
943 | object, "Write page to backing file failed"); | 924 | _debug("cut short %llx to %llx", |
944 | ret = -ENOBUFS; | 925 | pos, eof); |
926 | len = eof - pos; | ||
927 | ASSERTCMP(pos + len, ==, eof); | ||
928 | } | ||
945 | } | 929 | } |
946 | 930 | ||
947 | _leave(" = %d", ret); | 931 | data = kmap(page); |
948 | return ret; | 932 | ret = __kernel_write(file, data, len, &pos); |
933 | kunmap(page); | ||
934 | fput(file); | ||
935 | if (ret != len) | ||
936 | goto error_eio; | ||
937 | |||
938 | _leave(" = 0"); | ||
939 | return 0; | ||
940 | |||
941 | error_eio: | ||
942 | ret = -EIO; | ||
943 | error_2: | ||
944 | if (ret == -EIO) | ||
945 | cachefiles_io_error_obj(object, | ||
946 | "Write page to backing file failed"); | ||
947 | error: | ||
948 | _leave(" = -ENOBUFS [%d]", ret); | ||
949 | return -ENOBUFS; | ||
949 | } | 950 | } |
950 | 951 | ||
951 | /* | 952 | /* |
diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c index 5d8f35f1382a..b7fcc0de0b2f 100644 --- a/fs/debugfs/inode.c +++ b/fs/debugfs/inode.c | |||
@@ -271,8 +271,12 @@ static struct dentry *start_creating(const char *name, struct dentry *parent) | |||
271 | dput(dentry); | 271 | dput(dentry); |
272 | dentry = ERR_PTR(-EEXIST); | 272 | dentry = ERR_PTR(-EEXIST); |
273 | } | 273 | } |
274 | if (IS_ERR(dentry)) | 274 | |
275 | if (IS_ERR(dentry)) { | ||
275 | mutex_unlock(&d_inode(parent)->i_mutex); | 276 | mutex_unlock(&d_inode(parent)->i_mutex); |
277 | simple_release_fs(&debugfs_mount, &debugfs_mount_count); | ||
278 | } | ||
279 | |||
276 | return dentry; | 280 | return dentry; |
277 | } | 281 | } |
278 | 282 | ||
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 7d1aad1d9313..ea433a7f4bca 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c | |||
@@ -5283,7 +5283,7 @@ int ext4_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf) | |||
5283 | !ext4_should_journal_data(inode) && | 5283 | !ext4_should_journal_data(inode) && |
5284 | !ext4_nonda_switch(inode->i_sb)) { | 5284 | !ext4_nonda_switch(inode->i_sb)) { |
5285 | do { | 5285 | do { |
5286 | ret = __block_page_mkwrite(vma, vmf, | 5286 | ret = block_page_mkwrite(vma, vmf, |
5287 | ext4_da_get_block_prep); | 5287 | ext4_da_get_block_prep); |
5288 | } while (ret == -ENOSPC && | 5288 | } while (ret == -ENOSPC && |
5289 | ext4_should_retry_alloc(inode->i_sb, &retries)); | 5289 | ext4_should_retry_alloc(inode->i_sb, &retries)); |
@@ -5330,7 +5330,7 @@ retry_alloc: | |||
5330 | ret = VM_FAULT_SIGBUS; | 5330 | ret = VM_FAULT_SIGBUS; |
5331 | goto out; | 5331 | goto out; |
5332 | } | 5332 | } |
5333 | ret = __block_page_mkwrite(vma, vmf, get_block); | 5333 | ret = block_page_mkwrite(vma, vmf, get_block); |
5334 | if (!ret && ext4_should_journal_data(inode)) { | 5334 | if (!ret && ext4_should_journal_data(inode)) { |
5335 | if (ext4_walk_page_buffers(handle, page_buffers(page), 0, | 5335 | if (ext4_walk_page_buffers(handle, page_buffers(page), 0, |
5336 | PAGE_CACHE_SIZE, NULL, do_journal_get_write_access)) { | 5336 | PAGE_CACHE_SIZE, NULL, do_journal_get_write_access)) { |
diff --git a/fs/fscache/netfs.c b/fs/fscache/netfs.c index 6d941f56faf4..9b28649df3a1 100644 --- a/fs/fscache/netfs.c +++ b/fs/fscache/netfs.c | |||
@@ -22,6 +22,7 @@ static LIST_HEAD(fscache_netfs_list); | |||
22 | int __fscache_register_netfs(struct fscache_netfs *netfs) | 22 | int __fscache_register_netfs(struct fscache_netfs *netfs) |
23 | { | 23 | { |
24 | struct fscache_netfs *ptr; | 24 | struct fscache_netfs *ptr; |
25 | struct fscache_cookie *cookie; | ||
25 | int ret; | 26 | int ret; |
26 | 27 | ||
27 | _enter("{%s}", netfs->name); | 28 | _enter("{%s}", netfs->name); |
@@ -29,29 +30,25 @@ int __fscache_register_netfs(struct fscache_netfs *netfs) | |||
29 | INIT_LIST_HEAD(&netfs->link); | 30 | INIT_LIST_HEAD(&netfs->link); |
30 | 31 | ||
31 | /* allocate a cookie for the primary index */ | 32 | /* allocate a cookie for the primary index */ |
32 | netfs->primary_index = | 33 | cookie = kmem_cache_zalloc(fscache_cookie_jar, GFP_KERNEL); |
33 | kmem_cache_zalloc(fscache_cookie_jar, GFP_KERNEL); | ||
34 | 34 | ||
35 | if (!netfs->primary_index) { | 35 | if (!cookie) { |
36 | _leave(" = -ENOMEM"); | 36 | _leave(" = -ENOMEM"); |
37 | return -ENOMEM; | 37 | return -ENOMEM; |
38 | } | 38 | } |
39 | 39 | ||
40 | /* initialise the primary index cookie */ | 40 | /* initialise the primary index cookie */ |
41 | atomic_set(&netfs->primary_index->usage, 1); | 41 | atomic_set(&cookie->usage, 1); |
42 | atomic_set(&netfs->primary_index->n_children, 0); | 42 | atomic_set(&cookie->n_children, 0); |
43 | atomic_set(&netfs->primary_index->n_active, 1); | 43 | atomic_set(&cookie->n_active, 1); |
44 | 44 | ||
45 | netfs->primary_index->def = &fscache_fsdef_netfs_def; | 45 | cookie->def = &fscache_fsdef_netfs_def; |
46 | netfs->primary_index->parent = &fscache_fsdef_index; | 46 | cookie->parent = &fscache_fsdef_index; |
47 | netfs->primary_index->netfs_data = netfs; | 47 | cookie->netfs_data = netfs; |
48 | netfs->primary_index->flags = 1 << FSCACHE_COOKIE_ENABLED; | 48 | cookie->flags = 1 << FSCACHE_COOKIE_ENABLED; |
49 | 49 | ||
50 | atomic_inc(&netfs->primary_index->parent->usage); | 50 | spin_lock_init(&cookie->lock); |
51 | atomic_inc(&netfs->primary_index->parent->n_children); | 51 | INIT_HLIST_HEAD(&cookie->backing_objects); |
52 | |||
53 | spin_lock_init(&netfs->primary_index->lock); | ||
54 | INIT_HLIST_HEAD(&netfs->primary_index->backing_objects); | ||
55 | 52 | ||
56 | /* check the netfs type is not already present */ | 53 | /* check the netfs type is not already present */ |
57 | down_write(&fscache_addremove_sem); | 54 | down_write(&fscache_addremove_sem); |
@@ -62,6 +59,10 @@ int __fscache_register_netfs(struct fscache_netfs *netfs) | |||
62 | goto already_registered; | 59 | goto already_registered; |
63 | } | 60 | } |
64 | 61 | ||
62 | atomic_inc(&cookie->parent->usage); | ||
63 | atomic_inc(&cookie->parent->n_children); | ||
64 | |||
65 | netfs->primary_index = cookie; | ||
65 | list_add(&netfs->link, &fscache_netfs_list); | 66 | list_add(&netfs->link, &fscache_netfs_list); |
66 | ret = 0; | 67 | ret = 0; |
67 | 68 | ||
@@ -70,11 +71,8 @@ int __fscache_register_netfs(struct fscache_netfs *netfs) | |||
70 | already_registered: | 71 | already_registered: |
71 | up_write(&fscache_addremove_sem); | 72 | up_write(&fscache_addremove_sem); |
72 | 73 | ||
73 | if (ret < 0) { | 74 | if (ret < 0) |
74 | netfs->primary_index->parent = NULL; | 75 | kmem_cache_free(fscache_cookie_jar, cookie); |
75 | __fscache_cookie_put(netfs->primary_index); | ||
76 | netfs->primary_index = NULL; | ||
77 | } | ||
78 | 76 | ||
79 | _leave(" = %d", ret); | 77 | _leave(" = %d", ret); |
80 | return ret; | 78 | return ret; |
diff --git a/fs/fscache/page.c b/fs/fscache/page.c index 79483b3d8c6f..6b35fc4860a0 100644 --- a/fs/fscache/page.c +++ b/fs/fscache/page.c | |||
@@ -816,7 +816,7 @@ static void fscache_write_op(struct fscache_operation *_op) | |||
816 | goto superseded; | 816 | goto superseded; |
817 | page = results[0]; | 817 | page = results[0]; |
818 | _debug("gang %d [%lx]", n, page->index); | 818 | _debug("gang %d [%lx]", n, page->index); |
819 | if (page->index > op->store_limit) { | 819 | if (page->index >= op->store_limit) { |
820 | fscache_stat(&fscache_n_store_pages_over_limit); | 820 | fscache_stat(&fscache_n_store_pages_over_limit); |
821 | goto superseded; | 821 | goto superseded; |
822 | } | 822 | } |
diff --git a/fs/nilfs2/file.c b/fs/nilfs2/file.c index 54575e3cc1a2..088ba001c6ef 100644 --- a/fs/nilfs2/file.c +++ b/fs/nilfs2/file.c | |||
@@ -109,7 +109,7 @@ static int nilfs_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf) | |||
109 | goto out; | 109 | goto out; |
110 | 110 | ||
111 | file_update_time(vma->vm_file); | 111 | file_update_time(vma->vm_file); |
112 | ret = __block_page_mkwrite(vma, vmf, nilfs_get_block); | 112 | ret = block_page_mkwrite(vma, vmf, nilfs_get_block); |
113 | if (ret) { | 113 | if (ret) { |
114 | nilfs_transaction_abort(inode->i_sb); | 114 | nilfs_transaction_abort(inode->i_sb); |
115 | goto out; | 115 | goto out; |
@@ -366,18 +366,17 @@ pipe_write(struct kiocb *iocb, struct iov_iter *from) | |||
366 | int offset = buf->offset + buf->len; | 366 | int offset = buf->offset + buf->len; |
367 | 367 | ||
368 | if (ops->can_merge && offset + chars <= PAGE_SIZE) { | 368 | if (ops->can_merge && offset + chars <= PAGE_SIZE) { |
369 | int error = ops->confirm(pipe, buf); | 369 | ret = ops->confirm(pipe, buf); |
370 | if (error) | 370 | if (ret) |
371 | goto out; | 371 | goto out; |
372 | 372 | ||
373 | ret = copy_page_from_iter(buf->page, offset, chars, from); | 373 | ret = copy_page_from_iter(buf->page, offset, chars, from); |
374 | if (unlikely(ret < chars)) { | 374 | if (unlikely(ret < chars)) { |
375 | error = -EFAULT; | 375 | ret = -EFAULT; |
376 | goto out; | 376 | goto out; |
377 | } | 377 | } |
378 | do_wakeup = 1; | 378 | do_wakeup = 1; |
379 | buf->len += chars; | 379 | buf->len += ret; |
380 | ret = chars; | ||
381 | if (!iov_iter_count(from)) | 380 | if (!iov_iter_count(from)) |
382 | goto out; | 381 | goto out; |
383 | } | 382 | } |
@@ -693,17 +692,20 @@ int create_pipe_files(struct file **res, int flags) | |||
693 | 692 | ||
694 | d_instantiate(path.dentry, inode); | 693 | d_instantiate(path.dentry, inode); |
695 | 694 | ||
696 | err = -ENFILE; | ||
697 | f = alloc_file(&path, FMODE_WRITE, &pipefifo_fops); | 695 | f = alloc_file(&path, FMODE_WRITE, &pipefifo_fops); |
698 | if (IS_ERR(f)) | 696 | if (IS_ERR(f)) { |
697 | err = PTR_ERR(f); | ||
699 | goto err_dentry; | 698 | goto err_dentry; |
699 | } | ||
700 | 700 | ||
701 | f->f_flags = O_WRONLY | (flags & (O_NONBLOCK | O_DIRECT)); | 701 | f->f_flags = O_WRONLY | (flags & (O_NONBLOCK | O_DIRECT)); |
702 | f->private_data = inode->i_pipe; | 702 | f->private_data = inode->i_pipe; |
703 | 703 | ||
704 | res[0] = alloc_file(&path, FMODE_READ, &pipefifo_fops); | 704 | res[0] = alloc_file(&path, FMODE_READ, &pipefifo_fops); |
705 | if (IS_ERR(res[0])) | 705 | if (IS_ERR(res[0])) { |
706 | err = PTR_ERR(res[0]); | ||
706 | goto err_file; | 707 | goto err_file; |
708 | } | ||
707 | 709 | ||
708 | path_get(&path); | 710 | path_get(&path); |
709 | res[0]->private_data = inode->i_pipe; | 711 | res[0]->private_data = inode->i_pipe; |
diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c index e78feb400e22..f80e90f95ad8 100644 --- a/fs/xfs/xfs_file.c +++ b/fs/xfs/xfs_file.c | |||
@@ -1506,7 +1506,7 @@ xfs_filemap_page_mkwrite( | |||
1506 | ret = __dax_mkwrite(vma, vmf, xfs_get_blocks_direct, | 1506 | ret = __dax_mkwrite(vma, vmf, xfs_get_blocks_direct, |
1507 | xfs_end_io_dax_write); | 1507 | xfs_end_io_dax_write); |
1508 | } else { | 1508 | } else { |
1509 | ret = __block_page_mkwrite(vma, vmf, xfs_get_blocks); | 1509 | ret = block_page_mkwrite(vma, vmf, xfs_get_blocks); |
1510 | ret = block_page_mkwrite_return(ret); | 1510 | ret = block_page_mkwrite_return(ret); |
1511 | } | 1511 | } |
1512 | 1512 | ||
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h index e6797ded700e..89d9aa9e79bf 100644 --- a/include/linux/buffer_head.h +++ b/include/linux/buffer_head.h | |||
@@ -227,8 +227,6 @@ int cont_write_begin(struct file *, struct address_space *, loff_t, | |||
227 | get_block_t *, loff_t *); | 227 | get_block_t *, loff_t *); |
228 | int generic_cont_expand_simple(struct inode *inode, loff_t size); | 228 | int generic_cont_expand_simple(struct inode *inode, loff_t size); |
229 | int block_commit_write(struct page *page, unsigned from, unsigned to); | 229 | int block_commit_write(struct page *page, unsigned from, unsigned to); |
230 | int __block_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf, | ||
231 | get_block_t get_block); | ||
232 | int block_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf, | 230 | int block_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf, |
233 | get_block_t get_block); | 231 | get_block_t get_block); |
234 | /* Convert errno to return value from ->page_mkwrite() call */ | 232 | /* Convert errno to return value from ->page_mkwrite() call */ |
diff --git a/include/linux/fs.h b/include/linux/fs.h index 6230eb2a9cca..3aa514254161 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -1665,8 +1665,6 @@ struct inode_operations { | |||
1665 | umode_t create_mode, int *opened); | 1665 | umode_t create_mode, int *opened); |
1666 | int (*tmpfile) (struct inode *, struct dentry *, umode_t); | 1666 | int (*tmpfile) (struct inode *, struct dentry *, umode_t); |
1667 | int (*set_acl)(struct inode *, struct posix_acl *, int); | 1667 | int (*set_acl)(struct inode *, struct posix_acl *, int); |
1668 | |||
1669 | /* WARNING: probably going away soon, do not use! */ | ||
1670 | } ____cacheline_aligned; | 1668 | } ____cacheline_aligned; |
1671 | 1669 | ||
1672 | ssize_t rw_copy_check_uvector(int type, const struct iovec __user * uvector, | 1670 | ssize_t rw_copy_check_uvector(int type, const struct iovec __user * uvector, |