aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-10-26 20:15:20 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-10-26 20:15:20 -0400
commit31453a9764f7e2a72a6e2c502ace586e2663a68c (patch)
tree5d4db63de5b4b85d1ffdab4e95a75175a784a10a /fs
parentf9ba5375a8aae4aeea6be15df77e24707a429812 (diff)
parent93ed0e2d07b25aff4db1d61bfbcd1e82074c0ad5 (diff)
Merge branch 'akpm-incoming-1'
* akpm-incoming-1: (176 commits) scripts/checkpatch.pl: add check for declaration of pci_device_id scripts/checkpatch.pl: add warnings for static char that could be static const char checkpatch: version 0.31 checkpatch: statement/block context analyser should look at sanitised lines checkpatch: handle EXPORT_SYMBOL for DEVICE_ATTR and similar checkpatch: clean up structure definition macro handline checkpatch: update copyright dates checkpatch: Add additional attribute #defines checkpatch: check for incorrect permissions checkpatch: ensure kconfig help checks only apply when we are adding help checkpatch: simplify and consolidate "missing space after" checks checkpatch: add check for space after struct, union, and enum checkpatch: returning errno typically should be negative checkpatch: handle casts better fixing false categorisation of : as binary checkpatch: ensure we do not collapse bracketed sections into constants checkpatch: suggest cleanpatch and cleanfile when appropriate checkpatch: types may sit on a line on their own checkpatch: fix regressions in "fix handling of leading spaces" div64_u64(): improve precision on 32bit platforms lib/parser: cleanup match_number() ...
Diffstat (limited to 'fs')
-rw-r--r--fs/Kconfig6
-rw-r--r--fs/afs/write.c19
-rw-r--r--fs/buffer.c3
-rw-r--r--fs/ceph/addr.c9
-rw-r--r--fs/cifs/file.c10
-rw-r--r--fs/direct-io.c2
-rw-r--r--fs/exec.c5
-rw-r--r--fs/file_table.c17
-rw-r--r--fs/fs-writeback.c8
-rw-r--r--fs/fuse/dev.c12
-rw-r--r--fs/gfs2/meta_io.c2
-rw-r--r--fs/hostfs/hostfs.h3
-rw-r--r--fs/hostfs/hostfs_kern.c2
-rw-r--r--fs/hostfs/hostfs_user.c14
-rw-r--r--fs/locks.c19
-rw-r--r--fs/nfs/write.c4
-rw-r--r--fs/nilfs2/segment.c2
-rw-r--r--fs/proc/Kconfig4
-rw-r--r--fs/proc/base.c99
-rw-r--r--fs/reiserfs/inode.c2
-rw-r--r--fs/xfs/linux-2.6/xfs_aops.c3
21 files changed, 125 insertions, 120 deletions
diff --git a/fs/Kconfig b/fs/Kconfig
index 65781de44fc0..b5e582bd769d 100644
--- a/fs/Kconfig
+++ b/fs/Kconfig
@@ -47,6 +47,9 @@ source "fs/nilfs2/Kconfig"
47 47
48endif # BLOCK 48endif # BLOCK
49 49
50config EXPORTFS
51 tristate
52
50config FILE_LOCKING 53config FILE_LOCKING
51 bool "Enable POSIX file locking API" if EMBEDDED 54 bool "Enable POSIX file locking API" if EMBEDDED
52 default y 55 default y
@@ -222,9 +225,6 @@ config LOCKD_V4
222 depends on FILE_LOCKING 225 depends on FILE_LOCKING
223 default y 226 default y
224 227
225config EXPORTFS
226 tristate
227
228config NFS_ACL_SUPPORT 228config NFS_ACL_SUPPORT
229 tristate 229 tristate
230 select FS_POSIX_ACL 230 select FS_POSIX_ACL
diff --git a/fs/afs/write.c b/fs/afs/write.c
index 722743b152d8..15690bb1d3b5 100644
--- a/fs/afs/write.c
+++ b/fs/afs/write.c
@@ -438,7 +438,6 @@ no_more:
438 */ 438 */
439int afs_writepage(struct page *page, struct writeback_control *wbc) 439int afs_writepage(struct page *page, struct writeback_control *wbc)
440{ 440{
441 struct backing_dev_info *bdi = page->mapping->backing_dev_info;
442 struct afs_writeback *wb; 441 struct afs_writeback *wb;
443 int ret; 442 int ret;
444 443
@@ -455,8 +454,6 @@ int afs_writepage(struct page *page, struct writeback_control *wbc)
455 } 454 }
456 455
457 wbc->nr_to_write -= ret; 456 wbc->nr_to_write -= ret;
458 if (wbc->nonblocking && bdi_write_congested(bdi))
459 wbc->encountered_congestion = 1;
460 457
461 _leave(" = 0"); 458 _leave(" = 0");
462 return 0; 459 return 0;
@@ -469,7 +466,6 @@ static int afs_writepages_region(struct address_space *mapping,
469 struct writeback_control *wbc, 466 struct writeback_control *wbc,
470 pgoff_t index, pgoff_t end, pgoff_t *_next) 467 pgoff_t index, pgoff_t end, pgoff_t *_next)
471{ 468{
472 struct backing_dev_info *bdi = mapping->backing_dev_info;
473 struct afs_writeback *wb; 469 struct afs_writeback *wb;
474 struct page *page; 470 struct page *page;
475 int ret, n; 471 int ret, n;
@@ -529,11 +525,6 @@ static int afs_writepages_region(struct address_space *mapping,
529 525
530 wbc->nr_to_write -= ret; 526 wbc->nr_to_write -= ret;
531 527
532 if (wbc->nonblocking && bdi_write_congested(bdi)) {
533 wbc->encountered_congestion = 1;
534 break;
535 }
536
537 cond_resched(); 528 cond_resched();
538 } while (index < end && wbc->nr_to_write > 0); 529 } while (index < end && wbc->nr_to_write > 0);
539 530
@@ -548,24 +539,16 @@ static int afs_writepages_region(struct address_space *mapping,
548int afs_writepages(struct address_space *mapping, 539int afs_writepages(struct address_space *mapping,
549 struct writeback_control *wbc) 540 struct writeback_control *wbc)
550{ 541{
551 struct backing_dev_info *bdi = mapping->backing_dev_info;
552 pgoff_t start, end, next; 542 pgoff_t start, end, next;
553 int ret; 543 int ret;
554 544
555 _enter(""); 545 _enter("");
556 546
557 if (wbc->nonblocking && bdi_write_congested(bdi)) {
558 wbc->encountered_congestion = 1;
559 _leave(" = 0 [congest]");
560 return 0;
561 }
562
563 if (wbc->range_cyclic) { 547 if (wbc->range_cyclic) {
564 start = mapping->writeback_index; 548 start = mapping->writeback_index;
565 end = -1; 549 end = -1;
566 ret = afs_writepages_region(mapping, wbc, start, end, &next); 550 ret = afs_writepages_region(mapping, wbc, start, end, &next);
567 if (start > 0 && wbc->nr_to_write > 0 && ret == 0 && 551 if (start > 0 && wbc->nr_to_write > 0 && ret == 0)
568 !(wbc->nonblocking && wbc->encountered_congestion))
569 ret = afs_writepages_region(mapping, wbc, 0, start, 552 ret = afs_writepages_region(mapping, wbc, 0, start,
570 &next); 553 &next);
571 mapping->writeback_index = next; 554 mapping->writeback_index = next;
diff --git a/fs/buffer.c b/fs/buffer.c
index 7f0b9b083f77..8d595ab2aed1 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -905,7 +905,6 @@ try_again:
905 905
906 bh->b_state = 0; 906 bh->b_state = 0;
907 atomic_set(&bh->b_count, 0); 907 atomic_set(&bh->b_count, 0);
908 bh->b_private = NULL;
909 bh->b_size = size; 908 bh->b_size = size;
910 909
911 /* Link the buffer to its page */ 910 /* Link the buffer to its page */
@@ -1706,7 +1705,7 @@ static int __block_write_full_page(struct inode *inode, struct page *page,
1706 * and kswapd activity, but those code paths have their own 1705 * and kswapd activity, but those code paths have their own
1707 * higher-level throttling. 1706 * higher-level throttling.
1708 */ 1707 */
1709 if (wbc->sync_mode != WB_SYNC_NONE || !wbc->nonblocking) { 1708 if (wbc->sync_mode != WB_SYNC_NONE) {
1710 lock_buffer(bh); 1709 lock_buffer(bh);
1711 } else if (!trylock_buffer(bh)) { 1710 } else if (!trylock_buffer(bh)) {
1712 redirty_page_for_writepage(wbc, page); 1711 redirty_page_for_writepage(wbc, page);
diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c
index 51bcc5ce3230..e9c874abc9e1 100644
--- a/fs/ceph/addr.c
+++ b/fs/ceph/addr.c
@@ -591,7 +591,6 @@ static int ceph_writepages_start(struct address_space *mapping,
591 struct writeback_control *wbc) 591 struct writeback_control *wbc)
592{ 592{
593 struct inode *inode = mapping->host; 593 struct inode *inode = mapping->host;
594 struct backing_dev_info *bdi = mapping->backing_dev_info;
595 struct ceph_inode_info *ci = ceph_inode(inode); 594 struct ceph_inode_info *ci = ceph_inode(inode);
596 struct ceph_fs_client *fsc; 595 struct ceph_fs_client *fsc;
597 pgoff_t index, start, end; 596 pgoff_t index, start, end;
@@ -633,13 +632,6 @@ static int ceph_writepages_start(struct address_space *mapping,
633 632
634 pagevec_init(&pvec, 0); 633 pagevec_init(&pvec, 0);
635 634
636 /* ?? */
637 if (wbc->nonblocking && bdi_write_congested(bdi)) {
638 dout(" writepages congested\n");
639 wbc->encountered_congestion = 1;
640 goto out_final;
641 }
642
643 /* where to start/end? */ 635 /* where to start/end? */
644 if (wbc->range_cyclic) { 636 if (wbc->range_cyclic) {
645 start = mapping->writeback_index; /* Start from prev offset */ 637 start = mapping->writeback_index; /* Start from prev offset */
@@ -885,7 +877,6 @@ out:
885 rc = 0; /* vfs expects us to return 0 */ 877 rc = 0; /* vfs expects us to return 0 */
886 ceph_put_snap_context(snapc); 878 ceph_put_snap_context(snapc);
887 dout("writepages done, rc = %d\n", rc); 879 dout("writepages done, rc = %d\n", rc);
888out_final:
889 return rc; 880 return rc;
890} 881}
891 882
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index 8c81e7b14d53..45af003865d2 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -1303,7 +1303,6 @@ static int cifs_partialpagewrite(struct page *page, unsigned from, unsigned to)
1303static int cifs_writepages(struct address_space *mapping, 1303static int cifs_writepages(struct address_space *mapping,
1304 struct writeback_control *wbc) 1304 struct writeback_control *wbc)
1305{ 1305{
1306 struct backing_dev_info *bdi = mapping->backing_dev_info;
1307 unsigned int bytes_to_write; 1306 unsigned int bytes_to_write;
1308 unsigned int bytes_written; 1307 unsigned int bytes_written;
1309 struct cifs_sb_info *cifs_sb; 1308 struct cifs_sb_info *cifs_sb;
@@ -1326,15 +1325,6 @@ static int cifs_writepages(struct address_space *mapping,
1326 int scanned = 0; 1325 int scanned = 0;
1327 int xid, long_op; 1326 int xid, long_op;
1328 1327
1329 /*
1330 * BB: Is this meaningful for a non-block-device file system?
1331 * If it is, we should test it again after we do I/O
1332 */
1333 if (wbc->nonblocking && bdi_write_congested(bdi)) {
1334 wbc->encountered_congestion = 1;
1335 return 0;
1336 }
1337
1338 cifs_sb = CIFS_SB(mapping->host->i_sb); 1328 cifs_sb = CIFS_SB(mapping->host->i_sb);
1339 1329
1340 /* 1330 /*
diff --git a/fs/direct-io.c b/fs/direct-io.c
index 48d74c7391d1..85882f6ba5f7 100644
--- a/fs/direct-io.c
+++ b/fs/direct-io.c
@@ -218,7 +218,7 @@ static struct page *dio_get_page(struct dio *dio)
218 * filesystems can use it to hold additional state between get_block calls and 218 * filesystems can use it to hold additional state between get_block calls and
219 * dio_complete. 219 * dio_complete.
220 */ 220 */
221static int dio_complete(struct dio *dio, loff_t offset, int ret, bool is_async) 221static ssize_t dio_complete(struct dio *dio, loff_t offset, ssize_t ret, bool is_async)
222{ 222{
223 ssize_t transferred = 0; 223 ssize_t transferred = 0;
224 224
diff --git a/fs/exec.c b/fs/exec.c
index 6d2b6f936858..3aa75b8888a1 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -54,6 +54,7 @@
54#include <linux/fsnotify.h> 54#include <linux/fsnotify.h>
55#include <linux/fs_struct.h> 55#include <linux/fs_struct.h>
56#include <linux/pipe_fs_i.h> 56#include <linux/pipe_fs_i.h>
57#include <linux/oom.h>
57 58
58#include <asm/uaccess.h> 59#include <asm/uaccess.h>
59#include <asm/mmu_context.h> 60#include <asm/mmu_context.h>
@@ -759,6 +760,10 @@ static int exec_mmap(struct mm_struct *mm)
759 tsk->mm = mm; 760 tsk->mm = mm;
760 tsk->active_mm = mm; 761 tsk->active_mm = mm;
761 activate_mm(active_mm, mm); 762 activate_mm(active_mm, mm);
763 if (old_mm && tsk->signal->oom_score_adj == OOM_SCORE_ADJ_MIN) {
764 atomic_dec(&old_mm->oom_disable_count);
765 atomic_inc(&tsk->mm->oom_disable_count);
766 }
762 task_unlock(tsk); 767 task_unlock(tsk);
763 arch_pick_mmap_layout(mm); 768 arch_pick_mmap_layout(mm);
764 if (old_mm) { 769 if (old_mm) {
diff --git a/fs/file_table.c b/fs/file_table.c
index a04bdd81c11c..c3dee381f1b4 100644
--- a/fs/file_table.c
+++ b/fs/file_table.c
@@ -60,7 +60,7 @@ static inline void file_free(struct file *f)
60/* 60/*
61 * Return the total number of open files in the system 61 * Return the total number of open files in the system
62 */ 62 */
63static int get_nr_files(void) 63static long get_nr_files(void)
64{ 64{
65 return percpu_counter_read_positive(&nr_files); 65 return percpu_counter_read_positive(&nr_files);
66} 66}
@@ -68,7 +68,7 @@ static int get_nr_files(void)
68/* 68/*
69 * Return the maximum number of open files in the system 69 * Return the maximum number of open files in the system
70 */ 70 */
71int get_max_files(void) 71unsigned long get_max_files(void)
72{ 72{
73 return files_stat.max_files; 73 return files_stat.max_files;
74} 74}
@@ -82,7 +82,7 @@ int proc_nr_files(ctl_table *table, int write,
82 void __user *buffer, size_t *lenp, loff_t *ppos) 82 void __user *buffer, size_t *lenp, loff_t *ppos)
83{ 83{
84 files_stat.nr_files = get_nr_files(); 84 files_stat.nr_files = get_nr_files();
85 return proc_dointvec(table, write, buffer, lenp, ppos); 85 return proc_doulongvec_minmax(table, write, buffer, lenp, ppos);
86} 86}
87#else 87#else
88int proc_nr_files(ctl_table *table, int write, 88int proc_nr_files(ctl_table *table, int write,
@@ -105,7 +105,7 @@ int proc_nr_files(ctl_table *table, int write,
105struct file *get_empty_filp(void) 105struct file *get_empty_filp(void)
106{ 106{
107 const struct cred *cred = current_cred(); 107 const struct cred *cred = current_cred();
108 static int old_max; 108 static long old_max;
109 struct file * f; 109 struct file * f;
110 110
111 /* 111 /*
@@ -140,8 +140,7 @@ struct file *get_empty_filp(void)
140over: 140over:
141 /* Ran out of filps - report that */ 141 /* Ran out of filps - report that */
142 if (get_nr_files() > old_max) { 142 if (get_nr_files() > old_max) {
143 printk(KERN_INFO "VFS: file-max limit %d reached\n", 143 pr_info("VFS: file-max limit %lu reached\n", get_max_files());
144 get_max_files());
145 old_max = get_nr_files(); 144 old_max = get_nr_files();
146 } 145 }
147 goto fail; 146 goto fail;
@@ -487,7 +486,7 @@ retry:
487 486
488void __init files_init(unsigned long mempages) 487void __init files_init(unsigned long mempages)
489{ 488{
490 int n; 489 unsigned long n;
491 490
492 filp_cachep = kmem_cache_create("filp", sizeof(struct file), 0, 491 filp_cachep = kmem_cache_create("filp", sizeof(struct file), 0,
493 SLAB_HWCACHE_ALIGN | SLAB_PANIC, NULL); 492 SLAB_HWCACHE_ALIGN | SLAB_PANIC, NULL);
@@ -498,9 +497,7 @@ void __init files_init(unsigned long mempages)
498 */ 497 */
499 498
500 n = (mempages * (PAGE_SIZE / 1024)) / 10; 499 n = (mempages * (PAGE_SIZE / 1024)) / 10;
501 files_stat.max_files = n; 500 files_stat.max_files = max_t(unsigned long, n, NR_FILE);
502 if (files_stat.max_files < NR_FILE)
503 files_stat.max_files = NR_FILE;
504 files_defer_init(); 501 files_defer_init();
505 lg_lock_init(files_lglock); 502 lg_lock_init(files_lglock);
506 percpu_counter_init(&nr_files, 0); 503 percpu_counter_init(&nr_files, 0);
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
index ab38fef1c9a1..9e46aec10d1a 100644
--- a/fs/fs-writeback.c
+++ b/fs/fs-writeback.c
@@ -582,7 +582,7 @@ static inline bool over_bground_thresh(void)
582 global_dirty_limits(&background_thresh, &dirty_thresh); 582 global_dirty_limits(&background_thresh, &dirty_thresh);
583 583
584 return (global_page_state(NR_FILE_DIRTY) + 584 return (global_page_state(NR_FILE_DIRTY) +
585 global_page_state(NR_UNSTABLE_NFS) >= background_thresh); 585 global_page_state(NR_UNSTABLE_NFS) > background_thresh);
586} 586}
587 587
588/* 588/*
@@ -721,6 +721,10 @@ static long wb_check_old_data_flush(struct bdi_writeback *wb)
721 return 0; 721 return 0;
722 722
723 wb->last_old_flush = jiffies; 723 wb->last_old_flush = jiffies;
724 /*
725 * Add in the number of potentially dirty inodes, because each inode
726 * write can dirty pagecache in the underlying blockdev.
727 */
724 nr_pages = global_page_state(NR_FILE_DIRTY) + 728 nr_pages = global_page_state(NR_FILE_DIRTY) +
725 global_page_state(NR_UNSTABLE_NFS) + 729 global_page_state(NR_UNSTABLE_NFS) +
726 (inodes_stat.nr_inodes - inodes_stat.nr_unused); 730 (inodes_stat.nr_inodes - inodes_stat.nr_unused);
@@ -790,7 +794,7 @@ int bdi_writeback_thread(void *data)
790 struct backing_dev_info *bdi = wb->bdi; 794 struct backing_dev_info *bdi = wb->bdi;
791 long pages_written; 795 long pages_written;
792 796
793 current->flags |= PF_FLUSHER | PF_SWAPWRITE; 797 current->flags |= PF_SWAPWRITE;
794 set_freezable(); 798 set_freezable();
795 wb->last_active = jiffies; 799 wb->last_active = jiffies;
796 800
diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
index cde755cca564..b98664275f02 100644
--- a/fs/fuse/dev.c
+++ b/fs/fuse/dev.c
@@ -809,11 +809,9 @@ static int fuse_copy_page(struct fuse_copy_state *cs, struct page **pagep,
809 int err; 809 int err;
810 struct page *page = *pagep; 810 struct page *page = *pagep;
811 811
812 if (page && zeroing && count < PAGE_SIZE) { 812 if (page && zeroing && count < PAGE_SIZE)
813 void *mapaddr = kmap_atomic(page, KM_USER1); 813 clear_highpage(page);
814 memset(mapaddr, 0, PAGE_SIZE); 814
815 kunmap_atomic(mapaddr, KM_USER1);
816 }
817 while (count) { 815 while (count) {
818 if (cs->write && cs->pipebufs && page) { 816 if (cs->write && cs->pipebufs && page) {
819 return fuse_ref_page(cs, page, offset, count); 817 return fuse_ref_page(cs, page, offset, count);
@@ -830,10 +828,10 @@ static int fuse_copy_page(struct fuse_copy_state *cs, struct page **pagep,
830 } 828 }
831 } 829 }
832 if (page) { 830 if (page) {
833 void *mapaddr = kmap_atomic(page, KM_USER1); 831 void *mapaddr = kmap_atomic(page, KM_USER0);
834 void *buf = mapaddr + offset; 832 void *buf = mapaddr + offset;
835 offset += fuse_copy_do(cs, &buf, &count); 833 offset += fuse_copy_do(cs, &buf, &count);
836 kunmap_atomic(mapaddr, KM_USER1); 834 kunmap_atomic(mapaddr, KM_USER0);
837 } else 835 } else
838 offset += fuse_copy_do(cs, NULL, &count); 836 offset += fuse_copy_do(cs, NULL, &count);
839 } 837 }
diff --git a/fs/gfs2/meta_io.c b/fs/gfs2/meta_io.c
index f3b071f921aa..939739c7b3f9 100644
--- a/fs/gfs2/meta_io.c
+++ b/fs/gfs2/meta_io.c
@@ -55,7 +55,7 @@ static int gfs2_aspace_writepage(struct page *page, struct writeback_control *wb
55 * activity, but those code paths have their own higher-level 55 * activity, but those code paths have their own higher-level
56 * throttling. 56 * throttling.
57 */ 57 */
58 if (wbc->sync_mode != WB_SYNC_NONE || !wbc->nonblocking) { 58 if (wbc->sync_mode != WB_SYNC_NONE) {
59 lock_buffer(bh); 59 lock_buffer(bh);
60 } else if (!trylock_buffer(bh)) { 60 } else if (!trylock_buffer(bh)) {
61 redirty_page_for_writepage(wbc, page); 61 redirty_page_for_writepage(wbc, page);
diff --git a/fs/hostfs/hostfs.h b/fs/hostfs/hostfs.h
index 7c232c1487ee..bf15a43016b9 100644
--- a/fs/hostfs/hostfs.h
+++ b/fs/hostfs/hostfs.h
@@ -91,7 +91,6 @@ extern int rename_file(char *from, char *to);
91extern int do_statfs(char *root, long *bsize_out, long long *blocks_out, 91extern int do_statfs(char *root, long *bsize_out, long long *blocks_out,
92 long long *bfree_out, long long *bavail_out, 92 long long *bfree_out, long long *bavail_out,
93 long long *files_out, long long *ffree_out, 93 long long *files_out, long long *ffree_out,
94 void *fsid_out, int fsid_size, long *namelen_out, 94 void *fsid_out, int fsid_size, long *namelen_out);
95 long *spare_out);
96 95
97#endif 96#endif
diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c
index f7dc9b5f9ef8..cd7c93917cc7 100644
--- a/fs/hostfs/hostfs_kern.c
+++ b/fs/hostfs/hostfs_kern.c
@@ -217,7 +217,7 @@ int hostfs_statfs(struct dentry *dentry, struct kstatfs *sf)
217 err = do_statfs(dentry->d_sb->s_fs_info, 217 err = do_statfs(dentry->d_sb->s_fs_info,
218 &sf->f_bsize, &f_blocks, &f_bfree, &f_bavail, &f_files, 218 &sf->f_bsize, &f_blocks, &f_bfree, &f_bavail, &f_files,
219 &f_ffree, &sf->f_fsid, sizeof(sf->f_fsid), 219 &f_ffree, &sf->f_fsid, sizeof(sf->f_fsid),
220 &sf->f_namelen, sf->f_spare); 220 &sf->f_namelen);
221 if (err) 221 if (err)
222 return err; 222 return err;
223 sf->f_blocks = f_blocks; 223 sf->f_blocks = f_blocks;
diff --git a/fs/hostfs/hostfs_user.c b/fs/hostfs/hostfs_user.c
index 6777aa06ce2c..d51a98384bc0 100644
--- a/fs/hostfs/hostfs_user.c
+++ b/fs/hostfs/hostfs_user.c
@@ -94,8 +94,7 @@ void *open_dir(char *path, int *err_out)
94 94
95 dir = opendir(path); 95 dir = opendir(path);
96 *err_out = errno; 96 *err_out = errno;
97 if (dir == NULL) 97
98 return NULL;
99 return dir; 98 return dir;
100} 99}
101 100
@@ -205,7 +204,7 @@ int set_attr(const char *file, struct hostfs_iattr *attrs, int fd)
205 if (attrs->ia_valid & HOSTFS_ATTR_MODE) { 204 if (attrs->ia_valid & HOSTFS_ATTR_MODE) {
206 if (fd >= 0) { 205 if (fd >= 0) {
207 if (fchmod(fd, attrs->ia_mode) != 0) 206 if (fchmod(fd, attrs->ia_mode) != 0)
208 return (-errno); 207 return -errno;
209 } else if (chmod(file, attrs->ia_mode) != 0) { 208 } else if (chmod(file, attrs->ia_mode) != 0) {
210 return -errno; 209 return -errno;
211 } 210 }
@@ -364,8 +363,7 @@ int rename_file(char *from, char *to)
364int do_statfs(char *root, long *bsize_out, long long *blocks_out, 363int do_statfs(char *root, long *bsize_out, long long *blocks_out,
365 long long *bfree_out, long long *bavail_out, 364 long long *bfree_out, long long *bavail_out,
366 long long *files_out, long long *ffree_out, 365 long long *files_out, long long *ffree_out,
367 void *fsid_out, int fsid_size, long *namelen_out, 366 void *fsid_out, int fsid_size, long *namelen_out)
368 long *spare_out)
369{ 367{
370 struct statfs64 buf; 368 struct statfs64 buf;
371 int err; 369 int err;
@@ -384,10 +382,6 @@ int do_statfs(char *root, long *bsize_out, long long *blocks_out,
384 sizeof(buf.f_fsid) > fsid_size ? fsid_size : 382 sizeof(buf.f_fsid) > fsid_size ? fsid_size :
385 sizeof(buf.f_fsid)); 383 sizeof(buf.f_fsid));
386 *namelen_out = buf.f_namelen; 384 *namelen_out = buf.f_namelen;
387 spare_out[0] = buf.f_spare[0]; 385
388 spare_out[1] = buf.f_spare[1];
389 spare_out[2] = buf.f_spare[2];
390 spare_out[3] = buf.f_spare[3];
391 spare_out[4] = buf.f_spare[4];
392 return 0; 386 return 0;
393} 387}
diff --git a/fs/locks.c b/fs/locks.c
index 8b2b6ad56a09..4de3a2666810 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -2109,7 +2109,7 @@ EXPORT_SYMBOL_GPL(vfs_cancel_lock);
2109#include <linux/seq_file.h> 2109#include <linux/seq_file.h>
2110 2110
2111static void lock_get_status(struct seq_file *f, struct file_lock *fl, 2111static void lock_get_status(struct seq_file *f, struct file_lock *fl,
2112 int id, char *pfx) 2112 loff_t id, char *pfx)
2113{ 2113{
2114 struct inode *inode = NULL; 2114 struct inode *inode = NULL;
2115 unsigned int fl_pid; 2115 unsigned int fl_pid;
@@ -2122,7 +2122,7 @@ static void lock_get_status(struct seq_file *f, struct file_lock *fl,
2122 if (fl->fl_file != NULL) 2122 if (fl->fl_file != NULL)
2123 inode = fl->fl_file->f_path.dentry->d_inode; 2123 inode = fl->fl_file->f_path.dentry->d_inode;
2124 2124
2125 seq_printf(f, "%d:%s ", id, pfx); 2125 seq_printf(f, "%lld:%s ", id, pfx);
2126 if (IS_POSIX(fl)) { 2126 if (IS_POSIX(fl)) {
2127 seq_printf(f, "%6s %s ", 2127 seq_printf(f, "%6s %s ",
2128 (fl->fl_flags & FL_ACCESS) ? "ACCESS" : "POSIX ", 2128 (fl->fl_flags & FL_ACCESS) ? "ACCESS" : "POSIX ",
@@ -2185,24 +2185,27 @@ static int locks_show(struct seq_file *f, void *v)
2185 2185
2186 fl = list_entry(v, struct file_lock, fl_link); 2186 fl = list_entry(v, struct file_lock, fl_link);
2187 2187
2188 lock_get_status(f, fl, (long)f->private, ""); 2188 lock_get_status(f, fl, *((loff_t *)f->private), "");
2189 2189
2190 list_for_each_entry(bfl, &fl->fl_block, fl_block) 2190 list_for_each_entry(bfl, &fl->fl_block, fl_block)
2191 lock_get_status(f, bfl, (long)f->private, " ->"); 2191 lock_get_status(f, bfl, *((loff_t *)f->private), " ->");
2192 2192
2193 f->private++;
2194 return 0; 2193 return 0;
2195} 2194}
2196 2195
2197static void *locks_start(struct seq_file *f, loff_t *pos) 2196static void *locks_start(struct seq_file *f, loff_t *pos)
2198{ 2197{
2198 loff_t *p = f->private;
2199
2199 lock_flocks(); 2200 lock_flocks();
2200 f->private = (void *)1; 2201 *p = (*pos + 1);
2201 return seq_list_start(&file_lock_list, *pos); 2202 return seq_list_start(&file_lock_list, *pos);
2202} 2203}
2203 2204
2204static void *locks_next(struct seq_file *f, void *v, loff_t *pos) 2205static void *locks_next(struct seq_file *f, void *v, loff_t *pos)
2205{ 2206{
2207 loff_t *p = f->private;
2208 ++*p;
2206 return seq_list_next(v, &file_lock_list, pos); 2209 return seq_list_next(v, &file_lock_list, pos);
2207} 2210}
2208 2211
@@ -2220,14 +2223,14 @@ static const struct seq_operations locks_seq_operations = {
2220 2223
2221static int locks_open(struct inode *inode, struct file *filp) 2224static int locks_open(struct inode *inode, struct file *filp)
2222{ 2225{
2223 return seq_open(filp, &locks_seq_operations); 2226 return seq_open_private(filp, &locks_seq_operations, sizeof(loff_t));
2224} 2227}
2225 2228
2226static const struct file_operations proc_locks_operations = { 2229static const struct file_operations proc_locks_operations = {
2227 .open = locks_open, 2230 .open = locks_open,
2228 .read = seq_read, 2231 .read = seq_read,
2229 .llseek = seq_lseek, 2232 .llseek = seq_lseek,
2230 .release = seq_release, 2233 .release = seq_release_private,
2231}; 2234};
2232 2235
2233static int __init proc_locks_init(void) 2236static int __init proc_locks_init(void)
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index 605e292501f4..4c14c17a5276 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -290,9 +290,7 @@ static int nfs_do_writepage(struct page *page, struct writeback_control *wbc, st
290 nfs_add_stats(inode, NFSIOS_WRITEPAGES, 1); 290 nfs_add_stats(inode, NFSIOS_WRITEPAGES, 1);
291 291
292 nfs_pageio_cond_complete(pgio, page->index); 292 nfs_pageio_cond_complete(pgio, page->index);
293 ret = nfs_page_async_flush(pgio, page, 293 ret = nfs_page_async_flush(pgio, page, wbc->sync_mode == WB_SYNC_NONE);
294 wbc->sync_mode == WB_SYNC_NONE ||
295 wbc->nonblocking != 0);
296 if (ret == -EAGAIN) { 294 if (ret == -EAGAIN) {
297 redirty_page_for_writepage(wbc, page); 295 redirty_page_for_writepage(wbc, page);
298 ret = 0; 296 ret = 0;
diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c
index d926af626177..687d090cea34 100644
--- a/fs/nilfs2/segment.c
+++ b/fs/nilfs2/segment.c
@@ -1609,7 +1609,7 @@ nilfs_copy_replace_page_buffers(struct page *page, struct list_head *out)
1609 kunmap_atomic(kaddr, KM_USER0); 1609 kunmap_atomic(kaddr, KM_USER0);
1610 1610
1611 if (!TestSetPageWriteback(clone_page)) 1611 if (!TestSetPageWriteback(clone_page))
1612 inc_zone_page_state(clone_page, NR_WRITEBACK); 1612 account_page_writeback(clone_page);
1613 unlock_page(clone_page); 1613 unlock_page(clone_page);
1614 1614
1615 return 0; 1615 return 0;
diff --git a/fs/proc/Kconfig b/fs/proc/Kconfig
index 50f8f0600f06..6a0068841d96 100644
--- a/fs/proc/Kconfig
+++ b/fs/proc/Kconfig
@@ -33,8 +33,8 @@ config PROC_KCORE
33 depends on PROC_FS && MMU 33 depends on PROC_FS && MMU
34 34
35config PROC_VMCORE 35config PROC_VMCORE
36 bool "/proc/vmcore support (EXPERIMENTAL)" 36 bool "/proc/vmcore support"
37 depends on PROC_FS && CRASH_DUMP 37 depends on PROC_FS && CRASH_DUMP
38 default y 38 default y
39 help 39 help
40 Exports the dump image of crashed kernel in ELF format. 40 Exports the dump image of crashed kernel in ELF format.
diff --git a/fs/proc/base.c b/fs/proc/base.c
index dc5d5f51f3fe..53dc8ad40ae6 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -1023,28 +1023,47 @@ static ssize_t oom_adjust_write(struct file *file, const char __user *buf,
1023 memset(buffer, 0, sizeof(buffer)); 1023 memset(buffer, 0, sizeof(buffer));
1024 if (count > sizeof(buffer) - 1) 1024 if (count > sizeof(buffer) - 1)
1025 count = sizeof(buffer) - 1; 1025 count = sizeof(buffer) - 1;
1026 if (copy_from_user(buffer, buf, count)) 1026 if (copy_from_user(buffer, buf, count)) {
1027 return -EFAULT; 1027 err = -EFAULT;
1028 goto out;
1029 }
1028 1030
1029 err = strict_strtol(strstrip(buffer), 0, &oom_adjust); 1031 err = strict_strtol(strstrip(buffer), 0, &oom_adjust);
1030 if (err) 1032 if (err)
1031 return -EINVAL; 1033 goto out;
1032 if ((oom_adjust < OOM_ADJUST_MIN || oom_adjust > OOM_ADJUST_MAX) && 1034 if ((oom_adjust < OOM_ADJUST_MIN || oom_adjust > OOM_ADJUST_MAX) &&
1033 oom_adjust != OOM_DISABLE) 1035 oom_adjust != OOM_DISABLE) {
1034 return -EINVAL; 1036 err = -EINVAL;
1037 goto out;
1038 }
1035 1039
1036 task = get_proc_task(file->f_path.dentry->d_inode); 1040 task = get_proc_task(file->f_path.dentry->d_inode);
1037 if (!task) 1041 if (!task) {
1038 return -ESRCH; 1042 err = -ESRCH;
1043 goto out;
1044 }
1045
1046 task_lock(task);
1047 if (!task->mm) {
1048 err = -EINVAL;
1049 goto err_task_lock;
1050 }
1051
1039 if (!lock_task_sighand(task, &flags)) { 1052 if (!lock_task_sighand(task, &flags)) {
1040 put_task_struct(task); 1053 err = -ESRCH;
1041 return -ESRCH; 1054 goto err_task_lock;
1042 } 1055 }
1043 1056
1044 if (oom_adjust < task->signal->oom_adj && !capable(CAP_SYS_RESOURCE)) { 1057 if (oom_adjust < task->signal->oom_adj && !capable(CAP_SYS_RESOURCE)) {
1045 unlock_task_sighand(task, &flags); 1058 err = -EACCES;
1046 put_task_struct(task); 1059 goto err_sighand;
1047 return -EACCES; 1060 }
1061
1062 if (oom_adjust != task->signal->oom_adj) {
1063 if (oom_adjust == OOM_DISABLE)
1064 atomic_inc(&task->mm->oom_disable_count);
1065 if (task->signal->oom_adj == OOM_DISABLE)
1066 atomic_dec(&task->mm->oom_disable_count);
1048 } 1067 }
1049 1068
1050 /* 1069 /*
@@ -1065,10 +1084,13 @@ static ssize_t oom_adjust_write(struct file *file, const char __user *buf,
1065 else 1084 else
1066 task->signal->oom_score_adj = (oom_adjust * OOM_SCORE_ADJ_MAX) / 1085 task->signal->oom_score_adj = (oom_adjust * OOM_SCORE_ADJ_MAX) /
1067 -OOM_DISABLE; 1086 -OOM_DISABLE;
1087err_sighand:
1068 unlock_task_sighand(task, &flags); 1088 unlock_task_sighand(task, &flags);
1089err_task_lock:
1090 task_unlock(task);
1069 put_task_struct(task); 1091 put_task_struct(task);
1070 1092out:
1071 return count; 1093 return err < 0 ? err : count;
1072} 1094}
1073 1095
1074static const struct file_operations proc_oom_adjust_operations = { 1096static const struct file_operations proc_oom_adjust_operations = {
@@ -1109,30 +1131,49 @@ static ssize_t oom_score_adj_write(struct file *file, const char __user *buf,
1109 memset(buffer, 0, sizeof(buffer)); 1131 memset(buffer, 0, sizeof(buffer));
1110 if (count > sizeof(buffer) - 1) 1132 if (count > sizeof(buffer) - 1)
1111 count = sizeof(buffer) - 1; 1133 count = sizeof(buffer) - 1;
1112 if (copy_from_user(buffer, buf, count)) 1134 if (copy_from_user(buffer, buf, count)) {
1113 return -EFAULT; 1135 err = -EFAULT;
1136 goto out;
1137 }
1114 1138
1115 err = strict_strtol(strstrip(buffer), 0, &oom_score_adj); 1139 err = strict_strtol(strstrip(buffer), 0, &oom_score_adj);
1116 if (err) 1140 if (err)
1117 return -EINVAL; 1141 goto out;
1118 if (oom_score_adj < OOM_SCORE_ADJ_MIN || 1142 if (oom_score_adj < OOM_SCORE_ADJ_MIN ||
1119 oom_score_adj > OOM_SCORE_ADJ_MAX) 1143 oom_score_adj > OOM_SCORE_ADJ_MAX) {
1120 return -EINVAL; 1144 err = -EINVAL;
1145 goto out;
1146 }
1121 1147
1122 task = get_proc_task(file->f_path.dentry->d_inode); 1148 task = get_proc_task(file->f_path.dentry->d_inode);
1123 if (!task) 1149 if (!task) {
1124 return -ESRCH; 1150 err = -ESRCH;
1151 goto out;
1152 }
1153
1154 task_lock(task);
1155 if (!task->mm) {
1156 err = -EINVAL;
1157 goto err_task_lock;
1158 }
1159
1125 if (!lock_task_sighand(task, &flags)) { 1160 if (!lock_task_sighand(task, &flags)) {
1126 put_task_struct(task); 1161 err = -ESRCH;
1127 return -ESRCH; 1162 goto err_task_lock;
1128 } 1163 }
1164
1129 if (oom_score_adj < task->signal->oom_score_adj && 1165 if (oom_score_adj < task->signal->oom_score_adj &&
1130 !capable(CAP_SYS_RESOURCE)) { 1166 !capable(CAP_SYS_RESOURCE)) {
1131 unlock_task_sighand(task, &flags); 1167 err = -EACCES;
1132 put_task_struct(task); 1168 goto err_sighand;
1133 return -EACCES;
1134 } 1169 }
1135 1170
1171 if (oom_score_adj != task->signal->oom_score_adj) {
1172 if (oom_score_adj == OOM_SCORE_ADJ_MIN)
1173 atomic_inc(&task->mm->oom_disable_count);
1174 if (task->signal->oom_score_adj == OOM_SCORE_ADJ_MIN)
1175 atomic_dec(&task->mm->oom_disable_count);
1176 }
1136 task->signal->oom_score_adj = oom_score_adj; 1177 task->signal->oom_score_adj = oom_score_adj;
1137 /* 1178 /*
1138 * Scale /proc/pid/oom_adj appropriately ensuring that OOM_DISABLE is 1179 * Scale /proc/pid/oom_adj appropriately ensuring that OOM_DISABLE is
@@ -1143,9 +1184,13 @@ static ssize_t oom_score_adj_write(struct file *file, const char __user *buf,
1143 else 1184 else
1144 task->signal->oom_adj = (oom_score_adj * OOM_ADJUST_MAX) / 1185 task->signal->oom_adj = (oom_score_adj * OOM_ADJUST_MAX) /
1145 OOM_SCORE_ADJ_MAX; 1186 OOM_SCORE_ADJ_MAX;
1187err_sighand:
1146 unlock_task_sighand(task, &flags); 1188 unlock_task_sighand(task, &flags);
1189err_task_lock:
1190 task_unlock(task);
1147 put_task_struct(task); 1191 put_task_struct(task);
1148 return count; 1192out:
1193 return err < 0 ? err : count;
1149} 1194}
1150 1195
1151static const struct file_operations proc_oom_score_adj_operations = { 1196static const struct file_operations proc_oom_score_adj_operations = {
diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c
index caa758377d66..c1f93896cb53 100644
--- a/fs/reiserfs/inode.c
+++ b/fs/reiserfs/inode.c
@@ -2438,7 +2438,7 @@ static int reiserfs_write_full_page(struct page *page,
2438 /* from this point on, we know the buffer is mapped to a 2438 /* from this point on, we know the buffer is mapped to a
2439 * real block and not a direct item 2439 * real block and not a direct item
2440 */ 2440 */
2441 if (wbc->sync_mode != WB_SYNC_NONE || !wbc->nonblocking) { 2441 if (wbc->sync_mode != WB_SYNC_NONE) {
2442 lock_buffer(bh); 2442 lock_buffer(bh);
2443 } else { 2443 } else {
2444 if (!trylock_buffer(bh)) { 2444 if (!trylock_buffer(bh)) {
diff --git a/fs/xfs/linux-2.6/xfs_aops.c b/fs/xfs/linux-2.6/xfs_aops.c
index b552f816de15..c9af48fffcd7 100644
--- a/fs/xfs/linux-2.6/xfs_aops.c
+++ b/fs/xfs/linux-2.6/xfs_aops.c
@@ -1139,8 +1139,7 @@ xfs_vm_writepage(
1139 type = IO_DELAY; 1139 type = IO_DELAY;
1140 flags = BMAPI_ALLOCATE; 1140 flags = BMAPI_ALLOCATE;
1141 1141
1142 if (wbc->sync_mode == WB_SYNC_NONE && 1142 if (wbc->sync_mode == WB_SYNC_NONE)
1143 wbc->nonblocking)
1144 flags |= BMAPI_TRYLOCK; 1143 flags |= BMAPI_TRYLOCK;
1145 } 1144 }
1146 1145