aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/buffer.c2
-rw-r--r--fs/fs-writeback.c4
-rw-r--r--fs/inode.c9
-rw-r--r--fs/ioprio.c29
-rw-r--r--fs/ncpfs/mmap.c2
-rw-r--r--fs/nfs/pagelist.c1
-rw-r--r--fs/nfs/write.c9
-rw-r--r--fs/nfsd/export.c2
-rw-r--r--fs/nfsd/nfs4state.c32
-rw-r--r--fs/nfsd/nfsfh.c27
-rw-r--r--fs/nfsd/vfs.c14
-rw-r--r--fs/proc/proc_misc.c23
12 files changed, 91 insertions, 63 deletions
diff --git a/fs/buffer.c b/fs/buffer.c
index bf22bb56a080..3660dcb97591 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -851,7 +851,7 @@ int __set_page_dirty_buffers(struct page *page)
851 write_lock_irq(&mapping->tree_lock); 851 write_lock_irq(&mapping->tree_lock);
852 if (page->mapping) { /* Race with truncate? */ 852 if (page->mapping) { /* Race with truncate? */
853 if (mapping_cap_account_dirty(mapping)) 853 if (mapping_cap_account_dirty(mapping))
854 inc_page_state(nr_dirty); 854 __inc_zone_page_state(page, NR_FILE_DIRTY);
855 radix_tree_tag_set(&mapping->page_tree, 855 radix_tree_tag_set(&mapping->page_tree,
856 page_index(page), 856 page_index(page),
857 PAGECACHE_TAG_DIRTY); 857 PAGECACHE_TAG_DIRTY);
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
index 031b27a4bc9a..892643dc9af1 100644
--- a/fs/fs-writeback.c
+++ b/fs/fs-writeback.c
@@ -464,8 +464,8 @@ void sync_inodes_sb(struct super_block *sb, int wait)
464 .range_start = 0, 464 .range_start = 0,
465 .range_end = LLONG_MAX, 465 .range_end = LLONG_MAX,
466 }; 466 };
467 unsigned long nr_dirty = read_page_state(nr_dirty); 467 unsigned long nr_dirty = global_page_state(NR_FILE_DIRTY);
468 unsigned long nr_unstable = read_page_state(nr_unstable); 468 unsigned long nr_unstable = global_page_state(NR_UNSTABLE_NFS);
469 469
470 wbc.nr_to_write = nr_dirty + nr_unstable + 470 wbc.nr_to_write = nr_dirty + nr_unstable +
471 (inodes_stat.nr_inodes - inodes_stat.nr_unused) + 471 (inodes_stat.nr_inodes - inodes_stat.nr_unused) +
diff --git a/fs/inode.c b/fs/inode.c
index e53796a6d880..0bf9f0444a96 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -451,15 +451,14 @@ static void prune_icache(int nr_to_scan)
451 nr_pruned++; 451 nr_pruned++;
452 } 452 }
453 inodes_stat.nr_unused -= nr_pruned; 453 inodes_stat.nr_unused -= nr_pruned;
454 if (current_is_kswapd())
455 __count_vm_events(KSWAPD_INODESTEAL, reap);
456 else
457 __count_vm_events(PGINODESTEAL, reap);
454 spin_unlock(&inode_lock); 458 spin_unlock(&inode_lock);
455 459
456 dispose_list(&freeable); 460 dispose_list(&freeable);
457 mutex_unlock(&iprune_mutex); 461 mutex_unlock(&iprune_mutex);
458
459 if (current_is_kswapd())
460 mod_page_state(kswapd_inodesteal, reap);
461 else
462 mod_page_state(pginodesteal, reap);
463} 462}
464 463
465/* 464/*
diff --git a/fs/ioprio.c b/fs/ioprio.c
index 7fa76ed53c10..93aa5715f224 100644
--- a/fs/ioprio.c
+++ b/fs/ioprio.c
@@ -125,11 +125,24 @@ asmlinkage long sys_ioprio_set(int which, int who, int ioprio)
125 return ret; 125 return ret;
126} 126}
127 127
128static int get_task_ioprio(struct task_struct *p)
129{
130 int ret;
131
132 ret = security_task_getioprio(p);
133 if (ret)
134 goto out;
135 ret = p->ioprio;
136out:
137 return ret;
138}
139
128asmlinkage long sys_ioprio_get(int which, int who) 140asmlinkage long sys_ioprio_get(int which, int who)
129{ 141{
130 struct task_struct *g, *p; 142 struct task_struct *g, *p;
131 struct user_struct *user; 143 struct user_struct *user;
132 int ret = -ESRCH; 144 int ret = -ESRCH;
145 int tmpio;
133 146
134 read_lock_irq(&tasklist_lock); 147 read_lock_irq(&tasklist_lock);
135 switch (which) { 148 switch (which) {
@@ -139,16 +152,19 @@ asmlinkage long sys_ioprio_get(int which, int who)
139 else 152 else
140 p = find_task_by_pid(who); 153 p = find_task_by_pid(who);
141 if (p) 154 if (p)
142 ret = p->ioprio; 155 ret = get_task_ioprio(p);
143 break; 156 break;
144 case IOPRIO_WHO_PGRP: 157 case IOPRIO_WHO_PGRP:
145 if (!who) 158 if (!who)
146 who = process_group(current); 159 who = process_group(current);
147 do_each_task_pid(who, PIDTYPE_PGID, p) { 160 do_each_task_pid(who, PIDTYPE_PGID, p) {
161 tmpio = get_task_ioprio(p);
162 if (tmpio < 0)
163 continue;
148 if (ret == -ESRCH) 164 if (ret == -ESRCH)
149 ret = p->ioprio; 165 ret = tmpio;
150 else 166 else
151 ret = ioprio_best(ret, p->ioprio); 167 ret = ioprio_best(ret, tmpio);
152 } while_each_task_pid(who, PIDTYPE_PGID, p); 168 } while_each_task_pid(who, PIDTYPE_PGID, p);
153 break; 169 break;
154 case IOPRIO_WHO_USER: 170 case IOPRIO_WHO_USER:
@@ -163,10 +179,13 @@ asmlinkage long sys_ioprio_get(int which, int who)
163 do_each_thread(g, p) { 179 do_each_thread(g, p) {
164 if (p->uid != user->uid) 180 if (p->uid != user->uid)
165 continue; 181 continue;
182 tmpio = get_task_ioprio(p);
183 if (tmpio < 0)
184 continue;
166 if (ret == -ESRCH) 185 if (ret == -ESRCH)
167 ret = p->ioprio; 186 ret = tmpio;
168 else 187 else
169 ret = ioprio_best(ret, p->ioprio); 188 ret = ioprio_best(ret, tmpio);
170 } while_each_thread(g, p); 189 } while_each_thread(g, p);
171 190
172 if (who) 191 if (who)
diff --git a/fs/ncpfs/mmap.c b/fs/ncpfs/mmap.c
index 52d60c3d8996..e7d5a3097fe6 100644
--- a/fs/ncpfs/mmap.c
+++ b/fs/ncpfs/mmap.c
@@ -93,7 +93,7 @@ static struct page* ncp_file_mmap_nopage(struct vm_area_struct *area,
93 */ 93 */
94 if (type) 94 if (type)
95 *type = VM_FAULT_MAJOR; 95 *type = VM_FAULT_MAJOR;
96 inc_page_state(pgmajfault); 96 count_vm_event(PGMAJFAULT);
97 return page; 97 return page;
98} 98}
99 99
diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c
index d3ff7abcf545..36e902a88ca1 100644
--- a/fs/nfs/pagelist.c
+++ b/fs/nfs/pagelist.c
@@ -314,6 +314,7 @@ nfs_scan_lock_dirty(struct nfs_inode *nfsi, struct list_head *dst,
314 req->wb_index, NFS_PAGE_TAG_DIRTY); 314 req->wb_index, NFS_PAGE_TAG_DIRTY);
315 nfs_list_remove_request(req); 315 nfs_list_remove_request(req);
316 nfs_list_add_request(req, dst); 316 nfs_list_add_request(req, dst);
317 dec_zone_page_state(req->wb_page, NR_FILE_DIRTY);
317 res++; 318 res++;
318 } 319 }
319 } 320 }
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index 1aadc138ec4a..bca5734ca9fb 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -496,7 +496,7 @@ nfs_mark_request_dirty(struct nfs_page *req)
496 nfs_list_add_request(req, &nfsi->dirty); 496 nfs_list_add_request(req, &nfsi->dirty);
497 nfsi->ndirty++; 497 nfsi->ndirty++;
498 spin_unlock(&nfsi->req_lock); 498 spin_unlock(&nfsi->req_lock);
499 inc_page_state(nr_dirty); 499 inc_zone_page_state(req->wb_page, NR_FILE_DIRTY);
500 mark_inode_dirty(inode); 500 mark_inode_dirty(inode);
501} 501}
502 502
@@ -524,7 +524,7 @@ nfs_mark_request_commit(struct nfs_page *req)
524 nfs_list_add_request(req, &nfsi->commit); 524 nfs_list_add_request(req, &nfsi->commit);
525 nfsi->ncommit++; 525 nfsi->ncommit++;
526 spin_unlock(&nfsi->req_lock); 526 spin_unlock(&nfsi->req_lock);
527 inc_page_state(nr_unstable); 527 inc_zone_page_state(req->wb_page, NR_UNSTABLE_NFS);
528 mark_inode_dirty(inode); 528 mark_inode_dirty(inode);
529} 529}
530#endif 530#endif
@@ -608,7 +608,6 @@ nfs_scan_dirty(struct inode *inode, struct list_head *dst, unsigned long idx_sta
608 if (nfsi->ndirty != 0) { 608 if (nfsi->ndirty != 0) {
609 res = nfs_scan_lock_dirty(nfsi, dst, idx_start, npages); 609 res = nfs_scan_lock_dirty(nfsi, dst, idx_start, npages);
610 nfsi->ndirty -= res; 610 nfsi->ndirty -= res;
611 sub_page_state(nr_dirty,res);
612 if ((nfsi->ndirty == 0) != list_empty(&nfsi->dirty)) 611 if ((nfsi->ndirty == 0) != list_empty(&nfsi->dirty))
613 printk(KERN_ERR "NFS: desynchronized value of nfs_i.ndirty.\n"); 612 printk(KERN_ERR "NFS: desynchronized value of nfs_i.ndirty.\n");
614 } 613 }
@@ -1393,7 +1392,6 @@ static void nfs_commit_done(struct rpc_task *task, void *calldata)
1393{ 1392{
1394 struct nfs_write_data *data = calldata; 1393 struct nfs_write_data *data = calldata;
1395 struct nfs_page *req; 1394 struct nfs_page *req;
1396 int res = 0;
1397 1395
1398 dprintk("NFS: %4d nfs_commit_done (status %d)\n", 1396 dprintk("NFS: %4d nfs_commit_done (status %d)\n",
1399 task->tk_pid, task->tk_status); 1397 task->tk_pid, task->tk_status);
@@ -1405,6 +1403,7 @@ static void nfs_commit_done(struct rpc_task *task, void *calldata)
1405 while (!list_empty(&data->pages)) { 1403 while (!list_empty(&data->pages)) {
1406 req = nfs_list_entry(data->pages.next); 1404 req = nfs_list_entry(data->pages.next);
1407 nfs_list_remove_request(req); 1405 nfs_list_remove_request(req);
1406 dec_zone_page_state(req->wb_page, NR_UNSTABLE_NFS);
1408 1407
1409 dprintk("NFS: commit (%s/%Ld %d@%Ld)", 1408 dprintk("NFS: commit (%s/%Ld %d@%Ld)",
1410 req->wb_context->dentry->d_inode->i_sb->s_id, 1409 req->wb_context->dentry->d_inode->i_sb->s_id,
@@ -1431,9 +1430,7 @@ static void nfs_commit_done(struct rpc_task *task, void *calldata)
1431 nfs_mark_request_dirty(req); 1430 nfs_mark_request_dirty(req);
1432 next: 1431 next:
1433 nfs_clear_page_writeback(req); 1432 nfs_clear_page_writeback(req);
1434 res++;
1435 } 1433 }
1436 sub_page_state(nr_unstable,res);
1437} 1434}
1438 1435
1439static const struct rpc_call_ops nfs_commit_ops = { 1436static const struct rpc_call_ops nfs_commit_ops = {
diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c
index 3eec30000f3f..01bc68c628ad 100644
--- a/fs/nfsd/export.c
+++ b/fs/nfsd/export.c
@@ -126,7 +126,7 @@ static int expkey_parse(struct cache_detail *cd, char *mesg, int mlen)
126 if (*ep) 126 if (*ep)
127 goto out; 127 goto out;
128 dprintk("found fsidtype %d\n", fsidtype); 128 dprintk("found fsidtype %d\n", fsidtype);
129 if (fsidtype > 2) 129 if (key_len(fsidtype)==0) /* invalid type */
130 goto out; 130 goto out;
131 if ((len=qword_get(&mesg, buf, PAGE_SIZE)) <= 0) 131 if ((len=qword_get(&mesg, buf, PAGE_SIZE)) <= 0)
132 goto out; 132 goto out;
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 7c7d01672d35..9daa0b9feb8d 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -1237,8 +1237,15 @@ find_file(struct inode *ino)
1237 return NULL; 1237 return NULL;
1238} 1238}
1239 1239
1240#define TEST_ACCESS(x) ((x > 0 || x < 4)?1:0) 1240static int access_valid(u32 x)
1241#define TEST_DENY(x) ((x >= 0 || x < 5)?1:0) 1241{
1242 return (x > 0 && x < 4);
1243}
1244
1245static int deny_valid(u32 x)
1246{
1247 return (x >= 0 && x < 5);
1248}
1242 1249
1243static void 1250static void
1244set_access(unsigned int *access, unsigned long bmap) { 1251set_access(unsigned int *access, unsigned long bmap) {
@@ -1745,7 +1752,8 @@ nfsd4_process_open2(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nf
1745 int status; 1752 int status;
1746 1753
1747 status = nfserr_inval; 1754 status = nfserr_inval;
1748 if (!TEST_ACCESS(open->op_share_access) || !TEST_DENY(open->op_share_deny)) 1755 if (!access_valid(open->op_share_access)
1756 || !deny_valid(open->op_share_deny))
1749 goto out; 1757 goto out;
1750 /* 1758 /*
1751 * Lookup file; if found, lookup stateid and check open request, 1759 * Lookup file; if found, lookup stateid and check open request,
@@ -1782,10 +1790,10 @@ nfsd4_process_open2(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nf
1782 } else { 1790 } else {
1783 /* Stateid was not found, this is a new OPEN */ 1791 /* Stateid was not found, this is a new OPEN */
1784 int flags = 0; 1792 int flags = 0;
1793 if (open->op_share_access & NFS4_SHARE_ACCESS_READ)
1794 flags |= MAY_READ;
1785 if (open->op_share_access & NFS4_SHARE_ACCESS_WRITE) 1795 if (open->op_share_access & NFS4_SHARE_ACCESS_WRITE)
1786 flags = MAY_WRITE; 1796 flags |= MAY_WRITE;
1787 else
1788 flags = MAY_READ;
1789 status = nfs4_new_open(rqstp, &stp, dp, current_fh, flags); 1797 status = nfs4_new_open(rqstp, &stp, dp, current_fh, flags);
1790 if (status) 1798 if (status)
1791 goto out; 1799 goto out;
@@ -2070,16 +2078,12 @@ nfs4_preprocess_stateid_op(struct svc_fh *current_fh, stateid_t *stateid, int fl
2070 if (!stateid->si_fileid) { /* delegation stateid */ 2078 if (!stateid->si_fileid) { /* delegation stateid */
2071 if(!(dp = find_delegation_stateid(ino, stateid))) { 2079 if(!(dp = find_delegation_stateid(ino, stateid))) {
2072 dprintk("NFSD: delegation stateid not found\n"); 2080 dprintk("NFSD: delegation stateid not found\n");
2073 if (nfs4_in_grace())
2074 status = nfserr_grace;
2075 goto out; 2081 goto out;
2076 } 2082 }
2077 stidp = &dp->dl_stateid; 2083 stidp = &dp->dl_stateid;
2078 } else { /* open or lock stateid */ 2084 } else { /* open or lock stateid */
2079 if (!(stp = find_stateid(stateid, flags))) { 2085 if (!(stp = find_stateid(stateid, flags))) {
2080 dprintk("NFSD: open or lock stateid not found\n"); 2086 dprintk("NFSD: open or lock stateid not found\n");
2081 if (nfs4_in_grace())
2082 status = nfserr_grace;
2083 goto out; 2087 goto out;
2084 } 2088 }
2085 if ((flags & CHECK_FH) && nfs4_check_fh(current_fh, stp)) 2089 if ((flags & CHECK_FH) && nfs4_check_fh(current_fh, stp))
@@ -2252,8 +2256,9 @@ nfsd4_open_confirm(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfs
2252 (int)current_fh->fh_dentry->d_name.len, 2256 (int)current_fh->fh_dentry->d_name.len,
2253 current_fh->fh_dentry->d_name.name); 2257 current_fh->fh_dentry->d_name.name);
2254 2258
2255 if ((status = fh_verify(rqstp, current_fh, S_IFREG, 0))) 2259 status = fh_verify(rqstp, current_fh, S_IFREG, 0);
2256 goto out; 2260 if (status)
2261 return status;
2257 2262
2258 nfs4_lock_state(); 2263 nfs4_lock_state();
2259 2264
@@ -2320,7 +2325,8 @@ nfsd4_open_downgrade(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct n
2320 (int)current_fh->fh_dentry->d_name.len, 2325 (int)current_fh->fh_dentry->d_name.len,
2321 current_fh->fh_dentry->d_name.name); 2326 current_fh->fh_dentry->d_name.name);
2322 2327
2323 if (!TEST_ACCESS(od->od_share_access) || !TEST_DENY(od->od_share_deny)) 2328 if (!access_valid(od->od_share_access)
2329 || !deny_valid(od->od_share_deny))
2324 return nfserr_inval; 2330 return nfserr_inval;
2325 2331
2326 nfs4_lock_state(); 2332 nfs4_lock_state();
diff --git a/fs/nfsd/nfsfh.c b/fs/nfsd/nfsfh.c
index 3f2ec2e6d06c..ecc439d2565f 100644
--- a/fs/nfsd/nfsfh.c
+++ b/fs/nfsd/nfsfh.c
@@ -187,13 +187,6 @@ fh_verify(struct svc_rqst *rqstp, struct svc_fh *fhp, int type, int access)
187 goto out; 187 goto out;
188 } 188 }
189 189
190 /* Set user creds for this exportpoint */
191 error = nfsd_setuser(rqstp, exp);
192 if (error) {
193 error = nfserrno(error);
194 goto out;
195 }
196
197 /* 190 /*
198 * Look up the dentry using the NFS file handle. 191 * Look up the dentry using the NFS file handle.
199 */ 192 */
@@ -251,6 +244,14 @@ fh_verify(struct svc_rqst *rqstp, struct svc_fh *fhp, int type, int access)
251 } 244 }
252 cache_get(&exp->h); 245 cache_get(&exp->h);
253 246
247 /* Set user creds for this exportpoint; necessary even in the "just
248 * checking" case because this may be a filehandle that was created by
249 * fh_compose, and that is about to be used in another nfsv4 compound
250 * operation */
251 error = nfserrno(nfsd_setuser(rqstp, exp));
252 if (error)
253 goto out;
254
254 error = nfsd_mode_check(rqstp, dentry->d_inode->i_mode, type); 255 error = nfsd_mode_check(rqstp, dentry->d_inode->i_mode, type);
255 if (error) 256 if (error)
256 goto out; 257 goto out;
@@ -312,8 +313,8 @@ int
312fh_compose(struct svc_fh *fhp, struct svc_export *exp, struct dentry *dentry, struct svc_fh *ref_fh) 313fh_compose(struct svc_fh *fhp, struct svc_export *exp, struct dentry *dentry, struct svc_fh *ref_fh)
313{ 314{
314 /* ref_fh is a reference file handle. 315 /* ref_fh is a reference file handle.
315 * if it is non-null, then we should compose a filehandle which is 316 * if it is non-null and for the same filesystem, then we should compose
316 * of the same version, where possible. 317 * a filehandle which is of the same version, where possible.
317 * Currently, that means that if ref_fh->fh_handle.fh_version == 0xca 318 * Currently, that means that if ref_fh->fh_handle.fh_version == 0xca
318 * Then create a 32byte filehandle using nfs_fhbase_old 319 * Then create a 32byte filehandle using nfs_fhbase_old
319 * 320 *
@@ -332,7 +333,7 @@ fh_compose(struct svc_fh *fhp, struct svc_export *exp, struct dentry *dentry, st
332 parent->d_name.name, dentry->d_name.name, 333 parent->d_name.name, dentry->d_name.name,
333 (inode ? inode->i_ino : 0)); 334 (inode ? inode->i_ino : 0));
334 335
335 if (ref_fh) { 336 if (ref_fh && ref_fh->fh_export == exp) {
336 ref_fh_version = ref_fh->fh_handle.fh_version; 337 ref_fh_version = ref_fh->fh_handle.fh_version;
337 if (ref_fh_version == 0xca) 338 if (ref_fh_version == 0xca)
338 ref_fh_fsid_type = 0; 339 ref_fh_fsid_type = 0;
@@ -461,7 +462,7 @@ fh_update(struct svc_fh *fhp)
461 } else { 462 } else {
462 int size; 463 int size;
463 if (fhp->fh_handle.fh_fileid_type != 0) 464 if (fhp->fh_handle.fh_fileid_type != 0)
464 goto out_uptodate; 465 goto out;
465 datap = fhp->fh_handle.fh_auth+ 466 datap = fhp->fh_handle.fh_auth+
466 fhp->fh_handle.fh_size/4 -1; 467 fhp->fh_handle.fh_size/4 -1;
467 size = (fhp->fh_maxsize - fhp->fh_handle.fh_size)/4; 468 size = (fhp->fh_maxsize - fhp->fh_handle.fh_size)/4;
@@ -481,10 +482,6 @@ out_negative:
481 printk(KERN_ERR "fh_update: %s/%s still negative!\n", 482 printk(KERN_ERR "fh_update: %s/%s still negative!\n",
482 dentry->d_parent->d_name.name, dentry->d_name.name); 483 dentry->d_parent->d_name.name, dentry->d_name.name);
483 goto out; 484 goto out;
484out_uptodate:
485 printk(KERN_ERR "fh_update: %s/%s already up-to-date!\n",
486 dentry->d_parent->d_name.name, dentry->d_name.name);
487 goto out;
488} 485}
489 486
490/* 487/*
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index da3ec74d8a43..c9e3b5a8fe07 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -672,7 +672,10 @@ nfsd_open(struct svc_rqst *rqstp, struct svc_fh *fhp, int type,
672 goto out_nfserr; 672 goto out_nfserr;
673 673
674 if (access & MAY_WRITE) { 674 if (access & MAY_WRITE) {
675 flags = O_WRONLY|O_LARGEFILE; 675 if (access & MAY_READ)
676 flags = O_RDWR|O_LARGEFILE;
677 else
678 flags = O_WRONLY|O_LARGEFILE;
676 679
677 DQUOT_INIT(inode); 680 DQUOT_INIT(inode);
678 } 681 }
@@ -833,7 +836,7 @@ nfsd_vfs_read(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file,
833 if (ra && ra->p_set) 836 if (ra && ra->p_set)
834 file->f_ra = ra->p_ra; 837 file->f_ra = ra->p_ra;
835 838
836 if (file->f_op->sendfile) { 839 if (file->f_op->sendfile && rqstp->rq_sendfile_ok) {
837 svc_pushback_unused_pages(rqstp); 840 svc_pushback_unused_pages(rqstp);
838 err = file->f_op->sendfile(file, &offset, *count, 841 err = file->f_op->sendfile(file, &offset, *count,
839 nfsd_read_actor, rqstp); 842 nfsd_read_actor, rqstp);
@@ -1516,14 +1519,15 @@ nfsd_link(struct svc_rqst *rqstp, struct svc_fh *ffhp,
1516 err = nfserrno(err); 1519 err = nfserrno(err);
1517 } 1520 }
1518 1521
1519 fh_unlock(ffhp);
1520 dput(dnew); 1522 dput(dnew);
1523out_unlock:
1524 fh_unlock(ffhp);
1521out: 1525out:
1522 return err; 1526 return err;
1523 1527
1524out_nfserr: 1528out_nfserr:
1525 err = nfserrno(err); 1529 err = nfserrno(err);
1526 goto out; 1530 goto out_unlock;
1527} 1531}
1528 1532
1529/* 1533/*
@@ -1552,7 +1556,7 @@ nfsd_rename(struct svc_rqst *rqstp, struct svc_fh *ffhp, char *fname, int flen,
1552 tdir = tdentry->d_inode; 1556 tdir = tdentry->d_inode;
1553 1557
1554 err = (rqstp->rq_vers == 2) ? nfserr_acces : nfserr_xdev; 1558 err = (rqstp->rq_vers == 2) ? nfserr_acces : nfserr_xdev;
1555 if (fdir->i_sb != tdir->i_sb) 1559 if (ffhp->fh_export != tfhp->fh_export)
1556 goto out; 1560 goto out;
1557 1561
1558 err = nfserr_perm; 1562 err = nfserr_perm;
diff --git a/fs/proc/proc_misc.c b/fs/proc/proc_misc.c
index b8d48852649a..9f2cfc30f9cf 100644
--- a/fs/proc/proc_misc.c
+++ b/fs/proc/proc_misc.c
@@ -119,7 +119,6 @@ static int meminfo_read_proc(char *page, char **start, off_t off,
119{ 119{
120 struct sysinfo i; 120 struct sysinfo i;
121 int len; 121 int len;
122 struct page_state ps;
123 unsigned long inactive; 122 unsigned long inactive;
124 unsigned long active; 123 unsigned long active;
125 unsigned long free; 124 unsigned long free;
@@ -128,7 +127,6 @@ static int meminfo_read_proc(char *page, char **start, off_t off,
128 struct vmalloc_info vmi; 127 struct vmalloc_info vmi;
129 long cached; 128 long cached;
130 129
131 get_page_state(&ps);
132 get_zone_counts(&active, &inactive, &free); 130 get_zone_counts(&active, &inactive, &free);
133 131
134/* 132/*
@@ -141,7 +139,8 @@ static int meminfo_read_proc(char *page, char **start, off_t off,
141 allowed = ((totalram_pages - hugetlb_total_pages()) 139 allowed = ((totalram_pages - hugetlb_total_pages())
142 * sysctl_overcommit_ratio / 100) + total_swap_pages; 140 * sysctl_overcommit_ratio / 100) + total_swap_pages;
143 141
144 cached = get_page_cache_size() - total_swapcache_pages - i.bufferram; 142 cached = global_page_state(NR_FILE_PAGES) -
143 total_swapcache_pages - i.bufferram;
145 if (cached < 0) 144 if (cached < 0)
146 cached = 0; 145 cached = 0;
147 146
@@ -166,11 +165,14 @@ static int meminfo_read_proc(char *page, char **start, off_t off,
166 "SwapFree: %8lu kB\n" 165 "SwapFree: %8lu kB\n"
167 "Dirty: %8lu kB\n" 166 "Dirty: %8lu kB\n"
168 "Writeback: %8lu kB\n" 167 "Writeback: %8lu kB\n"
168 "AnonPages: %8lu kB\n"
169 "Mapped: %8lu kB\n" 169 "Mapped: %8lu kB\n"
170 "Slab: %8lu kB\n" 170 "Slab: %8lu kB\n"
171 "PageTables: %8lu kB\n"
172 "NFS Unstable: %8lu kB\n"
173 "Bounce: %8lu kB\n"
171 "CommitLimit: %8lu kB\n" 174 "CommitLimit: %8lu kB\n"
172 "Committed_AS: %8lu kB\n" 175 "Committed_AS: %8lu kB\n"
173 "PageTables: %8lu kB\n"
174 "VmallocTotal: %8lu kB\n" 176 "VmallocTotal: %8lu kB\n"
175 "VmallocUsed: %8lu kB\n" 177 "VmallocUsed: %8lu kB\n"
176 "VmallocChunk: %8lu kB\n", 178 "VmallocChunk: %8lu kB\n",
@@ -187,13 +189,16 @@ static int meminfo_read_proc(char *page, char **start, off_t off,
187 K(i.freeram-i.freehigh), 189 K(i.freeram-i.freehigh),
188 K(i.totalswap), 190 K(i.totalswap),
189 K(i.freeswap), 191 K(i.freeswap),
190 K(ps.nr_dirty), 192 K(global_page_state(NR_FILE_DIRTY)),
191 K(ps.nr_writeback), 193 K(global_page_state(NR_WRITEBACK)),
192 K(ps.nr_mapped), 194 K(global_page_state(NR_ANON_PAGES)),
193 K(ps.nr_slab), 195 K(global_page_state(NR_FILE_MAPPED)),
196 K(global_page_state(NR_SLAB)),
197 K(global_page_state(NR_PAGETABLE)),
198 K(global_page_state(NR_UNSTABLE_NFS)),
199 K(global_page_state(NR_BOUNCE)),
194 K(allowed), 200 K(allowed),
195 K(committed), 201 K(committed),
196 K(ps.nr_page_table_pages),
197 (unsigned long)VMALLOC_TOTAL >> 10, 202 (unsigned long)VMALLOC_TOTAL >> 10,
198 vmi.used >> 10, 203 vmi.used >> 10,
199 vmi.largest_chunk >> 10 204 vmi.largest_chunk >> 10