aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorAnton Altaparmakov <aia21@cantab.net>2005-09-19 04:47:49 -0400
committerAnton Altaparmakov <aia21@cantab.net>2005-09-19 04:47:49 -0400
commit044a500e46742d39d22f1781cfb64ba93b463e39 (patch)
treeb0313211ea7ba26b90c1083ade0e4c9f486b87db /fs
parentf6098cf449b81c14a51e48dd22ae47d03126a1de (diff)
parent6c0741fbdee5bd0f8ed13ac287c4ab18e8ba7d83 (diff)
Merge branch 'master' of /home/src/linux-2.6/
Diffstat (limited to 'fs')
-rw-r--r--fs/aio.c1
-rw-r--r--fs/eventpoll.c40
-rw-r--r--fs/fat/file.c37
-rw-r--r--fs/fat/inode.c15
-rw-r--r--fs/locks.c3
-rw-r--r--fs/proc/array.c3
6 files changed, 43 insertions, 56 deletions
diff --git a/fs/aio.c b/fs/aio.c
index 38f62680fd63..0e11e31dbb77 100644
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -562,6 +562,7 @@ static inline void lock_kiocb(struct kiocb *iocb)
562static inline void unlock_kiocb(struct kiocb *iocb) 562static inline void unlock_kiocb(struct kiocb *iocb)
563{ 563{
564 kiocbClearLocked(iocb); 564 kiocbClearLocked(iocb);
565 smp_mb__after_clear_bit();
565 wake_up_bit(&iocb->ki_flags, KIF_LOCKED); 566 wake_up_bit(&iocb->ki_flags, KIF_LOCKED);
566} 567}
567 568
diff --git a/fs/eventpoll.c b/fs/eventpoll.c
index 6ab1dd0ca904..403b90a1213d 100644
--- a/fs/eventpoll.c
+++ b/fs/eventpoll.c
@@ -231,8 +231,9 @@ struct ep_pqueue {
231 231
232static void ep_poll_safewake_init(struct poll_safewake *psw); 232static void ep_poll_safewake_init(struct poll_safewake *psw);
233static void ep_poll_safewake(struct poll_safewake *psw, wait_queue_head_t *wq); 233static void ep_poll_safewake(struct poll_safewake *psw, wait_queue_head_t *wq);
234static int ep_getfd(int *efd, struct inode **einode, struct file **efile); 234static int ep_getfd(int *efd, struct inode **einode, struct file **efile,
235static int ep_file_init(struct file *file); 235 struct eventpoll *ep);
236static int ep_alloc(struct eventpoll **pep);
236static void ep_free(struct eventpoll *ep); 237static void ep_free(struct eventpoll *ep);
237static struct epitem *ep_find(struct eventpoll *ep, struct file *file, int fd); 238static struct epitem *ep_find(struct eventpoll *ep, struct file *file, int fd);
238static void ep_use_epitem(struct epitem *epi); 239static void ep_use_epitem(struct epitem *epi);
@@ -501,38 +502,37 @@ void eventpoll_release_file(struct file *file)
501asmlinkage long sys_epoll_create(int size) 502asmlinkage long sys_epoll_create(int size)
502{ 503{
503 int error, fd; 504 int error, fd;
505 struct eventpoll *ep;
504 struct inode *inode; 506 struct inode *inode;
505 struct file *file; 507 struct file *file;
506 508
507 DNPRINTK(3, (KERN_INFO "[%p] eventpoll: sys_epoll_create(%d)\n", 509 DNPRINTK(3, (KERN_INFO "[%p] eventpoll: sys_epoll_create(%d)\n",
508 current, size)); 510 current, size));
509 511
510 /* Sanity check on the size parameter */ 512 /*
513 * Sanity check on the size parameter, and create the internal data
514 * structure ( "struct eventpoll" ).
515 */
511 error = -EINVAL; 516 error = -EINVAL;
512 if (size <= 0) 517 if (size <= 0 || (error = ep_alloc(&ep)) != 0)
513 goto eexit_1; 518 goto eexit_1;
514 519
515 /* 520 /*
516 * Creates all the items needed to setup an eventpoll file. That is, 521 * Creates all the items needed to setup an eventpoll file. That is,
517 * a file structure, and inode and a free file descriptor. 522 * a file structure, and inode and a free file descriptor.
518 */ 523 */
519 error = ep_getfd(&fd, &inode, &file); 524 error = ep_getfd(&fd, &inode, &file, ep);
520 if (error)
521 goto eexit_1;
522
523 /* Setup the file internal data structure ( "struct eventpoll" ) */
524 error = ep_file_init(file);
525 if (error) 525 if (error)
526 goto eexit_2; 526 goto eexit_2;
527 527
528
529 DNPRINTK(3, (KERN_INFO "[%p] eventpoll: sys_epoll_create(%d) = %d\n", 528 DNPRINTK(3, (KERN_INFO "[%p] eventpoll: sys_epoll_create(%d) = %d\n",
530 current, size, fd)); 529 current, size, fd));
531 530
532 return fd; 531 return fd;
533 532
534eexit_2: 533eexit_2:
535 sys_close(fd); 534 ep_free(ep);
535 kfree(ep);
536eexit_1: 536eexit_1:
537 DNPRINTK(3, (KERN_INFO "[%p] eventpoll: sys_epoll_create(%d) = %d\n", 537 DNPRINTK(3, (KERN_INFO "[%p] eventpoll: sys_epoll_create(%d) = %d\n",
538 current, size, error)); 538 current, size, error));
@@ -706,7 +706,8 @@ eexit_1:
706/* 706/*
707 * Creates the file descriptor to be used by the epoll interface. 707 * Creates the file descriptor to be used by the epoll interface.
708 */ 708 */
709static int ep_getfd(int *efd, struct inode **einode, struct file **efile) 709static int ep_getfd(int *efd, struct inode **einode, struct file **efile,
710 struct eventpoll *ep)
710{ 711{
711 struct qstr this; 712 struct qstr this;
712 char name[32]; 713 char name[32];
@@ -756,7 +757,7 @@ static int ep_getfd(int *efd, struct inode **einode, struct file **efile)
756 file->f_op = &eventpoll_fops; 757 file->f_op = &eventpoll_fops;
757 file->f_mode = FMODE_READ; 758 file->f_mode = FMODE_READ;
758 file->f_version = 0; 759 file->f_version = 0;
759 file->private_data = NULL; 760 file->private_data = ep;
760 761
761 /* Install the new setup file into the allocated fd. */ 762 /* Install the new setup file into the allocated fd. */
762 fd_install(fd, file); 763 fd_install(fd, file);
@@ -777,14 +778,13 @@ eexit_1:
777} 778}
778 779
779 780
780static int ep_file_init(struct file *file) 781static int ep_alloc(struct eventpoll **pep)
781{ 782{
782 struct eventpoll *ep; 783 struct eventpoll *ep = kzalloc(sizeof(*ep), GFP_KERNEL);
783 784
784 if (!(ep = kmalloc(sizeof(struct eventpoll), GFP_KERNEL))) 785 if (!ep)
785 return -ENOMEM; 786 return -ENOMEM;
786 787
787 memset(ep, 0, sizeof(*ep));
788 rwlock_init(&ep->lock); 788 rwlock_init(&ep->lock);
789 init_rwsem(&ep->sem); 789 init_rwsem(&ep->sem);
790 init_waitqueue_head(&ep->wq); 790 init_waitqueue_head(&ep->wq);
@@ -792,9 +792,9 @@ static int ep_file_init(struct file *file)
792 INIT_LIST_HEAD(&ep->rdllist); 792 INIT_LIST_HEAD(&ep->rdllist);
793 ep->rbr = RB_ROOT; 793 ep->rbr = RB_ROOT;
794 794
795 file->private_data = ep; 795 *pep = ep;
796 796
797 DNPRINTK(3, (KERN_INFO "[%p] eventpoll: ep_file_init() ep=%p\n", 797 DNPRINTK(3, (KERN_INFO "[%p] eventpoll: ep_alloc() ep=%p\n",
798 current, ep)); 798 current, ep));
799 return 0; 799 return 0;
800} 800}
diff --git a/fs/fat/file.c b/fs/fat/file.c
index 62ffa9139400..7134403d5be2 100644
--- a/fs/fat/file.c
+++ b/fs/fat/file.c
@@ -12,39 +12,6 @@
12#include <linux/smp_lock.h> 12#include <linux/smp_lock.h>
13#include <linux/buffer_head.h> 13#include <linux/buffer_head.h>
14 14
15static ssize_t fat_file_aio_write(struct kiocb *iocb, const char __user *buf,
16 size_t count, loff_t pos)
17{
18 struct inode *inode = iocb->ki_filp->f_dentry->d_inode;
19 int retval;
20
21 retval = generic_file_aio_write(iocb, buf, count, pos);
22 if (retval > 0) {
23 inode->i_mtime = inode->i_ctime = CURRENT_TIME_SEC;
24 MSDOS_I(inode)->i_attrs |= ATTR_ARCH;
25 mark_inode_dirty(inode);
26// check the locking rules
27// if (IS_SYNC(inode))
28// fat_sync_inode(inode);
29 }
30 return retval;
31}
32
33static ssize_t fat_file_writev(struct file *filp, const struct iovec *iov,
34 unsigned long nr_segs, loff_t *ppos)
35{
36 struct inode *inode = filp->f_dentry->d_inode;
37 int retval;
38
39 retval = generic_file_writev(filp, iov, nr_segs, ppos);
40 if (retval > 0) {
41 inode->i_mtime = inode->i_ctime = CURRENT_TIME_SEC;
42 MSDOS_I(inode)->i_attrs |= ATTR_ARCH;
43 mark_inode_dirty(inode);
44 }
45 return retval;
46}
47
48int fat_generic_ioctl(struct inode *inode, struct file *filp, 15int fat_generic_ioctl(struct inode *inode, struct file *filp,
49 unsigned int cmd, unsigned long arg) 16 unsigned int cmd, unsigned long arg)
50{ 17{
@@ -148,9 +115,9 @@ struct file_operations fat_file_operations = {
148 .read = do_sync_read, 115 .read = do_sync_read,
149 .write = do_sync_write, 116 .write = do_sync_write,
150 .readv = generic_file_readv, 117 .readv = generic_file_readv,
151 .writev = fat_file_writev, 118 .writev = generic_file_writev,
152 .aio_read = generic_file_aio_read, 119 .aio_read = generic_file_aio_read,
153 .aio_write = fat_file_aio_write, 120 .aio_write = generic_file_aio_write,
154 .mmap = generic_file_mmap, 121 .mmap = generic_file_mmap,
155 .ioctl = fat_generic_ioctl, 122 .ioctl = fat_generic_ioctl,
156 .fsync = file_fsync, 123 .fsync = file_fsync,
diff --git a/fs/fat/inode.c b/fs/fat/inode.c
index a7cbe68e2259..51b1d15d9d5c 100644
--- a/fs/fat/inode.c
+++ b/fs/fat/inode.c
@@ -102,6 +102,19 @@ static int fat_prepare_write(struct file *file, struct page *page,
102 &MSDOS_I(page->mapping->host)->mmu_private); 102 &MSDOS_I(page->mapping->host)->mmu_private);
103} 103}
104 104
105static int fat_commit_write(struct file *file, struct page *page,
106 unsigned from, unsigned to)
107{
108 struct inode *inode = page->mapping->host;
109 int err = generic_commit_write(file, page, from, to);
110 if (!err && !(MSDOS_I(inode)->i_attrs & ATTR_ARCH)) {
111 inode->i_mtime = inode->i_ctime = CURRENT_TIME_SEC;
112 MSDOS_I(inode)->i_attrs |= ATTR_ARCH;
113 mark_inode_dirty(inode);
114 }
115 return err;
116}
117
105static sector_t _fat_bmap(struct address_space *mapping, sector_t block) 118static sector_t _fat_bmap(struct address_space *mapping, sector_t block)
106{ 119{
107 return generic_block_bmap(mapping, block, fat_get_block); 120 return generic_block_bmap(mapping, block, fat_get_block);
@@ -112,7 +125,7 @@ static struct address_space_operations fat_aops = {
112 .writepage = fat_writepage, 125 .writepage = fat_writepage,
113 .sync_page = block_sync_page, 126 .sync_page = block_sync_page,
114 .prepare_write = fat_prepare_write, 127 .prepare_write = fat_prepare_write,
115 .commit_write = generic_commit_write, 128 .commit_write = fat_commit_write,
116 .bmap = _fat_bmap 129 .bmap = _fat_bmap
117}; 130};
118 131
diff --git a/fs/locks.c b/fs/locks.c
index c2c09b4798d6..f7daa5f48949 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -124,6 +124,7 @@
124#include <linux/smp_lock.h> 124#include <linux/smp_lock.h>
125#include <linux/syscalls.h> 125#include <linux/syscalls.h>
126#include <linux/time.h> 126#include <linux/time.h>
127#include <linux/rcupdate.h>
127 128
128#include <asm/semaphore.h> 129#include <asm/semaphore.h>
129#include <asm/uaccess.h> 130#include <asm/uaccess.h>
@@ -2205,6 +2206,7 @@ void steal_locks(fl_owner_t from)
2205 2206
2206 lock_kernel(); 2207 lock_kernel();
2207 j = 0; 2208 j = 0;
2209 rcu_read_lock();
2208 fdt = files_fdtable(files); 2210 fdt = files_fdtable(files);
2209 for (;;) { 2211 for (;;) {
2210 unsigned long set; 2212 unsigned long set;
@@ -2222,6 +2224,7 @@ void steal_locks(fl_owner_t from)
2222 set >>= 1; 2224 set >>= 1;
2223 } 2225 }
2224 } 2226 }
2227 rcu_read_unlock();
2225 unlock_kernel(); 2228 unlock_kernel();
2226} 2229}
2227EXPORT_SYMBOL(steal_locks); 2230EXPORT_SYMBOL(steal_locks);
diff --git a/fs/proc/array.c b/fs/proc/array.c
index d88d518d30f6..d84eecacbeaf 100644
--- a/fs/proc/array.c
+++ b/fs/proc/array.c
@@ -74,6 +74,7 @@
74#include <linux/file.h> 74#include <linux/file.h>
75#include <linux/times.h> 75#include <linux/times.h>
76#include <linux/cpuset.h> 76#include <linux/cpuset.h>
77#include <linux/rcupdate.h>
77 78
78#include <asm/uaccess.h> 79#include <asm/uaccess.h>
79#include <asm/pgtable.h> 80#include <asm/pgtable.h>
@@ -180,12 +181,14 @@ static inline char * task_state(struct task_struct *p, char *buffer)
180 p->gid, p->egid, p->sgid, p->fsgid); 181 p->gid, p->egid, p->sgid, p->fsgid);
181 read_unlock(&tasklist_lock); 182 read_unlock(&tasklist_lock);
182 task_lock(p); 183 task_lock(p);
184 rcu_read_lock();
183 if (p->files) 185 if (p->files)
184 fdt = files_fdtable(p->files); 186 fdt = files_fdtable(p->files);
185 buffer += sprintf(buffer, 187 buffer += sprintf(buffer,
186 "FDSize:\t%d\n" 188 "FDSize:\t%d\n"
187 "Groups:\t", 189 "Groups:\t",
188 fdt ? fdt->max_fds : 0); 190 fdt ? fdt->max_fds : 0);
191 rcu_read_unlock();
189 192
190 group_info = p->group_info; 193 group_info = p->group_info;
191 get_group_info(group_info); 194 get_group_info(group_info);