diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/hostfs/hostfs_kern.c | 25 | ||||
-rw-r--r-- | fs/splice.c | 25 |
2 files changed, 28 insertions, 22 deletions
diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c index 9baf69773ed1..fd301a910122 100644 --- a/fs/hostfs/hostfs_kern.c +++ b/fs/hostfs/hostfs_kern.c | |||
@@ -20,7 +20,6 @@ | |||
20 | #include "hostfs.h" | 20 | #include "hostfs.h" |
21 | #include "kern_util.h" | 21 | #include "kern_util.h" |
22 | #include "kern.h" | 22 | #include "kern.h" |
23 | #include "user_util.h" | ||
24 | #include "init.h" | 23 | #include "init.h" |
25 | 24 | ||
26 | struct hostfs_inode_info { | 25 | struct hostfs_inode_info { |
@@ -939,7 +938,7 @@ static const struct address_space_operations hostfs_link_aops = { | |||
939 | static int hostfs_fill_sb_common(struct super_block *sb, void *d, int silent) | 938 | static int hostfs_fill_sb_common(struct super_block *sb, void *d, int silent) |
940 | { | 939 | { |
941 | struct inode *root_inode; | 940 | struct inode *root_inode; |
942 | char *name, *data = d; | 941 | char *host_root_path, *req_root = d; |
943 | int err; | 942 | int err; |
944 | 943 | ||
945 | sb->s_blocksize = 1024; | 944 | sb->s_blocksize = 1024; |
@@ -948,16 +947,16 @@ static int hostfs_fill_sb_common(struct super_block *sb, void *d, int silent) | |||
948 | sb->s_op = &hostfs_sbops; | 947 | sb->s_op = &hostfs_sbops; |
949 | 948 | ||
950 | /* NULL is printed as <NULL> by sprintf: avoid that. */ | 949 | /* NULL is printed as <NULL> by sprintf: avoid that. */ |
951 | if (data == NULL) | 950 | if (req_root == NULL) |
952 | data = ""; | 951 | req_root = ""; |
953 | 952 | ||
954 | err = -ENOMEM; | 953 | err = -ENOMEM; |
955 | name = kmalloc(strlen(root_ino) + 1 | 954 | host_root_path = kmalloc(strlen(root_ino) + 1 |
956 | + strlen(data) + 1, GFP_KERNEL); | 955 | + strlen(req_root) + 1, GFP_KERNEL); |
957 | if(name == NULL) | 956 | if(host_root_path == NULL) |
958 | goto out; | 957 | goto out; |
959 | 958 | ||
960 | sprintf(name, "%s/%s", root_ino, data); | 959 | sprintf(host_root_path, "%s/%s", root_ino, req_root); |
961 | 960 | ||
962 | root_inode = iget(sb, 0); | 961 | root_inode = iget(sb, 0); |
963 | if(root_inode == NULL) | 962 | if(root_inode == NULL) |
@@ -967,10 +966,10 @@ static int hostfs_fill_sb_common(struct super_block *sb, void *d, int silent) | |||
967 | if(err) | 966 | if(err) |
968 | goto out_put; | 967 | goto out_put; |
969 | 968 | ||
970 | HOSTFS_I(root_inode)->host_filename = name; | 969 | HOSTFS_I(root_inode)->host_filename = host_root_path; |
971 | /* Avoid that in the error path, iput(root_inode) frees again name through | 970 | /* Avoid that in the error path, iput(root_inode) frees again |
972 | * hostfs_destroy_inode! */ | 971 | * host_root_path through hostfs_destroy_inode! */ |
973 | name = NULL; | 972 | host_root_path = NULL; |
974 | 973 | ||
975 | err = -ENOMEM; | 974 | err = -ENOMEM; |
976 | sb->s_root = d_alloc_root(root_inode); | 975 | sb->s_root = d_alloc_root(root_inode); |
@@ -990,7 +989,7 @@ static int hostfs_fill_sb_common(struct super_block *sb, void *d, int silent) | |||
990 | out_put: | 989 | out_put: |
991 | iput(root_inode); | 990 | iput(root_inode); |
992 | out_free: | 991 | out_free: |
993 | kfree(name); | 992 | kfree(host_root_path); |
994 | out: | 993 | out: |
995 | return(err); | 994 | return(err); |
996 | } | 995 | } |
diff --git a/fs/splice.c b/fs/splice.c index 07f6556add0a..5428b0ff3b6f 100644 --- a/fs/splice.c +++ b/fs/splice.c | |||
@@ -627,18 +627,25 @@ find_page: | |||
627 | } | 627 | } |
628 | 628 | ||
629 | ret = mapping->a_ops->commit_write(file, page, offset, offset+this_len); | 629 | ret = mapping->a_ops->commit_write(file, page, offset, offset+this_len); |
630 | if (!ret) { | 630 | if (ret) { |
631 | if (ret == AOP_TRUNCATED_PAGE) { | ||
632 | page_cache_release(page); | ||
633 | goto find_page; | ||
634 | } | ||
635 | if (ret < 0) | ||
636 | goto out; | ||
631 | /* | 637 | /* |
632 | * Return the number of bytes written and mark page as | 638 | * Partial write has happened, so 'ret' already initialized by |
633 | * accessed, we are now done! | 639 | * number of bytes written, Where is nothing we have to do here. |
634 | */ | 640 | */ |
641 | } else | ||
635 | ret = this_len; | 642 | ret = this_len; |
636 | mark_page_accessed(page); | 643 | /* |
637 | balance_dirty_pages_ratelimited(mapping); | 644 | * Return the number of bytes written and mark page as |
638 | } else if (ret == AOP_TRUNCATED_PAGE) { | 645 | * accessed, we are now done! |
639 | page_cache_release(page); | 646 | */ |
640 | goto find_page; | 647 | mark_page_accessed(page); |
641 | } | 648 | balance_dirty_pages_ratelimited(mapping); |
642 | out: | 649 | out: |
643 | page_cache_release(page); | 650 | page_cache_release(page); |
644 | unlock_page(page); | 651 | unlock_page(page); |