aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/aio.c8
-rw-r--r--fs/bio.c2
-rw-r--r--fs/buffer.c4
-rw-r--r--fs/dquot.c2
-rw-r--r--fs/ecryptfs/dentry.c2
-rw-r--r--fs/ext3/acl.c8
-rw-r--r--fs/ext3/resize.c4
-rw-r--r--fs/ext3/xattr.c4
-rw-r--r--fs/fs-writeback.c6
-rw-r--r--fs/hfs/brec.c18
-rw-r--r--fs/isofs/compress.c11
-rw-r--r--fs/jbd/journal.c5
-rw-r--r--fs/jbd/recovery.c2
-rw-r--r--fs/jbd/transaction.c8
-rw-r--r--fs/jbd2/recovery.c2
-rw-r--r--fs/locks.c4
-rw-r--r--fs/namei.c6
-rw-r--r--fs/nfs/read.c5
-rw-r--r--fs/nfs/super.c2
-rw-r--r--fs/nfs/write.c8
-rw-r--r--fs/nfsd/nfsfh.c4
-rw-r--r--fs/proc/base.c24
-rw-r--r--fs/proc/task_mmu.c50
-rw-r--r--fs/romfs/inode.c30
-rw-r--r--fs/super.c6
-rw-r--r--fs/ufs/balloc.c4
26 files changed, 152 insertions, 77 deletions
diff --git a/fs/aio.c b/fs/aio.c
index b74c567383bc..6af921940622 100644
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -996,6 +996,14 @@ put_rq:
996 /* everything turned out well, dispose of the aiocb. */ 996 /* everything turned out well, dispose of the aiocb. */
997 ret = __aio_put_req(ctx, iocb); 997 ret = __aio_put_req(ctx, iocb);
998 998
999 /*
1000 * We have to order our ring_info tail store above and test
1001 * of the wait list below outside the wait lock. This is
1002 * like in wake_up_bit() where clearing a bit has to be
1003 * ordered with the unlocked test.
1004 */
1005 smp_mb();
1006
999 if (waitqueue_active(&ctx->wait)) 1007 if (waitqueue_active(&ctx->wait))
1000 wake_up(&ctx->wait); 1008 wake_up(&ctx->wait);
1001 1009
diff --git a/fs/bio.c b/fs/bio.c
index 3312fcc3c098..553b5b7960ad 100644
--- a/fs/bio.c
+++ b/fs/bio.c
@@ -1194,6 +1194,8 @@ EXPORT_SYMBOL(bio_hw_segments);
1194EXPORT_SYMBOL(bio_add_page); 1194EXPORT_SYMBOL(bio_add_page);
1195EXPORT_SYMBOL(bio_add_pc_page); 1195EXPORT_SYMBOL(bio_add_pc_page);
1196EXPORT_SYMBOL(bio_get_nr_vecs); 1196EXPORT_SYMBOL(bio_get_nr_vecs);
1197EXPORT_SYMBOL(bio_map_user);
1198EXPORT_SYMBOL(bio_unmap_user);
1197EXPORT_SYMBOL(bio_map_kern); 1199EXPORT_SYMBOL(bio_map_kern);
1198EXPORT_SYMBOL(bio_pair_release); 1200EXPORT_SYMBOL(bio_pair_release);
1199EXPORT_SYMBOL(bio_split); 1201EXPORT_SYMBOL(bio_split);
diff --git a/fs/buffer.c b/fs/buffer.c
index ddfdd2c80bf9..7ba58386beee 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -3213,7 +3213,7 @@ static int buffer_cpu_notify(struct notifier_block *self,
3213} 3213}
3214 3214
3215/** 3215/**
3216 * bh_uptodate_or_lock: Test whether the buffer is uptodate 3216 * bh_uptodate_or_lock - Test whether the buffer is uptodate
3217 * @bh: struct buffer_head 3217 * @bh: struct buffer_head
3218 * 3218 *
3219 * Return true if the buffer is up-to-date and false, 3219 * Return true if the buffer is up-to-date and false,
@@ -3232,7 +3232,7 @@ int bh_uptodate_or_lock(struct buffer_head *bh)
3232EXPORT_SYMBOL(bh_uptodate_or_lock); 3232EXPORT_SYMBOL(bh_uptodate_or_lock);
3233 3233
3234/** 3234/**
3235 * bh_submit_read: Submit a locked buffer for reading 3235 * bh_submit_read - Submit a locked buffer for reading
3236 * @bh: struct buffer_head 3236 * @bh: struct buffer_head
3237 * 3237 *
3238 * Returns zero on success and -EIO on error. 3238 * Returns zero on success and -EIO on error.
diff --git a/fs/dquot.c b/fs/dquot.c
index 9c7feb62eed1..41b9dbd68b0e 100644
--- a/fs/dquot.c
+++ b/fs/dquot.c
@@ -1522,8 +1522,8 @@ int vfs_quota_off(struct super_block *sb, int type)
1522 truncate_inode_pages(&toputinode[cnt]->i_data, 0); 1522 truncate_inode_pages(&toputinode[cnt]->i_data, 0);
1523 mutex_unlock(&toputinode[cnt]->i_mutex); 1523 mutex_unlock(&toputinode[cnt]->i_mutex);
1524 mark_inode_dirty(toputinode[cnt]); 1524 mark_inode_dirty(toputinode[cnt]);
1525 iput(toputinode[cnt]);
1526 } 1525 }
1526 iput(toputinode[cnt]);
1527 mutex_unlock(&dqopt->dqonoff_mutex); 1527 mutex_unlock(&dqopt->dqonoff_mutex);
1528 } 1528 }
1529 if (sb->s_bdev) 1529 if (sb->s_bdev)
diff --git a/fs/ecryptfs/dentry.c b/fs/ecryptfs/dentry.c
index 841a032050a7..5e596583946c 100644
--- a/fs/ecryptfs/dentry.c
+++ b/fs/ecryptfs/dentry.c
@@ -80,8 +80,8 @@ static void ecryptfs_d_release(struct dentry *dentry)
80{ 80{
81 if (ecryptfs_dentry_to_private(dentry)) { 81 if (ecryptfs_dentry_to_private(dentry)) {
82 if (ecryptfs_dentry_to_lower(dentry)) { 82 if (ecryptfs_dentry_to_lower(dentry)) {
83 mntput(ecryptfs_dentry_to_lower_mnt(dentry));
84 dput(ecryptfs_dentry_to_lower(dentry)); 83 dput(ecryptfs_dentry_to_lower(dentry));
84 mntput(ecryptfs_dentry_to_lower_mnt(dentry));
85 } 85 }
86 kmem_cache_free(ecryptfs_dentry_info_cache, 86 kmem_cache_free(ecryptfs_dentry_info_cache,
87 ecryptfs_dentry_to_private(dentry)); 87 ecryptfs_dentry_to_private(dentry));
diff --git a/fs/ext3/acl.c b/fs/ext3/acl.c
index d34e9967430a..a754d1848173 100644
--- a/fs/ext3/acl.c
+++ b/fs/ext3/acl.c
@@ -37,7 +37,7 @@ ext3_acl_from_disk(const void *value, size_t size)
37 return ERR_PTR(-EINVAL); 37 return ERR_PTR(-EINVAL);
38 if (count == 0) 38 if (count == 0)
39 return NULL; 39 return NULL;
40 acl = posix_acl_alloc(count, GFP_KERNEL); 40 acl = posix_acl_alloc(count, GFP_NOFS);
41 if (!acl) 41 if (!acl)
42 return ERR_PTR(-ENOMEM); 42 return ERR_PTR(-ENOMEM);
43 for (n=0; n < count; n++) { 43 for (n=0; n < count; n++) {
@@ -91,7 +91,7 @@ ext3_acl_to_disk(const struct posix_acl *acl, size_t *size)
91 91
92 *size = ext3_acl_size(acl->a_count); 92 *size = ext3_acl_size(acl->a_count);
93 ext_acl = kmalloc(sizeof(ext3_acl_header) + acl->a_count * 93 ext_acl = kmalloc(sizeof(ext3_acl_header) + acl->a_count *
94 sizeof(ext3_acl_entry), GFP_KERNEL); 94 sizeof(ext3_acl_entry), GFP_NOFS);
95 if (!ext_acl) 95 if (!ext_acl)
96 return ERR_PTR(-ENOMEM); 96 return ERR_PTR(-ENOMEM);
97 ext_acl->a_version = cpu_to_le32(EXT3_ACL_VERSION); 97 ext_acl->a_version = cpu_to_le32(EXT3_ACL_VERSION);
@@ -187,7 +187,7 @@ ext3_get_acl(struct inode *inode, int type)
187 } 187 }
188 retval = ext3_xattr_get(inode, name_index, "", NULL, 0); 188 retval = ext3_xattr_get(inode, name_index, "", NULL, 0);
189 if (retval > 0) { 189 if (retval > 0) {
190 value = kmalloc(retval, GFP_KERNEL); 190 value = kmalloc(retval, GFP_NOFS);
191 if (!value) 191 if (!value)
192 return ERR_PTR(-ENOMEM); 192 return ERR_PTR(-ENOMEM);
193 retval = ext3_xattr_get(inode, name_index, "", value, retval); 193 retval = ext3_xattr_get(inode, name_index, "", value, retval);
@@ -335,7 +335,7 @@ ext3_init_acl(handle_t *handle, struct inode *inode, struct inode *dir)
335 if (error) 335 if (error)
336 goto cleanup; 336 goto cleanup;
337 } 337 }
338 clone = posix_acl_clone(acl, GFP_KERNEL); 338 clone = posix_acl_clone(acl, GFP_NOFS);
339 error = -ENOMEM; 339 error = -ENOMEM;
340 if (!clone) 340 if (!clone)
341 goto cleanup; 341 goto cleanup;
diff --git a/fs/ext3/resize.c b/fs/ext3/resize.c
index 9397d779c43d..0e97b6e07cb0 100644
--- a/fs/ext3/resize.c
+++ b/fs/ext3/resize.c
@@ -485,7 +485,7 @@ static int add_new_gdb(handle_t *handle, struct inode *inode,
485 goto exit_dindj; 485 goto exit_dindj;
486 486
487 n_group_desc = kmalloc((gdb_num + 1) * sizeof(struct buffer_head *), 487 n_group_desc = kmalloc((gdb_num + 1) * sizeof(struct buffer_head *),
488 GFP_KERNEL); 488 GFP_NOFS);
489 if (!n_group_desc) { 489 if (!n_group_desc) {
490 err = -ENOMEM; 490 err = -ENOMEM;
491 ext3_warning (sb, __FUNCTION__, 491 ext3_warning (sb, __FUNCTION__,
@@ -568,7 +568,7 @@ static int reserve_backup_gdb(handle_t *handle, struct inode *inode,
568 int res, i; 568 int res, i;
569 int err; 569 int err;
570 570
571 primary = kmalloc(reserved_gdb * sizeof(*primary), GFP_KERNEL); 571 primary = kmalloc(reserved_gdb * sizeof(*primary), GFP_NOFS);
572 if (!primary) 572 if (!primary)
573 return -ENOMEM; 573 return -ENOMEM;
574 574
diff --git a/fs/ext3/xattr.c b/fs/ext3/xattr.c
index fb89c299bece..a6ea4d6a8bb2 100644
--- a/fs/ext3/xattr.c
+++ b/fs/ext3/xattr.c
@@ -728,7 +728,7 @@ ext3_xattr_block_set(handle_t *handle, struct inode *inode,
728 ce = NULL; 728 ce = NULL;
729 } 729 }
730 ea_bdebug(bs->bh, "cloning"); 730 ea_bdebug(bs->bh, "cloning");
731 s->base = kmalloc(bs->bh->b_size, GFP_KERNEL); 731 s->base = kmalloc(bs->bh->b_size, GFP_NOFS);
732 error = -ENOMEM; 732 error = -ENOMEM;
733 if (s->base == NULL) 733 if (s->base == NULL)
734 goto cleanup; 734 goto cleanup;
@@ -740,7 +740,7 @@ ext3_xattr_block_set(handle_t *handle, struct inode *inode,
740 } 740 }
741 } else { 741 } else {
742 /* Allocate a buffer where we construct the new block. */ 742 /* Allocate a buffer where we construct the new block. */
743 s->base = kzalloc(sb->s_blocksize, GFP_KERNEL); 743 s->base = kzalloc(sb->s_blocksize, GFP_NOFS);
744 /* assert(header == s->base) */ 744 /* assert(header == s->base) */
745 error = -ENOMEM; 745 error = -ENOMEM;
746 if (s->base == NULL) 746 if (s->base == NULL)
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
index c0076077d338..06557679ca41 100644
--- a/fs/fs-writeback.c
+++ b/fs/fs-writeback.c
@@ -751,7 +751,7 @@ int generic_osync_inode(struct inode *inode, struct address_space *mapping, int
751EXPORT_SYMBOL(generic_osync_inode); 751EXPORT_SYMBOL(generic_osync_inode);
752 752
753/** 753/**
754 * writeback_acquire: attempt to get exclusive writeback access to a device 754 * writeback_acquire - attempt to get exclusive writeback access to a device
755 * @bdi: the device's backing_dev_info structure 755 * @bdi: the device's backing_dev_info structure
756 * 756 *
757 * It is a waste of resources to have more than one pdflush thread blocked on 757 * It is a waste of resources to have more than one pdflush thread blocked on
@@ -768,7 +768,7 @@ int writeback_acquire(struct backing_dev_info *bdi)
768} 768}
769 769
770/** 770/**
771 * writeback_in_progress: determine whether there is writeback in progress 771 * writeback_in_progress - determine whether there is writeback in progress
772 * @bdi: the device's backing_dev_info structure. 772 * @bdi: the device's backing_dev_info structure.
773 * 773 *
774 * Determine whether there is writeback in progress against a backing device. 774 * Determine whether there is writeback in progress against a backing device.
@@ -779,7 +779,7 @@ int writeback_in_progress(struct backing_dev_info *bdi)
779} 779}
780 780
781/** 781/**
782 * writeback_release: relinquish exclusive writeback access against a device. 782 * writeback_release - relinquish exclusive writeback access against a device.
783 * @bdi: the device's backing_dev_info structure 783 * @bdi: the device's backing_dev_info structure
784 */ 784 */
785void writeback_release(struct backing_dev_info *bdi) 785void writeback_release(struct backing_dev_info *bdi)
diff --git a/fs/hfs/brec.c b/fs/hfs/brec.c
index 878bf25dbc6a..92fb358ce824 100644
--- a/fs/hfs/brec.c
+++ b/fs/hfs/brec.c
@@ -229,7 +229,7 @@ skip:
229static struct hfs_bnode *hfs_bnode_split(struct hfs_find_data *fd) 229static struct hfs_bnode *hfs_bnode_split(struct hfs_find_data *fd)
230{ 230{
231 struct hfs_btree *tree; 231 struct hfs_btree *tree;
232 struct hfs_bnode *node, *new_node; 232 struct hfs_bnode *node, *new_node, *next_node;
233 struct hfs_bnode_desc node_desc; 233 struct hfs_bnode_desc node_desc;
234 int num_recs, new_rec_off, new_off, old_rec_off; 234 int num_recs, new_rec_off, new_off, old_rec_off;
235 int data_start, data_end, size; 235 int data_start, data_end, size;
@@ -248,6 +248,17 @@ static struct hfs_bnode *hfs_bnode_split(struct hfs_find_data *fd)
248 new_node->type = node->type; 248 new_node->type = node->type;
249 new_node->height = node->height; 249 new_node->height = node->height;
250 250
251 if (node->next)
252 next_node = hfs_bnode_find(tree, node->next);
253 else
254 next_node = NULL;
255
256 if (IS_ERR(next_node)) {
257 hfs_bnode_put(node);
258 hfs_bnode_put(new_node);
259 return next_node;
260 }
261
251 size = tree->node_size / 2 - node->num_recs * 2 - 14; 262 size = tree->node_size / 2 - node->num_recs * 2 - 14;
252 old_rec_off = tree->node_size - 4; 263 old_rec_off = tree->node_size - 4;
253 num_recs = 1; 264 num_recs = 1;
@@ -261,6 +272,8 @@ static struct hfs_bnode *hfs_bnode_split(struct hfs_find_data *fd)
261 /* panic? */ 272 /* panic? */
262 hfs_bnode_put(node); 273 hfs_bnode_put(node);
263 hfs_bnode_put(new_node); 274 hfs_bnode_put(new_node);
275 if (next_node)
276 hfs_bnode_put(next_node);
264 return ERR_PTR(-ENOSPC); 277 return ERR_PTR(-ENOSPC);
265 } 278 }
266 279
@@ -315,8 +328,7 @@ static struct hfs_bnode *hfs_bnode_split(struct hfs_find_data *fd)
315 hfs_bnode_write(node, &node_desc, 0, sizeof(node_desc)); 328 hfs_bnode_write(node, &node_desc, 0, sizeof(node_desc));
316 329
317 /* update next bnode header */ 330 /* update next bnode header */
318 if (new_node->next) { 331 if (next_node) {
319 struct hfs_bnode *next_node = hfs_bnode_find(tree, new_node->next);
320 next_node->prev = new_node->this; 332 next_node->prev = new_node->this;
321 hfs_bnode_read(next_node, &node_desc, 0, sizeof(node_desc)); 333 hfs_bnode_read(next_node, &node_desc, 0, sizeof(node_desc));
322 node_desc.prev = cpu_to_be32(next_node->prev); 334 node_desc.prev = cpu_to_be32(next_node->prev);
diff --git a/fs/isofs/compress.c b/fs/isofs/compress.c
index 37dbd6404787..defb932eee9a 100644
--- a/fs/isofs/compress.c
+++ b/fs/isofs/compress.c
@@ -72,6 +72,17 @@ static int zisofs_readpage(struct file *file, struct page *page)
72 offset = index & ~zisofs_block_page_mask; 72 offset = index & ~zisofs_block_page_mask;
73 blockindex = offset >> zisofs_block_page_shift; 73 blockindex = offset >> zisofs_block_page_shift;
74 maxpage = (inode->i_size + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT; 74 maxpage = (inode->i_size + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
75
76 /*
77 * If this page is wholly outside i_size we just return zero;
78 * do_generic_file_read() will handle this for us
79 */
80 if (page->index >= maxpage) {
81 SetPageUptodate(page);
82 unlock_page(page);
83 return 0;
84 }
85
75 maxpage = min(zisofs_block_pages, maxpage-offset); 86 maxpage = min(zisofs_block_pages, maxpage-offset);
76 87
77 for ( i = 0 ; i < maxpage ; i++, offset++ ) { 88 for ( i = 0 ; i < maxpage ; i++, offset++ ) {
diff --git a/fs/jbd/journal.c b/fs/jbd/journal.c
index 3943a8905eb2..9816293442ab 100644
--- a/fs/jbd/journal.c
+++ b/fs/jbd/journal.c
@@ -697,13 +697,14 @@ fail:
697 */ 697 */
698 698
699/** 699/**
700 * journal_t * journal_init_dev() - creates an initialises a journal structure 700 * journal_t * journal_init_dev() - creates and initialises a journal structure
701 * @bdev: Block device on which to create the journal 701 * @bdev: Block device on which to create the journal
702 * @fs_dev: Device which hold journalled filesystem for this journal. 702 * @fs_dev: Device which hold journalled filesystem for this journal.
703 * @start: Block nr Start of journal. 703 * @start: Block nr Start of journal.
704 * @len: Length of the journal in blocks. 704 * @len: Length of the journal in blocks.
705 * @blocksize: blocksize of journalling device 705 * @blocksize: blocksize of journalling device
706 * @returns: a newly created journal_t * 706 *
707 * Returns: a newly created journal_t *
707 * 708 *
708 * journal_init_dev creates a journal which maps a fixed contiguous 709 * journal_init_dev creates a journal which maps a fixed contiguous
709 * range of blocks on an arbitrary block device. 710 * range of blocks on an arbitrary block device.
diff --git a/fs/jbd/recovery.c b/fs/jbd/recovery.c
index 2b8edf4d6eaa..43bc5e5ed064 100644
--- a/fs/jbd/recovery.c
+++ b/fs/jbd/recovery.c
@@ -478,7 +478,7 @@ static int do_one_pass(journal_t *journal,
478 memcpy(nbh->b_data, obh->b_data, 478 memcpy(nbh->b_data, obh->b_data,
479 journal->j_blocksize); 479 journal->j_blocksize);
480 if (flags & JFS_FLAG_ESCAPE) { 480 if (flags & JFS_FLAG_ESCAPE) {
481 *((__be32 *)bh->b_data) = 481 *((__be32 *)nbh->b_data) =
482 cpu_to_be32(JFS_MAGIC_NUMBER); 482 cpu_to_be32(JFS_MAGIC_NUMBER);
483 } 483 }
484 484
diff --git a/fs/jbd/transaction.c b/fs/jbd/transaction.c
index c6cbb6cd59b2..2c9e8f5d13aa 100644
--- a/fs/jbd/transaction.c
+++ b/fs/jbd/transaction.c
@@ -1426,7 +1426,8 @@ int journal_stop(handle_t *handle)
1426 return err; 1426 return err;
1427} 1427}
1428 1428
1429/**int journal_force_commit() - force any uncommitted transactions 1429/**
1430 * int journal_force_commit() - force any uncommitted transactions
1430 * @journal: journal to force 1431 * @journal: journal to force
1431 * 1432 *
1432 * For synchronous operations: force any uncommitted transactions 1433 * For synchronous operations: force any uncommitted transactions
@@ -1903,13 +1904,12 @@ zap_buffer_unlocked:
1903} 1904}
1904 1905
1905/** 1906/**
1906 * void journal_invalidatepage() 1907 * void journal_invalidatepage() - invalidate a journal page
1907 * @journal: journal to use for flush... 1908 * @journal: journal to use for flush
1908 * @page: page to flush 1909 * @page: page to flush
1909 * @offset: length of page to invalidate. 1910 * @offset: length of page to invalidate.
1910 * 1911 *
1911 * Reap page buffers containing data after offset in page. 1912 * Reap page buffers containing data after offset in page.
1912 *
1913 */ 1913 */
1914void journal_invalidatepage(journal_t *journal, 1914void journal_invalidatepage(journal_t *journal,
1915 struct page *page, 1915 struct page *page,
diff --git a/fs/jbd2/recovery.c b/fs/jbd2/recovery.c
index 146411387ada..5d0405a9e7ca 100644
--- a/fs/jbd2/recovery.c
+++ b/fs/jbd2/recovery.c
@@ -535,7 +535,7 @@ static int do_one_pass(journal_t *journal,
535 memcpy(nbh->b_data, obh->b_data, 535 memcpy(nbh->b_data, obh->b_data,
536 journal->j_blocksize); 536 journal->j_blocksize);
537 if (flags & JBD2_FLAG_ESCAPE) { 537 if (flags & JBD2_FLAG_ESCAPE) {
538 *((__be32 *)bh->b_data) = 538 *((__be32 *)nbh->b_data) =
539 cpu_to_be32(JBD2_MAGIC_NUMBER); 539 cpu_to_be32(JBD2_MAGIC_NUMBER);
540 } 540 }
541 541
diff --git a/fs/locks.c b/fs/locks.c
index f36f0e61558d..d83fab1b77b5 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -1275,13 +1275,13 @@ out:
1275EXPORT_SYMBOL(__break_lease); 1275EXPORT_SYMBOL(__break_lease);
1276 1276
1277/** 1277/**
1278 * lease_get_mtime 1278 * lease_get_mtime - get the last modified time of an inode
1279 * @inode: the inode 1279 * @inode: the inode
1280 * @time: pointer to a timespec which will contain the last modified time 1280 * @time: pointer to a timespec which will contain the last modified time
1281 * 1281 *
1282 * This is to force NFS clients to flush their caches for files with 1282 * This is to force NFS clients to flush their caches for files with
1283 * exclusive leases. The justification is that if someone has an 1283 * exclusive leases. The justification is that if someone has an
1284 * exclusive lease, then they could be modifiying it. 1284 * exclusive lease, then they could be modifying it.
1285 */ 1285 */
1286void lease_get_mtime(struct inode *inode, struct timespec *time) 1286void lease_get_mtime(struct inode *inode, struct timespec *time)
1287{ 1287{
diff --git a/fs/namei.c b/fs/namei.c
index 941c8e8228c0..6b7a0eef4090 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1364,13 +1364,13 @@ static int __lookup_one_len(const char *name, struct qstr *this,
1364} 1364}
1365 1365
1366/** 1366/**
1367 * lookup_one_len: filesystem helper to lookup single pathname component 1367 * lookup_one_len - filesystem helper to lookup single pathname component
1368 * @name: pathname component to lookup 1368 * @name: pathname component to lookup
1369 * @base: base directory to lookup from 1369 * @base: base directory to lookup from
1370 * @len: maximum length @len should be interpreted to 1370 * @len: maximum length @len should be interpreted to
1371 * 1371 *
1372 * Note that this routine is purely a helper for filesystem useage and should 1372 * Note that this routine is purely a helper for filesystem usage and should
1373 * not be called by generic code. Also note that by using this function to 1373 * not be called by generic code. Also note that by using this function the
1374 * nameidata argument is passed to the filesystem methods and a filesystem 1374 * nameidata argument is passed to the filesystem methods and a filesystem
1375 * using this helper needs to be prepared for that. 1375 * using this helper needs to be prepared for that.
1376 */ 1376 */
diff --git a/fs/nfs/read.c b/fs/nfs/read.c
index 3d7d9631e125..5a70be589bbe 100644
--- a/fs/nfs/read.c
+++ b/fs/nfs/read.c
@@ -533,7 +533,10 @@ readpage_async_filler(void *data, struct page *page)
533 533
534 if (len < PAGE_CACHE_SIZE) 534 if (len < PAGE_CACHE_SIZE)
535 zero_user_segment(page, len, PAGE_CACHE_SIZE); 535 zero_user_segment(page, len, PAGE_CACHE_SIZE);
536 nfs_pageio_add_request(desc->pgio, new); 536 if (!nfs_pageio_add_request(desc->pgio, new)) {
537 error = desc->pgio->pg_error;
538 goto out_unlock;
539 }
537 return 0; 540 return 0;
538out_error: 541out_error:
539 error = PTR_ERR(new); 542 error = PTR_ERR(new);
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index fcf4b982c885..dd4dfcd632ec 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -632,7 +632,7 @@ static int nfs_verify_server_address(struct sockaddr *addr)
632 switch (addr->sa_family) { 632 switch (addr->sa_family) {
633 case AF_INET: { 633 case AF_INET: {
634 struct sockaddr_in *sa = (struct sockaddr_in *)addr; 634 struct sockaddr_in *sa = (struct sockaddr_in *)addr;
635 return sa->sin_addr.s_addr != INADDR_ANY; 635 return sa->sin_addr.s_addr != htonl(INADDR_ANY);
636 } 636 }
637 case AF_INET6: { 637 case AF_INET6: {
638 struct in6_addr *sa = &((struct sockaddr_in6 *)addr)->sin6_addr; 638 struct in6_addr *sa = &((struct sockaddr_in6 *)addr)->sin6_addr;
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index 80c61fdb2720..bed63416a55b 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -39,6 +39,7 @@ static struct nfs_page * nfs_update_request(struct nfs_open_context*,
39 unsigned int, unsigned int); 39 unsigned int, unsigned int);
40static void nfs_pageio_init_write(struct nfs_pageio_descriptor *desc, 40static void nfs_pageio_init_write(struct nfs_pageio_descriptor *desc,
41 struct inode *inode, int ioflags); 41 struct inode *inode, int ioflags);
42static void nfs_redirty_request(struct nfs_page *req);
42static const struct rpc_call_ops nfs_write_partial_ops; 43static const struct rpc_call_ops nfs_write_partial_ops;
43static const struct rpc_call_ops nfs_write_full_ops; 44static const struct rpc_call_ops nfs_write_full_ops;
44static const struct rpc_call_ops nfs_commit_ops; 45static const struct rpc_call_ops nfs_commit_ops;
@@ -288,7 +289,12 @@ static int nfs_page_async_flush(struct nfs_pageio_descriptor *pgio,
288 BUG(); 289 BUG();
289 } 290 }
290 spin_unlock(&inode->i_lock); 291 spin_unlock(&inode->i_lock);
291 nfs_pageio_add_request(pgio, req); 292 if (!nfs_pageio_add_request(pgio, req)) {
293 nfs_redirty_request(req);
294 nfs_end_page_writeback(page);
295 nfs_clear_page_tag_locked(req);
296 return pgio->pg_error;
297 }
292 return 0; 298 return 0;
293} 299}
294 300
diff --git a/fs/nfsd/nfsfh.c b/fs/nfsd/nfsfh.c
index 1eb771d79cca..3e6b3f41ee1f 100644
--- a/fs/nfsd/nfsfh.c
+++ b/fs/nfsd/nfsfh.c
@@ -232,6 +232,7 @@ fh_verify(struct svc_rqst *rqstp, struct svc_fh *fhp, int type, int access)
232 fhp->fh_dentry = dentry; 232 fhp->fh_dentry = dentry;
233 fhp->fh_export = exp; 233 fhp->fh_export = exp;
234 nfsd_nr_verified++; 234 nfsd_nr_verified++;
235 cache_get(&exp->h);
235 } else { 236 } else {
236 /* 237 /*
237 * just rechecking permissions 238 * just rechecking permissions
@@ -241,6 +242,7 @@ fh_verify(struct svc_rqst *rqstp, struct svc_fh *fhp, int type, int access)
241 dprintk("nfsd: fh_verify - just checking\n"); 242 dprintk("nfsd: fh_verify - just checking\n");
242 dentry = fhp->fh_dentry; 243 dentry = fhp->fh_dentry;
243 exp = fhp->fh_export; 244 exp = fhp->fh_export;
245 cache_get(&exp->h);
244 /* 246 /*
245 * Set user creds for this exportpoint; necessary even 247 * Set user creds for this exportpoint; necessary even
246 * in the "just checking" case because this may be a 248 * in the "just checking" case because this may be a
@@ -252,8 +254,6 @@ fh_verify(struct svc_rqst *rqstp, struct svc_fh *fhp, int type, int access)
252 if (error) 254 if (error)
253 goto out; 255 goto out;
254 } 256 }
255 cache_get(&exp->h);
256
257 257
258 error = nfsd_mode_check(rqstp, dentry->d_inode->i_mode, type); 258 error = nfsd_mode_check(rqstp, dentry->d_inode->i_mode, type);
259 if (error) 259 if (error)
diff --git a/fs/proc/base.c b/fs/proc/base.c
index 9a4da0aae02e..81d7d145292a 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -1036,6 +1036,26 @@ static const struct file_operations proc_loginuid_operations = {
1036 .read = proc_loginuid_read, 1036 .read = proc_loginuid_read,
1037 .write = proc_loginuid_write, 1037 .write = proc_loginuid_write,
1038}; 1038};
1039
1040static ssize_t proc_sessionid_read(struct file * file, char __user * buf,
1041 size_t count, loff_t *ppos)
1042{
1043 struct inode * inode = file->f_path.dentry->d_inode;
1044 struct task_struct *task = get_proc_task(inode);
1045 ssize_t length;
1046 char tmpbuf[TMPBUFLEN];
1047
1048 if (!task)
1049 return -ESRCH;
1050 length = scnprintf(tmpbuf, TMPBUFLEN, "%u",
1051 audit_get_sessionid(task));
1052 put_task_struct(task);
1053 return simple_read_from_buffer(buf, count, ppos, tmpbuf, length);
1054}
1055
1056static const struct file_operations proc_sessionid_operations = {
1057 .read = proc_sessionid_read,
1058};
1039#endif 1059#endif
1040 1060
1041#ifdef CONFIG_FAULT_INJECTION 1061#ifdef CONFIG_FAULT_INJECTION
@@ -2270,7 +2290,7 @@ static const struct pid_entry tgid_base_stuff[] = {
2270 DIR("fd", S_IRUSR|S_IXUSR, fd), 2290 DIR("fd", S_IRUSR|S_IXUSR, fd),
2271 DIR("fdinfo", S_IRUSR|S_IXUSR, fdinfo), 2291 DIR("fdinfo", S_IRUSR|S_IXUSR, fdinfo),
2272#ifdef CONFIG_NET 2292#ifdef CONFIG_NET
2273 DIR("net", S_IRUGO|S_IXUSR, net), 2293 DIR("net", S_IRUGO|S_IXUGO, net),
2274#endif 2294#endif
2275 REG("environ", S_IRUSR, environ), 2295 REG("environ", S_IRUSR, environ),
2276 INF("auxv", S_IRUSR, pid_auxv), 2296 INF("auxv", S_IRUSR, pid_auxv),
@@ -2319,6 +2339,7 @@ static const struct pid_entry tgid_base_stuff[] = {
2319 REG("oom_adj", S_IRUGO|S_IWUSR, oom_adjust), 2339 REG("oom_adj", S_IRUGO|S_IWUSR, oom_adjust),
2320#ifdef CONFIG_AUDITSYSCALL 2340#ifdef CONFIG_AUDITSYSCALL
2321 REG("loginuid", S_IWUSR|S_IRUGO, loginuid), 2341 REG("loginuid", S_IWUSR|S_IRUGO, loginuid),
2342 REG("sessionid", S_IRUSR, sessionid),
2322#endif 2343#endif
2323#ifdef CONFIG_FAULT_INJECTION 2344#ifdef CONFIG_FAULT_INJECTION
2324 REG("make-it-fail", S_IRUGO|S_IWUSR, fault_inject), 2345 REG("make-it-fail", S_IRUGO|S_IWUSR, fault_inject),
@@ -2649,6 +2670,7 @@ static const struct pid_entry tid_base_stuff[] = {
2649 REG("oom_adj", S_IRUGO|S_IWUSR, oom_adjust), 2670 REG("oom_adj", S_IRUGO|S_IWUSR, oom_adjust),
2650#ifdef CONFIG_AUDITSYSCALL 2671#ifdef CONFIG_AUDITSYSCALL
2651 REG("loginuid", S_IWUSR|S_IRUGO, loginuid), 2672 REG("loginuid", S_IWUSR|S_IRUGO, loginuid),
2673 REG("sessionid", S_IRUSR, sessionid),
2652#endif 2674#endif
2653#ifdef CONFIG_FAULT_INJECTION 2675#ifdef CONFIG_FAULT_INJECTION
2654 REG("make-it-fail", S_IRUGO|S_IWUSR, fault_inject), 2676 REG("make-it-fail", S_IRUGO|S_IWUSR, fault_inject),
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
index 4206454734e0..9dfb5ff24209 100644
--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
@@ -527,13 +527,21 @@ struct pagemapread {
527 char __user *out, *end; 527 char __user *out, *end;
528}; 528};
529 529
530#define PM_ENTRY_BYTES sizeof(u64) 530#define PM_ENTRY_BYTES sizeof(u64)
531#define PM_RESERVED_BITS 3 531#define PM_STATUS_BITS 3
532#define PM_RESERVED_OFFSET (64 - PM_RESERVED_BITS) 532#define PM_STATUS_OFFSET (64 - PM_STATUS_BITS)
533#define PM_RESERVED_MASK (((1LL<<PM_RESERVED_BITS)-1) << PM_RESERVED_OFFSET) 533#define PM_STATUS_MASK (((1LL << PM_STATUS_BITS) - 1) << PM_STATUS_OFFSET)
534#define PM_SPECIAL(nr) (((nr) << PM_RESERVED_OFFSET) & PM_RESERVED_MASK) 534#define PM_STATUS(nr) (((nr) << PM_STATUS_OFFSET) & PM_STATUS_MASK)
535#define PM_NOT_PRESENT PM_SPECIAL(1LL) 535#define PM_PSHIFT_BITS 6
536#define PM_SWAP PM_SPECIAL(2LL) 536#define PM_PSHIFT_OFFSET (PM_STATUS_OFFSET - PM_PSHIFT_BITS)
537#define PM_PSHIFT_MASK (((1LL << PM_PSHIFT_BITS) - 1) << PM_PSHIFT_OFFSET)
538#define PM_PSHIFT(x) (((u64) (x) << PM_PSHIFT_OFFSET) & PM_PSHIFT_MASK)
539#define PM_PFRAME_MASK ((1LL << PM_PSHIFT_OFFSET) - 1)
540#define PM_PFRAME(x) ((x) & PM_PFRAME_MASK)
541
542#define PM_PRESENT PM_STATUS(4LL)
543#define PM_SWAP PM_STATUS(2LL)
544#define PM_NOT_PRESENT PM_PSHIFT(PAGE_SHIFT)
537#define PM_END_OF_BUFFER 1 545#define PM_END_OF_BUFFER 1
538 546
539static int add_to_pagemap(unsigned long addr, u64 pfn, 547static int add_to_pagemap(unsigned long addr, u64 pfn,
@@ -574,7 +582,7 @@ static int pagemap_pte_hole(unsigned long start, unsigned long end,
574u64 swap_pte_to_pagemap_entry(pte_t pte) 582u64 swap_pte_to_pagemap_entry(pte_t pte)
575{ 583{
576 swp_entry_t e = pte_to_swp_entry(pte); 584 swp_entry_t e = pte_to_swp_entry(pte);
577 return PM_SWAP | swp_type(e) | (swp_offset(e) << MAX_SWAPFILES_SHIFT); 585 return swp_type(e) | (swp_offset(e) << MAX_SWAPFILES_SHIFT);
578} 586}
579 587
580static int pagemap_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end, 588static int pagemap_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end,
@@ -588,9 +596,11 @@ static int pagemap_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end,
588 u64 pfn = PM_NOT_PRESENT; 596 u64 pfn = PM_NOT_PRESENT;
589 pte = pte_offset_map(pmd, addr); 597 pte = pte_offset_map(pmd, addr);
590 if (is_swap_pte(*pte)) 598 if (is_swap_pte(*pte))
591 pfn = swap_pte_to_pagemap_entry(*pte); 599 pfn = PM_PFRAME(swap_pte_to_pagemap_entry(*pte))
600 | PM_PSHIFT(PAGE_SHIFT) | PM_SWAP;
592 else if (pte_present(*pte)) 601 else if (pte_present(*pte))
593 pfn = pte_pfn(*pte); 602 pfn = PM_PFRAME(pte_pfn(*pte))
603 | PM_PSHIFT(PAGE_SHIFT) | PM_PRESENT;
594 /* unmap so we're not in atomic when we copy to userspace */ 604 /* unmap so we're not in atomic when we copy to userspace */
595 pte_unmap(pte); 605 pte_unmap(pte);
596 err = add_to_pagemap(addr, pfn, pm); 606 err = add_to_pagemap(addr, pfn, pm);
@@ -611,12 +621,20 @@ static struct mm_walk pagemap_walk = {
611/* 621/*
612 * /proc/pid/pagemap - an array mapping virtual pages to pfns 622 * /proc/pid/pagemap - an array mapping virtual pages to pfns
613 * 623 *
614 * For each page in the address space, this file contains one 64-bit 624 * For each page in the address space, this file contains one 64-bit entry
615 * entry representing the corresponding physical page frame number 625 * consisting of the following:
616 * (PFN) if the page is present. If there is a swap entry for the 626 *
617 * physical page, then an encoding of the swap file number and the 627 * Bits 0-55 page frame number (PFN) if present
618 * page's offset into the swap file are returned. If no page is 628 * Bits 0-4 swap type if swapped
619 * present at all, PM_NOT_PRESENT is returned. This allows determining 629 * Bits 5-55 swap offset if swapped
630 * Bits 55-60 page shift (page size = 1<<page shift)
631 * Bit 61 reserved for future use
632 * Bit 62 page swapped
633 * Bit 63 page present
634 *
635 * If the page is not present but in swap, then the PFN contains an
636 * encoding of the swap file number and the page's offset into the
637 * swap. Unmapped pages return a null PFN. This allows determining
620 * precisely which pages are mapped (or in swap) and comparing mapped 638 * precisely which pages are mapped (or in swap) and comparing mapped
621 * pages between processes. 639 * pages between processes.
622 * 640 *
diff --git a/fs/romfs/inode.c b/fs/romfs/inode.c
index 00b6f0a518c8..3f13d491c7c7 100644
--- a/fs/romfs/inode.c
+++ b/fs/romfs/inode.c
@@ -340,8 +340,9 @@ static struct dentry *
340romfs_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd) 340romfs_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd)
341{ 341{
342 unsigned long offset, maxoff; 342 unsigned long offset, maxoff;
343 int fslen, res; 343 long res;
344 struct inode *inode; 344 int fslen;
345 struct inode *inode = NULL;
345 char fsname[ROMFS_MAXFN]; /* XXX dynamic? */ 346 char fsname[ROMFS_MAXFN]; /* XXX dynamic? */
346 struct romfs_inode ri; 347 struct romfs_inode ri;
347 const char *name; /* got from dentry */ 348 const char *name; /* got from dentry */
@@ -351,7 +352,7 @@ romfs_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd)
351 offset = dir->i_ino & ROMFH_MASK; 352 offset = dir->i_ino & ROMFH_MASK;
352 lock_kernel(); 353 lock_kernel();
353 if (romfs_copyfrom(dir, &ri, offset, ROMFH_SIZE) <= 0) 354 if (romfs_copyfrom(dir, &ri, offset, ROMFH_SIZE) <= 0)
354 goto out; 355 goto error;
355 356
356 maxoff = romfs_maxsize(dir->i_sb); 357 maxoff = romfs_maxsize(dir->i_sb);
357 offset = be32_to_cpu(ri.spec) & ROMFH_MASK; 358 offset = be32_to_cpu(ri.spec) & ROMFH_MASK;
@@ -364,9 +365,9 @@ romfs_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd)
364 365
365 for(;;) { 366 for(;;) {
366 if (!offset || offset >= maxoff) 367 if (!offset || offset >= maxoff)
367 goto out0; 368 goto success; /* negative success */
368 if (romfs_copyfrom(dir, &ri, offset, ROMFH_SIZE) <= 0) 369 if (romfs_copyfrom(dir, &ri, offset, ROMFH_SIZE) <= 0)
369 goto out; 370 goto error;
370 371
371 /* try to match the first 16 bytes of name */ 372 /* try to match the first 16 bytes of name */
372 fslen = romfs_strnlen(dir, offset+ROMFH_SIZE, ROMFH_SIZE); 373 fslen = romfs_strnlen(dir, offset+ROMFH_SIZE, ROMFH_SIZE);
@@ -397,23 +398,14 @@ romfs_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd)
397 inode = romfs_iget(dir->i_sb, offset); 398 inode = romfs_iget(dir->i_sb, offset);
398 if (IS_ERR(inode)) { 399 if (IS_ERR(inode)) {
399 res = PTR_ERR(inode); 400 res = PTR_ERR(inode);
400 goto out; 401 goto error;
401 } 402 }
402 403
403 /* 404success:
404 * it's a bit funky, _lookup needs to return an error code 405 d_add(dentry, inode);
405 * (negative) or a NULL, both as a dentry. ENOENT should not
406 * be returned, instead we need to create a negative dentry by
407 * d_add(dentry, NULL); and return 0 as no error.
408 * (Although as I see, it only matters on writable file
409 * systems).
410 */
411
412out0: inode = NULL;
413 res = 0; 406 res = 0;
414 d_add (dentry, inode); 407error:
415 408 unlock_kernel();
416out: unlock_kernel();
417 return ERR_PTR(res); 409 return ERR_PTR(res);
418} 410}
419 411
diff --git a/fs/super.c b/fs/super.c
index 010446d8c40a..d0a941a4e620 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -556,11 +556,11 @@ out:
556} 556}
557 557
558/** 558/**
559 * mark_files_ro 559 * mark_files_ro - mark all files read-only
560 * @sb: superblock in question 560 * @sb: superblock in question
561 * 561 *
562 * All files are marked read/only. We don't care about pending 562 * All files are marked read-only. We don't care about pending
563 * delete files so this should be used in 'force' mode only 563 * delete files so this should be used in 'force' mode only.
564 */ 564 */
565 565
566static void mark_files_ro(struct super_block *sb) 566static void mark_files_ro(struct super_block *sb)
diff --git a/fs/ufs/balloc.c b/fs/ufs/balloc.c
index 1fca381f0ce2..1e7598fb9787 100644
--- a/fs/ufs/balloc.c
+++ b/fs/ufs/balloc.c
@@ -315,8 +315,8 @@ static void ufs_change_blocknr(struct inode *inode, sector_t beg,
315 } 315 }
316 316
317 UFSD(" change from %llu to %llu, pos %u\n", 317 UFSD(" change from %llu to %llu, pos %u\n",
318 (unsigned long long)pos + oldb, 318 (unsigned long long)(pos + oldb),
319 (unsigned long long)pos + newb, pos); 319 (unsigned long long)(pos + newb), pos);
320 320
321 bh->b_blocknr = newb + pos; 321 bh->b_blocknr = newb + pos;
322 unmap_underlying_metadata(bh->b_bdev, 322 unmap_underlying_metadata(bh->b_bdev,