diff options
Diffstat (limited to 'fs/nfs')
-rw-r--r-- | fs/nfs/callback.h | 4 | ||||
-rw-r--r-- | fs/nfs/client.c | 2 | ||||
-rw-r--r-- | fs/nfs/delegation.c | 2 | ||||
-rw-r--r-- | fs/nfs/dir.c | 5 | ||||
-rw-r--r-- | fs/nfs/direct.c | 65 | ||||
-rw-r--r-- | fs/nfs/file.c | 1 | ||||
-rw-r--r-- | fs/nfs/inode.c | 30 | ||||
-rw-r--r-- | fs/nfs/nfs4proc.c | 4 | ||||
-rw-r--r-- | fs/nfs/nfs4state.c | 2 | ||||
-rw-r--r-- | fs/nfs/nfs4xdr.c | 96 | ||||
-rw-r--r-- | fs/nfs/pagelist.c | 21 | ||||
-rw-r--r-- | fs/nfs/read.c | 10 | ||||
-rw-r--r-- | fs/nfs/write.c | 12 |
13 files changed, 148 insertions, 106 deletions
diff --git a/fs/nfs/callback.h b/fs/nfs/callback.h index db3d7919c601..c2bb14e053e1 100644 --- a/fs/nfs/callback.h +++ b/fs/nfs/callback.h | |||
@@ -24,7 +24,7 @@ enum nfs4_callback_opnum { | |||
24 | }; | 24 | }; |
25 | 25 | ||
26 | struct cb_compound_hdr_arg { | 26 | struct cb_compound_hdr_arg { |
27 | int taglen; | 27 | unsigned int taglen; |
28 | const char *tag; | 28 | const char *tag; |
29 | unsigned int callback_ident; | 29 | unsigned int callback_ident; |
30 | unsigned nops; | 30 | unsigned nops; |
@@ -32,7 +32,7 @@ struct cb_compound_hdr_arg { | |||
32 | 32 | ||
33 | struct cb_compound_hdr_res { | 33 | struct cb_compound_hdr_res { |
34 | __be32 *status; | 34 | __be32 *status; |
35 | int taglen; | 35 | unsigned int taglen; |
36 | const char *tag; | 36 | const char *tag; |
37 | __be32 *nops; | 37 | __be32 *nops; |
38 | }; | 38 | }; |
diff --git a/fs/nfs/client.c b/fs/nfs/client.c index 50c6821bad26..881fa4900923 100644 --- a/fs/nfs/client.c +++ b/fs/nfs/client.c | |||
@@ -12,7 +12,7 @@ | |||
12 | 12 | ||
13 | #include <linux/module.h> | 13 | #include <linux/module.h> |
14 | #include <linux/init.h> | 14 | #include <linux/init.h> |
15 | 15 | #include <linux/sched.h> | |
16 | #include <linux/time.h> | 16 | #include <linux/time.h> |
17 | #include <linux/kernel.h> | 17 | #include <linux/kernel.h> |
18 | #include <linux/mm.h> | 18 | #include <linux/mm.h> |
diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c index 841c99a9b11c..7f37d1bea83f 100644 --- a/fs/nfs/delegation.c +++ b/fs/nfs/delegation.c | |||
@@ -226,7 +226,7 @@ restart: | |||
226 | spin_unlock(&clp->cl_lock); | 226 | spin_unlock(&clp->cl_lock); |
227 | } | 227 | } |
228 | 228 | ||
229 | int nfs_do_expire_all_delegations(void *ptr) | 229 | static int nfs_do_expire_all_delegations(void *ptr) |
230 | { | 230 | { |
231 | struct nfs_client *clp = ptr; | 231 | struct nfs_client *clp = ptr; |
232 | struct nfs_delegation *delegation; | 232 | struct nfs_delegation *delegation; |
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index 3df428816559..c27258b5d3e1 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include <linux/pagevec.h> | 33 | #include <linux/pagevec.h> |
34 | #include <linux/namei.h> | 34 | #include <linux/namei.h> |
35 | #include <linux/mount.h> | 35 | #include <linux/mount.h> |
36 | #include <linux/sched.h> | ||
36 | 37 | ||
37 | #include "nfs4_fs.h" | 38 | #include "nfs4_fs.h" |
38 | #include "delegation.h" | 39 | #include "delegation.h" |
@@ -607,7 +608,7 @@ static int nfs_readdir(struct file *filp, void *dirent, filldir_t filldir) | |||
607 | return res; | 608 | return res; |
608 | } | 609 | } |
609 | 610 | ||
610 | loff_t nfs_llseek_dir(struct file *filp, loff_t offset, int origin) | 611 | static loff_t nfs_llseek_dir(struct file *filp, loff_t offset, int origin) |
611 | { | 612 | { |
612 | mutex_lock(&filp->f_path.dentry->d_inode->i_mutex); | 613 | mutex_lock(&filp->f_path.dentry->d_inode->i_mutex); |
613 | switch (origin) { | 614 | switch (origin) { |
@@ -633,7 +634,7 @@ out: | |||
633 | * All directory operations under NFS are synchronous, so fsync() | 634 | * All directory operations under NFS are synchronous, so fsync() |
634 | * is a dummy operation. | 635 | * is a dummy operation. |
635 | */ | 636 | */ |
636 | int nfs_fsync_dir(struct file *filp, struct dentry *dentry, int datasync) | 637 | static int nfs_fsync_dir(struct file *filp, struct dentry *dentry, int datasync) |
637 | { | 638 | { |
638 | dfprintk(VFS, "NFS: fsync_dir(%s/%s) datasync %d\n", | 639 | dfprintk(VFS, "NFS: fsync_dir(%s/%s) datasync %d\n", |
639 | dentry->d_parent->d_name.name, dentry->d_name.name, | 640 | dentry->d_parent->d_name.name, dentry->d_name.name, |
diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c index 345aa5c0f382..00eee87510fe 100644 --- a/fs/nfs/direct.c +++ b/fs/nfs/direct.c | |||
@@ -122,19 +122,25 @@ ssize_t nfs_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov, loff_ | |||
122 | return -EINVAL; | 122 | return -EINVAL; |
123 | } | 123 | } |
124 | 124 | ||
125 | static void nfs_direct_dirty_pages(struct page **pages, int npages) | 125 | static void nfs_direct_dirty_pages(struct page **pages, unsigned int pgbase, size_t count) |
126 | { | 126 | { |
127 | int i; | 127 | unsigned int npages; |
128 | unsigned int i; | ||
129 | |||
130 | if (count == 0) | ||
131 | return; | ||
132 | pages += (pgbase >> PAGE_SHIFT); | ||
133 | npages = (count + (pgbase & ~PAGE_MASK) + PAGE_SIZE - 1) >> PAGE_SHIFT; | ||
128 | for (i = 0; i < npages; i++) { | 134 | for (i = 0; i < npages; i++) { |
129 | struct page *page = pages[i]; | 135 | struct page *page = pages[i]; |
130 | if (!PageCompound(page)) | 136 | if (!PageCompound(page)) |
131 | set_page_dirty_lock(page); | 137 | set_page_dirty(page); |
132 | } | 138 | } |
133 | } | 139 | } |
134 | 140 | ||
135 | static void nfs_direct_release_pages(struct page **pages, int npages) | 141 | static void nfs_direct_release_pages(struct page **pages, unsigned int npages) |
136 | { | 142 | { |
137 | int i; | 143 | unsigned int i; |
138 | for (i = 0; i < npages; i++) | 144 | for (i = 0; i < npages; i++) |
139 | page_cache_release(pages[i]); | 145 | page_cache_release(pages[i]); |
140 | } | 146 | } |
@@ -162,7 +168,7 @@ static inline struct nfs_direct_req *nfs_direct_req_alloc(void) | |||
162 | return dreq; | 168 | return dreq; |
163 | } | 169 | } |
164 | 170 | ||
165 | static void nfs_direct_req_release(struct kref *kref) | 171 | static void nfs_direct_req_free(struct kref *kref) |
166 | { | 172 | { |
167 | struct nfs_direct_req *dreq = container_of(kref, struct nfs_direct_req, kref); | 173 | struct nfs_direct_req *dreq = container_of(kref, struct nfs_direct_req, kref); |
168 | 174 | ||
@@ -171,6 +177,11 @@ static void nfs_direct_req_release(struct kref *kref) | |||
171 | kmem_cache_free(nfs_direct_cachep, dreq); | 177 | kmem_cache_free(nfs_direct_cachep, dreq); |
172 | } | 178 | } |
173 | 179 | ||
180 | static void nfs_direct_req_release(struct nfs_direct_req *dreq) | ||
181 | { | ||
182 | kref_put(&dreq->kref, nfs_direct_req_free); | ||
183 | } | ||
184 | |||
174 | /* | 185 | /* |
175 | * Collects and returns the final error value/byte-count. | 186 | * Collects and returns the final error value/byte-count. |
176 | */ | 187 | */ |
@@ -190,7 +201,6 @@ static ssize_t nfs_direct_wait(struct nfs_direct_req *dreq) | |||
190 | result = dreq->count; | 201 | result = dreq->count; |
191 | 202 | ||
192 | out: | 203 | out: |
193 | kref_put(&dreq->kref, nfs_direct_req_release); | ||
194 | return (ssize_t) result; | 204 | return (ssize_t) result; |
195 | } | 205 | } |
196 | 206 | ||
@@ -208,7 +218,7 @@ static void nfs_direct_complete(struct nfs_direct_req *dreq) | |||
208 | } | 218 | } |
209 | complete_all(&dreq->completion); | 219 | complete_all(&dreq->completion); |
210 | 220 | ||
211 | kref_put(&dreq->kref, nfs_direct_req_release); | 221 | nfs_direct_req_release(dreq); |
212 | } | 222 | } |
213 | 223 | ||
214 | /* | 224 | /* |
@@ -224,17 +234,18 @@ static void nfs_direct_read_result(struct rpc_task *task, void *calldata) | |||
224 | if (nfs_readpage_result(task, data) != 0) | 234 | if (nfs_readpage_result(task, data) != 0) |
225 | return; | 235 | return; |
226 | 236 | ||
227 | nfs_direct_dirty_pages(data->pagevec, data->npages); | ||
228 | nfs_direct_release_pages(data->pagevec, data->npages); | ||
229 | |||
230 | spin_lock(&dreq->lock); | 237 | spin_lock(&dreq->lock); |
231 | 238 | if (unlikely(task->tk_status < 0)) { | |
232 | if (likely(task->tk_status >= 0)) | ||
233 | dreq->count += data->res.count; | ||
234 | else | ||
235 | dreq->error = task->tk_status; | 239 | dreq->error = task->tk_status; |
236 | 240 | spin_unlock(&dreq->lock); | |
237 | spin_unlock(&dreq->lock); | 241 | } else { |
242 | dreq->count += data->res.count; | ||
243 | spin_unlock(&dreq->lock); | ||
244 | nfs_direct_dirty_pages(data->pagevec, | ||
245 | data->args.pgbase, | ||
246 | data->res.count); | ||
247 | } | ||
248 | nfs_direct_release_pages(data->pagevec, data->npages); | ||
238 | 249 | ||
239 | if (put_dreq(dreq)) | 250 | if (put_dreq(dreq)) |
240 | nfs_direct_complete(dreq); | 251 | nfs_direct_complete(dreq); |
@@ -279,9 +290,12 @@ static ssize_t nfs_direct_read_schedule(struct nfs_direct_req *dreq, unsigned lo | |||
279 | result = get_user_pages(current, current->mm, user_addr, | 290 | result = get_user_pages(current, current->mm, user_addr, |
280 | data->npages, 1, 0, data->pagevec, NULL); | 291 | data->npages, 1, 0, data->pagevec, NULL); |
281 | up_read(¤t->mm->mmap_sem); | 292 | up_read(¤t->mm->mmap_sem); |
282 | if (unlikely(result < data->npages)) { | 293 | if (result < 0) { |
283 | if (result > 0) | 294 | nfs_readdata_release(data); |
284 | nfs_direct_release_pages(data->pagevec, result); | 295 | break; |
296 | } | ||
297 | if ((unsigned)result < data->npages) { | ||
298 | nfs_direct_release_pages(data->pagevec, result); | ||
285 | nfs_readdata_release(data); | 299 | nfs_readdata_release(data); |
286 | break; | 300 | break; |
287 | } | 301 | } |
@@ -359,6 +373,7 @@ static ssize_t nfs_direct_read(struct kiocb *iocb, unsigned long user_addr, size | |||
359 | if (!result) | 373 | if (!result) |
360 | result = nfs_direct_wait(dreq); | 374 | result = nfs_direct_wait(dreq); |
361 | rpc_clnt_sigunmask(clnt, &oldset); | 375 | rpc_clnt_sigunmask(clnt, &oldset); |
376 | nfs_direct_req_release(dreq); | ||
362 | 377 | ||
363 | return result; | 378 | return result; |
364 | } | 379 | } |
@@ -610,9 +625,12 @@ static ssize_t nfs_direct_write_schedule(struct nfs_direct_req *dreq, unsigned l | |||
610 | result = get_user_pages(current, current->mm, user_addr, | 625 | result = get_user_pages(current, current->mm, user_addr, |
611 | data->npages, 0, 0, data->pagevec, NULL); | 626 | data->npages, 0, 0, data->pagevec, NULL); |
612 | up_read(¤t->mm->mmap_sem); | 627 | up_read(¤t->mm->mmap_sem); |
613 | if (unlikely(result < data->npages)) { | 628 | if (result < 0) { |
614 | if (result > 0) | 629 | nfs_writedata_release(data); |
615 | nfs_direct_release_pages(data->pagevec, result); | 630 | break; |
631 | } | ||
632 | if ((unsigned)result < data->npages) { | ||
633 | nfs_direct_release_pages(data->pagevec, result); | ||
616 | nfs_writedata_release(data); | 634 | nfs_writedata_release(data); |
617 | break; | 635 | break; |
618 | } | 636 | } |
@@ -703,6 +721,7 @@ static ssize_t nfs_direct_write(struct kiocb *iocb, unsigned long user_addr, siz | |||
703 | if (!result) | 721 | if (!result) |
704 | result = nfs_direct_wait(dreq); | 722 | result = nfs_direct_wait(dreq); |
705 | rpc_clnt_sigunmask(clnt, &oldset); | 723 | rpc_clnt_sigunmask(clnt, &oldset); |
724 | nfs_direct_req_release(dreq); | ||
706 | 725 | ||
707 | return result; | 726 | return result; |
708 | } | 727 | } |
diff --git a/fs/nfs/file.c b/fs/nfs/file.c index 5eaee6dd040b..9eb8eb4e4a08 100644 --- a/fs/nfs/file.c +++ b/fs/nfs/file.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/slab.h> | 27 | #include <linux/slab.h> |
28 | #include <linux/pagemap.h> | 28 | #include <linux/pagemap.h> |
29 | #include <linux/smp_lock.h> | 29 | #include <linux/smp_lock.h> |
30 | #include <linux/aio.h> | ||
30 | 31 | ||
31 | #include <asm/uaccess.h> | 32 | #include <asm/uaccess.h> |
32 | #include <asm/system.h> | 33 | #include <asm/system.h> |
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index 2a3fd9573207..bd9f5a836592 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c | |||
@@ -15,7 +15,7 @@ | |||
15 | 15 | ||
16 | #include <linux/module.h> | 16 | #include <linux/module.h> |
17 | #include <linux/init.h> | 17 | #include <linux/init.h> |
18 | 18 | #include <linux/sched.h> | |
19 | #include <linux/time.h> | 19 | #include <linux/time.h> |
20 | #include <linux/kernel.h> | 20 | #include <linux/kernel.h> |
21 | #include <linux/mm.h> | 21 | #include <linux/mm.h> |
@@ -1164,21 +1164,19 @@ static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flag | |||
1164 | { | 1164 | { |
1165 | struct nfs_inode *nfsi = (struct nfs_inode *) foo; | 1165 | struct nfs_inode *nfsi = (struct nfs_inode *) foo; |
1166 | 1166 | ||
1167 | if (flags & SLAB_CTOR_CONSTRUCTOR) { | 1167 | inode_init_once(&nfsi->vfs_inode); |
1168 | inode_init_once(&nfsi->vfs_inode); | 1168 | spin_lock_init(&nfsi->req_lock); |
1169 | spin_lock_init(&nfsi->req_lock); | 1169 | INIT_LIST_HEAD(&nfsi->dirty); |
1170 | INIT_LIST_HEAD(&nfsi->dirty); | 1170 | INIT_LIST_HEAD(&nfsi->commit); |
1171 | INIT_LIST_HEAD(&nfsi->commit); | 1171 | INIT_LIST_HEAD(&nfsi->open_files); |
1172 | INIT_LIST_HEAD(&nfsi->open_files); | 1172 | INIT_LIST_HEAD(&nfsi->access_cache_entry_lru); |
1173 | INIT_LIST_HEAD(&nfsi->access_cache_entry_lru); | 1173 | INIT_LIST_HEAD(&nfsi->access_cache_inode_lru); |
1174 | INIT_LIST_HEAD(&nfsi->access_cache_inode_lru); | 1174 | INIT_RADIX_TREE(&nfsi->nfs_page_tree, GFP_ATOMIC); |
1175 | INIT_RADIX_TREE(&nfsi->nfs_page_tree, GFP_ATOMIC); | 1175 | atomic_set(&nfsi->data_updates, 0); |
1176 | atomic_set(&nfsi->data_updates, 0); | 1176 | nfsi->ndirty = 0; |
1177 | nfsi->ndirty = 0; | 1177 | nfsi->ncommit = 0; |
1178 | nfsi->ncommit = 0; | 1178 | nfsi->npages = 0; |
1179 | nfsi->npages = 0; | 1179 | nfs4_init_once(nfsi); |
1180 | nfs4_init_once(nfsi); | ||
1181 | } | ||
1182 | } | 1180 | } |
1183 | 1181 | ||
1184 | static int __init nfs_init_inodecache(void) | 1182 | static int __init nfs_init_inodecache(void) |
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index d6a30e965787..648e0ac0f90e 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -790,7 +790,7 @@ out: | |||
790 | return -EACCES; | 790 | return -EACCES; |
791 | } | 791 | } |
792 | 792 | ||
793 | int nfs4_recover_expired_lease(struct nfs_server *server) | 793 | static int nfs4_recover_expired_lease(struct nfs_server *server) |
794 | { | 794 | { |
795 | struct nfs_client *clp = server->nfs_client; | 795 | struct nfs_client *clp = server->nfs_client; |
796 | int ret; | 796 | int ret; |
@@ -2748,7 +2748,7 @@ static int nfs4_delay(struct rpc_clnt *clnt, long *timeout) | |||
2748 | /* This is the error handling routine for processes that are allowed | 2748 | /* This is the error handling routine for processes that are allowed |
2749 | * to sleep. | 2749 | * to sleep. |
2750 | */ | 2750 | */ |
2751 | int nfs4_handle_exception(const struct nfs_server *server, int errorcode, struct nfs4_exception *exception) | 2751 | static int nfs4_handle_exception(const struct nfs_server *server, int errorcode, struct nfs4_exception *exception) |
2752 | { | 2752 | { |
2753 | struct nfs_client *clp = server->nfs_client; | 2753 | struct nfs_client *clp = server->nfs_client; |
2754 | int ret = errorcode; | 2754 | int ret = errorcode; |
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c index 5fffbdfa971f..8ed79d5c54f9 100644 --- a/fs/nfs/nfs4state.c +++ b/fs/nfs/nfs4state.c | |||
@@ -104,7 +104,7 @@ struct rpc_cred *nfs4_get_renew_cred(struct nfs_client *clp) | |||
104 | return cred; | 104 | return cred; |
105 | } | 105 | } |
106 | 106 | ||
107 | struct rpc_cred *nfs4_get_setclientid_cred(struct nfs_client *clp) | 107 | static struct rpc_cred *nfs4_get_setclientid_cred(struct nfs_client *clp) |
108 | { | 108 | { |
109 | struct nfs4_state_owner *sp; | 109 | struct nfs4_state_owner *sp; |
110 | 110 | ||
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c index 938f37166788..8003c91ccb9a 100644 --- a/fs/nfs/nfs4xdr.c +++ b/fs/nfs/nfs4xdr.c | |||
@@ -646,10 +646,10 @@ static int encode_close(struct xdr_stream *xdr, const struct nfs_closeargs *arg) | |||
646 | { | 646 | { |
647 | __be32 *p; | 647 | __be32 *p; |
648 | 648 | ||
649 | RESERVE_SPACE(8+sizeof(arg->stateid->data)); | 649 | RESERVE_SPACE(8+NFS4_STATEID_SIZE); |
650 | WRITE32(OP_CLOSE); | 650 | WRITE32(OP_CLOSE); |
651 | WRITE32(arg->seqid->sequence->counter); | 651 | WRITE32(arg->seqid->sequence->counter); |
652 | WRITEMEM(arg->stateid->data, sizeof(arg->stateid->data)); | 652 | WRITEMEM(arg->stateid->data, NFS4_STATEID_SIZE); |
653 | 653 | ||
654 | return 0; | 654 | return 0; |
655 | } | 655 | } |
@@ -793,17 +793,17 @@ static int encode_lock(struct xdr_stream *xdr, const struct nfs_lock_args *args) | |||
793 | WRITE64(nfs4_lock_length(args->fl)); | 793 | WRITE64(nfs4_lock_length(args->fl)); |
794 | WRITE32(args->new_lock_owner); | 794 | WRITE32(args->new_lock_owner); |
795 | if (args->new_lock_owner){ | 795 | if (args->new_lock_owner){ |
796 | RESERVE_SPACE(40); | 796 | RESERVE_SPACE(4+NFS4_STATEID_SIZE+20); |
797 | WRITE32(args->open_seqid->sequence->counter); | 797 | WRITE32(args->open_seqid->sequence->counter); |
798 | WRITEMEM(args->open_stateid->data, sizeof(args->open_stateid->data)); | 798 | WRITEMEM(args->open_stateid->data, NFS4_STATEID_SIZE); |
799 | WRITE32(args->lock_seqid->sequence->counter); | 799 | WRITE32(args->lock_seqid->sequence->counter); |
800 | WRITE64(args->lock_owner.clientid); | 800 | WRITE64(args->lock_owner.clientid); |
801 | WRITE32(4); | 801 | WRITE32(4); |
802 | WRITE32(args->lock_owner.id); | 802 | WRITE32(args->lock_owner.id); |
803 | } | 803 | } |
804 | else { | 804 | else { |
805 | RESERVE_SPACE(20); | 805 | RESERVE_SPACE(NFS4_STATEID_SIZE+4); |
806 | WRITEMEM(args->lock_stateid->data, sizeof(args->lock_stateid->data)); | 806 | WRITEMEM(args->lock_stateid->data, NFS4_STATEID_SIZE); |
807 | WRITE32(args->lock_seqid->sequence->counter); | 807 | WRITE32(args->lock_seqid->sequence->counter); |
808 | } | 808 | } |
809 | 809 | ||
@@ -830,11 +830,11 @@ static int encode_locku(struct xdr_stream *xdr, const struct nfs_locku_args *arg | |||
830 | { | 830 | { |
831 | __be32 *p; | 831 | __be32 *p; |
832 | 832 | ||
833 | RESERVE_SPACE(44); | 833 | RESERVE_SPACE(12+NFS4_STATEID_SIZE+16); |
834 | WRITE32(OP_LOCKU); | 834 | WRITE32(OP_LOCKU); |
835 | WRITE32(nfs4_lock_type(args->fl, 0)); | 835 | WRITE32(nfs4_lock_type(args->fl, 0)); |
836 | WRITE32(args->seqid->sequence->counter); | 836 | WRITE32(args->seqid->sequence->counter); |
837 | WRITEMEM(args->stateid->data, sizeof(args->stateid->data)); | 837 | WRITEMEM(args->stateid->data, NFS4_STATEID_SIZE); |
838 | WRITE64(args->fl->fl_start); | 838 | WRITE64(args->fl->fl_start); |
839 | WRITE64(nfs4_lock_length(args->fl)); | 839 | WRITE64(nfs4_lock_length(args->fl)); |
840 | 840 | ||
@@ -966,9 +966,9 @@ static inline void encode_claim_delegate_cur(struct xdr_stream *xdr, const struc | |||
966 | { | 966 | { |
967 | __be32 *p; | 967 | __be32 *p; |
968 | 968 | ||
969 | RESERVE_SPACE(4+sizeof(stateid->data)); | 969 | RESERVE_SPACE(4+NFS4_STATEID_SIZE); |
970 | WRITE32(NFS4_OPEN_CLAIM_DELEGATE_CUR); | 970 | WRITE32(NFS4_OPEN_CLAIM_DELEGATE_CUR); |
971 | WRITEMEM(stateid->data, sizeof(stateid->data)); | 971 | WRITEMEM(stateid->data, NFS4_STATEID_SIZE); |
972 | encode_string(xdr, name->len, name->name); | 972 | encode_string(xdr, name->len, name->name); |
973 | } | 973 | } |
974 | 974 | ||
@@ -996,9 +996,9 @@ static int encode_open_confirm(struct xdr_stream *xdr, const struct nfs_open_con | |||
996 | { | 996 | { |
997 | __be32 *p; | 997 | __be32 *p; |
998 | 998 | ||
999 | RESERVE_SPACE(8+sizeof(arg->stateid->data)); | 999 | RESERVE_SPACE(4+NFS4_STATEID_SIZE+4); |
1000 | WRITE32(OP_OPEN_CONFIRM); | 1000 | WRITE32(OP_OPEN_CONFIRM); |
1001 | WRITEMEM(arg->stateid->data, sizeof(arg->stateid->data)); | 1001 | WRITEMEM(arg->stateid->data, NFS4_STATEID_SIZE); |
1002 | WRITE32(arg->seqid->sequence->counter); | 1002 | WRITE32(arg->seqid->sequence->counter); |
1003 | 1003 | ||
1004 | return 0; | 1004 | return 0; |
@@ -1008,9 +1008,9 @@ static int encode_open_downgrade(struct xdr_stream *xdr, const struct nfs_closea | |||
1008 | { | 1008 | { |
1009 | __be32 *p; | 1009 | __be32 *p; |
1010 | 1010 | ||
1011 | RESERVE_SPACE(8+sizeof(arg->stateid->data)); | 1011 | RESERVE_SPACE(4+NFS4_STATEID_SIZE+4); |
1012 | WRITE32(OP_OPEN_DOWNGRADE); | 1012 | WRITE32(OP_OPEN_DOWNGRADE); |
1013 | WRITEMEM(arg->stateid->data, sizeof(arg->stateid->data)); | 1013 | WRITEMEM(arg->stateid->data, NFS4_STATEID_SIZE); |
1014 | WRITE32(arg->seqid->sequence->counter); | 1014 | WRITE32(arg->seqid->sequence->counter); |
1015 | encode_share_access(xdr, arg->open_flags); | 1015 | encode_share_access(xdr, arg->open_flags); |
1016 | return 0; | 1016 | return 0; |
@@ -1045,12 +1045,12 @@ static void encode_stateid(struct xdr_stream *xdr, const struct nfs_open_context | |||
1045 | nfs4_stateid stateid; | 1045 | nfs4_stateid stateid; |
1046 | __be32 *p; | 1046 | __be32 *p; |
1047 | 1047 | ||
1048 | RESERVE_SPACE(16); | 1048 | RESERVE_SPACE(NFS4_STATEID_SIZE); |
1049 | if (ctx->state != NULL) { | 1049 | if (ctx->state != NULL) { |
1050 | nfs4_copy_stateid(&stateid, ctx->state, ctx->lockowner); | 1050 | nfs4_copy_stateid(&stateid, ctx->state, ctx->lockowner); |
1051 | WRITEMEM(stateid.data, sizeof(stateid.data)); | 1051 | WRITEMEM(stateid.data, NFS4_STATEID_SIZE); |
1052 | } else | 1052 | } else |
1053 | WRITEMEM(zero_stateid.data, sizeof(zero_stateid.data)); | 1053 | WRITEMEM(zero_stateid.data, NFS4_STATEID_SIZE); |
1054 | } | 1054 | } |
1055 | 1055 | ||
1056 | static int encode_read(struct xdr_stream *xdr, const struct nfs_readargs *args) | 1056 | static int encode_read(struct xdr_stream *xdr, const struct nfs_readargs *args) |
@@ -1079,10 +1079,10 @@ static int encode_readdir(struct xdr_stream *xdr, const struct nfs4_readdir_arg | |||
1079 | int replen; | 1079 | int replen; |
1080 | __be32 *p; | 1080 | __be32 *p; |
1081 | 1081 | ||
1082 | RESERVE_SPACE(32+sizeof(nfs4_verifier)); | 1082 | RESERVE_SPACE(12+NFS4_VERIFIER_SIZE+20); |
1083 | WRITE32(OP_READDIR); | 1083 | WRITE32(OP_READDIR); |
1084 | WRITE64(readdir->cookie); | 1084 | WRITE64(readdir->cookie); |
1085 | WRITEMEM(readdir->verifier.data, sizeof(readdir->verifier.data)); | 1085 | WRITEMEM(readdir->verifier.data, NFS4_VERIFIER_SIZE); |
1086 | WRITE32(readdir->count >> 1); /* We're not doing readdirplus */ | 1086 | WRITE32(readdir->count >> 1); /* We're not doing readdirplus */ |
1087 | WRITE32(readdir->count); | 1087 | WRITE32(readdir->count); |
1088 | WRITE32(2); | 1088 | WRITE32(2); |
@@ -1190,9 +1190,9 @@ encode_setacl(struct xdr_stream *xdr, struct nfs_setaclargs *arg) | |||
1190 | { | 1190 | { |
1191 | __be32 *p; | 1191 | __be32 *p; |
1192 | 1192 | ||
1193 | RESERVE_SPACE(4+sizeof(zero_stateid.data)); | 1193 | RESERVE_SPACE(4+NFS4_STATEID_SIZE); |
1194 | WRITE32(OP_SETATTR); | 1194 | WRITE32(OP_SETATTR); |
1195 | WRITEMEM(zero_stateid.data, sizeof(zero_stateid.data)); | 1195 | WRITEMEM(zero_stateid.data, NFS4_STATEID_SIZE); |
1196 | RESERVE_SPACE(2*4); | 1196 | RESERVE_SPACE(2*4); |
1197 | WRITE32(1); | 1197 | WRITE32(1); |
1198 | WRITE32(FATTR4_WORD0_ACL); | 1198 | WRITE32(FATTR4_WORD0_ACL); |
@@ -1220,9 +1220,9 @@ static int encode_setattr(struct xdr_stream *xdr, const struct nfs_setattrargs * | |||
1220 | int status; | 1220 | int status; |
1221 | __be32 *p; | 1221 | __be32 *p; |
1222 | 1222 | ||
1223 | RESERVE_SPACE(4+sizeof(arg->stateid.data)); | 1223 | RESERVE_SPACE(4+NFS4_STATEID_SIZE); |
1224 | WRITE32(OP_SETATTR); | 1224 | WRITE32(OP_SETATTR); |
1225 | WRITEMEM(arg->stateid.data, sizeof(arg->stateid.data)); | 1225 | WRITEMEM(arg->stateid.data, NFS4_STATEID_SIZE); |
1226 | 1226 | ||
1227 | if ((status = encode_attrs(xdr, arg->iap, server))) | 1227 | if ((status = encode_attrs(xdr, arg->iap, server))) |
1228 | return status; | 1228 | return status; |
@@ -1234,9 +1234,9 @@ static int encode_setclientid(struct xdr_stream *xdr, const struct nfs4_setclien | |||
1234 | { | 1234 | { |
1235 | __be32 *p; | 1235 | __be32 *p; |
1236 | 1236 | ||
1237 | RESERVE_SPACE(4 + sizeof(setclientid->sc_verifier->data)); | 1237 | RESERVE_SPACE(4 + NFS4_VERIFIER_SIZE); |
1238 | WRITE32(OP_SETCLIENTID); | 1238 | WRITE32(OP_SETCLIENTID); |
1239 | WRITEMEM(setclientid->sc_verifier->data, sizeof(setclientid->sc_verifier->data)); | 1239 | WRITEMEM(setclientid->sc_verifier->data, NFS4_VERIFIER_SIZE); |
1240 | 1240 | ||
1241 | encode_string(xdr, setclientid->sc_name_len, setclientid->sc_name); | 1241 | encode_string(xdr, setclientid->sc_name_len, setclientid->sc_name); |
1242 | RESERVE_SPACE(4); | 1242 | RESERVE_SPACE(4); |
@@ -1253,10 +1253,10 @@ static int encode_setclientid_confirm(struct xdr_stream *xdr, const struct nfs_c | |||
1253 | { | 1253 | { |
1254 | __be32 *p; | 1254 | __be32 *p; |
1255 | 1255 | ||
1256 | RESERVE_SPACE(12 + sizeof(client_state->cl_confirm.data)); | 1256 | RESERVE_SPACE(12 + NFS4_VERIFIER_SIZE); |
1257 | WRITE32(OP_SETCLIENTID_CONFIRM); | 1257 | WRITE32(OP_SETCLIENTID_CONFIRM); |
1258 | WRITE64(client_state->cl_clientid); | 1258 | WRITE64(client_state->cl_clientid); |
1259 | WRITEMEM(client_state->cl_confirm.data, sizeof(client_state->cl_confirm.data)); | 1259 | WRITEMEM(client_state->cl_confirm.data, NFS4_VERIFIER_SIZE); |
1260 | 1260 | ||
1261 | return 0; | 1261 | return 0; |
1262 | } | 1262 | } |
@@ -1284,10 +1284,10 @@ static int encode_delegreturn(struct xdr_stream *xdr, const nfs4_stateid *statei | |||
1284 | { | 1284 | { |
1285 | __be32 *p; | 1285 | __be32 *p; |
1286 | 1286 | ||
1287 | RESERVE_SPACE(20); | 1287 | RESERVE_SPACE(4+NFS4_STATEID_SIZE); |
1288 | 1288 | ||
1289 | WRITE32(OP_DELEGRETURN); | 1289 | WRITE32(OP_DELEGRETURN); |
1290 | WRITEMEM(stateid->data, sizeof(stateid->data)); | 1290 | WRITEMEM(stateid->data, NFS4_STATEID_SIZE); |
1291 | return 0; | 1291 | return 0; |
1292 | 1292 | ||
1293 | } | 1293 | } |
@@ -2494,7 +2494,7 @@ static int decode_attr_fs_locations(struct xdr_stream *xdr, uint32_t *bitmap, st | |||
2494 | int i; | 2494 | int i; |
2495 | dprintk("%s: using first %d of %d servers returned for location %d\n", __FUNCTION__, NFS4_FS_LOCATION_MAXSERVERS, m, res->nlocations); | 2495 | dprintk("%s: using first %d of %d servers returned for location %d\n", __FUNCTION__, NFS4_FS_LOCATION_MAXSERVERS, m, res->nlocations); |
2496 | for (i = loc->nservers; i < m; i++) { | 2496 | for (i = loc->nservers; i < m; i++) { |
2497 | int len; | 2497 | unsigned int len; |
2498 | char *data; | 2498 | char *data; |
2499 | status = decode_opaque_inline(xdr, &len, &data); | 2499 | status = decode_opaque_inline(xdr, &len, &data); |
2500 | if (unlikely(status != 0)) | 2500 | if (unlikely(status != 0)) |
@@ -2642,7 +2642,7 @@ static int decode_attr_nlink(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t | |||
2642 | return 0; | 2642 | return 0; |
2643 | } | 2643 | } |
2644 | 2644 | ||
2645 | static int decode_attr_owner(struct xdr_stream *xdr, uint32_t *bitmap, struct nfs_client *clp, int32_t *uid) | 2645 | static int decode_attr_owner(struct xdr_stream *xdr, uint32_t *bitmap, struct nfs_client *clp, uint32_t *uid) |
2646 | { | 2646 | { |
2647 | uint32_t len; | 2647 | uint32_t len; |
2648 | __be32 *p; | 2648 | __be32 *p; |
@@ -2667,7 +2667,7 @@ static int decode_attr_owner(struct xdr_stream *xdr, uint32_t *bitmap, struct nf | |||
2667 | return 0; | 2667 | return 0; |
2668 | } | 2668 | } |
2669 | 2669 | ||
2670 | static int decode_attr_group(struct xdr_stream *xdr, uint32_t *bitmap, struct nfs_client *clp, int32_t *gid) | 2670 | static int decode_attr_group(struct xdr_stream *xdr, uint32_t *bitmap, struct nfs_client *clp, uint32_t *gid) |
2671 | { | 2671 | { |
2672 | uint32_t len; | 2672 | uint32_t len; |
2673 | __be32 *p; | 2673 | __be32 *p; |
@@ -2897,8 +2897,8 @@ static int decode_close(struct xdr_stream *xdr, struct nfs_closeres *res) | |||
2897 | status = decode_op_hdr(xdr, OP_CLOSE); | 2897 | status = decode_op_hdr(xdr, OP_CLOSE); |
2898 | if (status) | 2898 | if (status) |
2899 | return status; | 2899 | return status; |
2900 | READ_BUF(sizeof(res->stateid.data)); | 2900 | READ_BUF(NFS4_STATEID_SIZE); |
2901 | COPYMEM(res->stateid.data, sizeof(res->stateid.data)); | 2901 | COPYMEM(res->stateid.data, NFS4_STATEID_SIZE); |
2902 | return 0; | 2902 | return 0; |
2903 | } | 2903 | } |
2904 | 2904 | ||
@@ -3186,8 +3186,8 @@ static int decode_lock(struct xdr_stream *xdr, struct nfs_lock_res *res) | |||
3186 | 3186 | ||
3187 | status = decode_op_hdr(xdr, OP_LOCK); | 3187 | status = decode_op_hdr(xdr, OP_LOCK); |
3188 | if (status == 0) { | 3188 | if (status == 0) { |
3189 | READ_BUF(sizeof(res->stateid.data)); | 3189 | READ_BUF(NFS4_STATEID_SIZE); |
3190 | COPYMEM(res->stateid.data, sizeof(res->stateid.data)); | 3190 | COPYMEM(res->stateid.data, NFS4_STATEID_SIZE); |
3191 | } else if (status == -NFS4ERR_DENIED) | 3191 | } else if (status == -NFS4ERR_DENIED) |
3192 | return decode_lock_denied(xdr, NULL); | 3192 | return decode_lock_denied(xdr, NULL); |
3193 | return status; | 3193 | return status; |
@@ -3209,8 +3209,8 @@ static int decode_locku(struct xdr_stream *xdr, struct nfs_locku_res *res) | |||
3209 | 3209 | ||
3210 | status = decode_op_hdr(xdr, OP_LOCKU); | 3210 | status = decode_op_hdr(xdr, OP_LOCKU); |
3211 | if (status == 0) { | 3211 | if (status == 0) { |
3212 | READ_BUF(sizeof(res->stateid.data)); | 3212 | READ_BUF(NFS4_STATEID_SIZE); |
3213 | COPYMEM(res->stateid.data, sizeof(res->stateid.data)); | 3213 | COPYMEM(res->stateid.data, NFS4_STATEID_SIZE); |
3214 | } | 3214 | } |
3215 | return status; | 3215 | return status; |
3216 | } | 3216 | } |
@@ -3251,8 +3251,8 @@ static int decode_delegation(struct xdr_stream *xdr, struct nfs_openres *res) | |||
3251 | res->delegation_type = 0; | 3251 | res->delegation_type = 0; |
3252 | return 0; | 3252 | return 0; |
3253 | } | 3253 | } |
3254 | READ_BUF(20); | 3254 | READ_BUF(NFS4_STATEID_SIZE+4); |
3255 | COPYMEM(res->delegation.data, sizeof(res->delegation.data)); | 3255 | COPYMEM(res->delegation.data, NFS4_STATEID_SIZE); |
3256 | READ32(res->do_recall); | 3256 | READ32(res->do_recall); |
3257 | switch (delegation_type) { | 3257 | switch (delegation_type) { |
3258 | case NFS4_OPEN_DELEGATE_READ: | 3258 | case NFS4_OPEN_DELEGATE_READ: |
@@ -3275,8 +3275,8 @@ static int decode_open(struct xdr_stream *xdr, struct nfs_openres *res) | |||
3275 | status = decode_op_hdr(xdr, OP_OPEN); | 3275 | status = decode_op_hdr(xdr, OP_OPEN); |
3276 | if (status) | 3276 | if (status) |
3277 | return status; | 3277 | return status; |
3278 | READ_BUF(sizeof(res->stateid.data)); | 3278 | READ_BUF(NFS4_STATEID_SIZE); |
3279 | COPYMEM(res->stateid.data, sizeof(res->stateid.data)); | 3279 | COPYMEM(res->stateid.data, NFS4_STATEID_SIZE); |
3280 | 3280 | ||
3281 | decode_change_info(xdr, &res->cinfo); | 3281 | decode_change_info(xdr, &res->cinfo); |
3282 | 3282 | ||
@@ -3302,8 +3302,8 @@ static int decode_open_confirm(struct xdr_stream *xdr, struct nfs_open_confirmre | |||
3302 | status = decode_op_hdr(xdr, OP_OPEN_CONFIRM); | 3302 | status = decode_op_hdr(xdr, OP_OPEN_CONFIRM); |
3303 | if (status) | 3303 | if (status) |
3304 | return status; | 3304 | return status; |
3305 | READ_BUF(sizeof(res->stateid.data)); | 3305 | READ_BUF(NFS4_STATEID_SIZE); |
3306 | COPYMEM(res->stateid.data, sizeof(res->stateid.data)); | 3306 | COPYMEM(res->stateid.data, NFS4_STATEID_SIZE); |
3307 | return 0; | 3307 | return 0; |
3308 | } | 3308 | } |
3309 | 3309 | ||
@@ -3315,8 +3315,8 @@ static int decode_open_downgrade(struct xdr_stream *xdr, struct nfs_closeres *re | |||
3315 | status = decode_op_hdr(xdr, OP_OPEN_DOWNGRADE); | 3315 | status = decode_op_hdr(xdr, OP_OPEN_DOWNGRADE); |
3316 | if (status) | 3316 | if (status) |
3317 | return status; | 3317 | return status; |
3318 | READ_BUF(sizeof(res->stateid.data)); | 3318 | READ_BUF(NFS4_STATEID_SIZE); |
3319 | COPYMEM(res->stateid.data, sizeof(res->stateid.data)); | 3319 | COPYMEM(res->stateid.data, NFS4_STATEID_SIZE); |
3320 | return 0; | 3320 | return 0; |
3321 | } | 3321 | } |
3322 | 3322 | ||
@@ -3590,9 +3590,9 @@ static int decode_setclientid(struct xdr_stream *xdr, struct nfs_client *clp) | |||
3590 | } | 3590 | } |
3591 | READ32(nfserr); | 3591 | READ32(nfserr); |
3592 | if (nfserr == NFS_OK) { | 3592 | if (nfserr == NFS_OK) { |
3593 | READ_BUF(8 + sizeof(clp->cl_confirm.data)); | 3593 | READ_BUF(8 + NFS4_VERIFIER_SIZE); |
3594 | READ64(clp->cl_clientid); | 3594 | READ64(clp->cl_clientid); |
3595 | COPYMEM(clp->cl_confirm.data, sizeof(clp->cl_confirm.data)); | 3595 | COPYMEM(clp->cl_confirm.data, NFS4_VERIFIER_SIZE); |
3596 | } else if (nfserr == NFSERR_CLID_INUSE) { | 3596 | } else if (nfserr == NFSERR_CLID_INUSE) { |
3597 | uint32_t len; | 3597 | uint32_t len; |
3598 | 3598 | ||
diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c index e12054c86d0d..c5bb51a29e80 100644 --- a/fs/nfs/pagelist.c +++ b/fs/nfs/pagelist.c | |||
@@ -11,6 +11,7 @@ | |||
11 | 11 | ||
12 | #include <linux/slab.h> | 12 | #include <linux/slab.h> |
13 | #include <linux/file.h> | 13 | #include <linux/file.h> |
14 | #include <linux/sched.h> | ||
14 | #include <linux/sunrpc/clnt.h> | 15 | #include <linux/sunrpc/clnt.h> |
15 | #include <linux/nfs3.h> | 16 | #include <linux/nfs3.h> |
16 | #include <linux/nfs4.h> | 17 | #include <linux/nfs4.h> |
@@ -354,6 +355,26 @@ void nfs_pageio_complete(struct nfs_pageio_descriptor *desc) | |||
354 | nfs_pageio_doio(desc); | 355 | nfs_pageio_doio(desc); |
355 | } | 356 | } |
356 | 357 | ||
358 | /** | ||
359 | * nfs_pageio_cond_complete - Conditional I/O completion | ||
360 | * @desc: pointer to io descriptor | ||
361 | * @index: page index | ||
362 | * | ||
363 | * It is important to ensure that processes don't try to take locks | ||
364 | * on non-contiguous ranges of pages as that might deadlock. This | ||
365 | * function should be called before attempting to wait on a locked | ||
366 | * nfs_page. It will complete the I/O if the page index 'index' | ||
367 | * is not contiguous with the existing list of pages in 'desc'. | ||
368 | */ | ||
369 | void nfs_pageio_cond_complete(struct nfs_pageio_descriptor *desc, pgoff_t index) | ||
370 | { | ||
371 | if (!list_empty(&desc->pg_list)) { | ||
372 | struct nfs_page *prev = nfs_list_entry(desc->pg_list.prev); | ||
373 | if (index != prev->wb_index + 1) | ||
374 | nfs_pageio_doio(desc); | ||
375 | } | ||
376 | } | ||
377 | |||
357 | #define NFS_SCAN_MAXENTRIES 16 | 378 | #define NFS_SCAN_MAXENTRIES 16 |
358 | /** | 379 | /** |
359 | * nfs_scan_list - Scan a list for matching requests | 380 | * nfs_scan_list - Scan a list for matching requests |
diff --git a/fs/nfs/read.c b/fs/nfs/read.c index 9a55807b2a70..7bd7cb95c034 100644 --- a/fs/nfs/read.c +++ b/fs/nfs/read.c | |||
@@ -79,7 +79,7 @@ void nfs_readdata_release(void *data) | |||
79 | static | 79 | static |
80 | int nfs_return_empty_page(struct page *page) | 80 | int nfs_return_empty_page(struct page *page) |
81 | { | 81 | { |
82 | memclear_highpage_flush(page, 0, PAGE_CACHE_SIZE); | 82 | zero_user_page(page, 0, PAGE_CACHE_SIZE, KM_USER0); |
83 | SetPageUptodate(page); | 83 | SetPageUptodate(page); |
84 | unlock_page(page); | 84 | unlock_page(page); |
85 | return 0; | 85 | return 0; |
@@ -103,10 +103,10 @@ static void nfs_readpage_truncate_uninitialised_page(struct nfs_read_data *data) | |||
103 | pglen = PAGE_CACHE_SIZE - base; | 103 | pglen = PAGE_CACHE_SIZE - base; |
104 | for (;;) { | 104 | for (;;) { |
105 | if (remainder <= pglen) { | 105 | if (remainder <= pglen) { |
106 | memclear_highpage_flush(*pages, base, remainder); | 106 | zero_user_page(*pages, base, remainder, KM_USER0); |
107 | break; | 107 | break; |
108 | } | 108 | } |
109 | memclear_highpage_flush(*pages, base, pglen); | 109 | zero_user_page(*pages, base, pglen, KM_USER0); |
110 | pages++; | 110 | pages++; |
111 | remainder -= pglen; | 111 | remainder -= pglen; |
112 | pglen = PAGE_CACHE_SIZE; | 112 | pglen = PAGE_CACHE_SIZE; |
@@ -130,7 +130,7 @@ static int nfs_readpage_async(struct nfs_open_context *ctx, struct inode *inode, | |||
130 | return PTR_ERR(new); | 130 | return PTR_ERR(new); |
131 | } | 131 | } |
132 | if (len < PAGE_CACHE_SIZE) | 132 | if (len < PAGE_CACHE_SIZE) |
133 | memclear_highpage_flush(page, len, PAGE_CACHE_SIZE - len); | 133 | zero_user_page(page, len, PAGE_CACHE_SIZE - len, KM_USER0); |
134 | 134 | ||
135 | nfs_list_add_request(new, &one_request); | 135 | nfs_list_add_request(new, &one_request); |
136 | if (NFS_SERVER(inode)->rsize < PAGE_CACHE_SIZE) | 136 | if (NFS_SERVER(inode)->rsize < PAGE_CACHE_SIZE) |
@@ -532,7 +532,7 @@ readpage_async_filler(void *data, struct page *page) | |||
532 | return PTR_ERR(new); | 532 | return PTR_ERR(new); |
533 | } | 533 | } |
534 | if (len < PAGE_CACHE_SIZE) | 534 | if (len < PAGE_CACHE_SIZE) |
535 | memclear_highpage_flush(page, len, PAGE_CACHE_SIZE - len); | 535 | zero_user_page(page, len, PAGE_CACHE_SIZE - len, KM_USER0); |
536 | nfs_pageio_add_request(desc->pgio, new); | 536 | nfs_pageio_add_request(desc->pgio, new); |
537 | return 0; | 537 | return 0; |
538 | } | 538 | } |
diff --git a/fs/nfs/write.c b/fs/nfs/write.c index de92b9509d94..af344a158e01 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c | |||
@@ -58,7 +58,7 @@ struct nfs_write_data *nfs_commit_alloc(void) | |||
58 | return p; | 58 | return p; |
59 | } | 59 | } |
60 | 60 | ||
61 | void nfs_commit_rcu_free(struct rcu_head *head) | 61 | static void nfs_commit_rcu_free(struct rcu_head *head) |
62 | { | 62 | { |
63 | struct nfs_write_data *p = container_of(head, struct nfs_write_data, task.u.tk_rcu); | 63 | struct nfs_write_data *p = container_of(head, struct nfs_write_data, task.u.tk_rcu); |
64 | if (p && (p->pagevec != &p->page_array[0])) | 64 | if (p && (p->pagevec != &p->page_array[0])) |
@@ -168,7 +168,7 @@ static void nfs_mark_uptodate(struct page *page, unsigned int base, unsigned int | |||
168 | if (count != nfs_page_length(page)) | 168 | if (count != nfs_page_length(page)) |
169 | return; | 169 | return; |
170 | if (count != PAGE_CACHE_SIZE) | 170 | if (count != PAGE_CACHE_SIZE) |
171 | memclear_highpage_flush(page, count, PAGE_CACHE_SIZE - count); | 171 | zero_user_page(page, count, PAGE_CACHE_SIZE - count, KM_USER0); |
172 | SetPageUptodate(page); | 172 | SetPageUptodate(page); |
173 | } | 173 | } |
174 | 174 | ||
@@ -273,8 +273,6 @@ static int nfs_page_async_flush(struct nfs_pageio_descriptor *pgio, | |||
273 | * request as dirty (in which case we don't care). | 273 | * request as dirty (in which case we don't care). |
274 | */ | 274 | */ |
275 | spin_unlock(req_lock); | 275 | spin_unlock(req_lock); |
276 | /* Prevent deadlock! */ | ||
277 | nfs_pageio_complete(pgio); | ||
278 | ret = nfs_wait_on_request(req); | 276 | ret = nfs_wait_on_request(req); |
279 | nfs_release_request(req); | 277 | nfs_release_request(req); |
280 | if (ret != 0) | 278 | if (ret != 0) |
@@ -321,6 +319,8 @@ static int nfs_writepage_locked(struct page *page, struct writeback_control *wbc | |||
321 | pgio = &mypgio; | 319 | pgio = &mypgio; |
322 | } | 320 | } |
323 | 321 | ||
322 | nfs_pageio_cond_complete(pgio, page->index); | ||
323 | |||
324 | err = nfs_page_async_flush(pgio, page); | 324 | err = nfs_page_async_flush(pgio, page); |
325 | if (err <= 0) | 325 | if (err <= 0) |
326 | goto out; | 326 | goto out; |
@@ -329,6 +329,8 @@ static int nfs_writepage_locked(struct page *page, struct writeback_control *wbc | |||
329 | if (!offset) | 329 | if (!offset) |
330 | goto out; | 330 | goto out; |
331 | 331 | ||
332 | nfs_pageio_cond_complete(pgio, page->index); | ||
333 | |||
332 | ctx = nfs_find_open_context(inode, NULL, FMODE_WRITE); | 334 | ctx = nfs_find_open_context(inode, NULL, FMODE_WRITE); |
333 | if (ctx == NULL) { | 335 | if (ctx == NULL) { |
334 | err = -EBADF; | 336 | err = -EBADF; |
@@ -922,7 +924,7 @@ static int nfs_flush_one(struct inode *inode, struct list_head *head, unsigned i | |||
922 | return 0; | 924 | return 0; |
923 | out_bad: | 925 | out_bad: |
924 | while (!list_empty(head)) { | 926 | while (!list_empty(head)) { |
925 | struct nfs_page *req = nfs_list_entry(head->next); | 927 | req = nfs_list_entry(head->next); |
926 | nfs_list_remove_request(req); | 928 | nfs_list_remove_request(req); |
927 | nfs_redirty_request(req); | 929 | nfs_redirty_request(req); |
928 | nfs_end_page_writeback(req->wb_page); | 930 | nfs_end_page_writeback(req->wb_page); |