v2.6.22.23-op1
[linux-2.6.22.y-op-patches.git] / patch-2.6.22.y / incr / patch-v2.6.22.22-op1-v2.6.22.23-op1
blob0d86a196a71fdd0cadeb290639c27e4af7b01281
1 diff --git a/Makefile b/Makefile
2 index 7200160..d001959 100644
3 --- a/Makefile
4 +++ b/Makefile
5 @@ -1,7 +1,7 @@
6  VERSION = 2
7  PATCHLEVEL = 6
8  SUBLEVEL = 22
9 -EXTRAVERSION = .22-op1
10 +EXTRAVERSION = .23-op1
11  NAME = Holy Dancing Manatees, Batman!
13  # *DOCUMENTATION*
14 diff --git a/fs/aio.c b/fs/aio.c
15 index b3419c5..e683b91 100644
16 --- a/fs/aio.c
17 +++ b/fs/aio.c
18 @@ -1171,7 +1171,12 @@ retry:
19                         ret = 0;
20                         if (to.timed_out)       /* Only check after read evt */
21                                 break;
22 -                       io_schedule();
23 +                       /* Try to only show up in io wait if there are ops
24 +                        *  in flight */
25 +                       if (ctx->reqs_active)
26 +                               io_schedule();
27 +                       else
28 +                               schedule();
29                         if (signal_pending(tsk)) {
30                                 ret = -EINTR;
31                                 break;
32 diff --git a/fs/locks.c b/fs/locks.c
33 index 6428605..e6d4c3b 100644
34 --- a/fs/locks.c
35 +++ b/fs/locks.c
36 @@ -1733,6 +1733,7 @@ int fcntl_setlk(unsigned int fd, struct file *filp, unsigned int cmd,
37         struct file_lock *file_lock = locks_alloc_lock();
38         struct flock flock;
39         struct inode *inode;
40 +       struct file *f;
41         int error;
43         if (file_lock == NULL)
44 @@ -1803,7 +1804,15 @@ again:
45          * Attempt to detect a close/fcntl race and recover by
46          * releasing the lock that was just acquired.
47          */
48 -       if (!error && fcheck(fd) != filp && flock.l_type != F_UNLCK) {
49 +       /*
50 +        * we need that spin_lock here - it prevents reordering between
51 +        * update of inode->i_flock and check for it done in close().
52 +        * rcu_read_lock() wouldn't do.
53 +        */
54 +       spin_lock(&current->files->file_lock);
55 +       f = fcheck(fd);
56 +       spin_unlock(&current->files->file_lock);
57 +       if (!error && f != filp && flock.l_type != F_UNLCK) {
58                 flock.l_type = F_UNLCK;
59                 goto again;
60         }
61 @@ -1859,6 +1868,7 @@ int fcntl_setlk64(unsigned int fd, struct file *filp, unsigned int cmd,
62         struct file_lock *file_lock = locks_alloc_lock();
63         struct flock64 flock;
64         struct inode *inode;
65 +       struct file *f;
66         int error;
68         if (file_lock == NULL)
69 @@ -1929,7 +1939,10 @@ again:
70          * Attempt to detect a close/fcntl race and recover by
71          * releasing the lock that was just acquired.
72          */
73 -       if (!error && fcheck(fd) != filp && flock.l_type != F_UNLCK) {
74 +       spin_lock(&current->files->file_lock);
75 +       f = fcheck(fd);
76 +       spin_unlock(&current->files->file_lock);
77 +       if (!error && f != filp && flock.l_type != F_UNLCK) {
78                 flock.l_type = F_UNLCK;
79                 goto again;
80         }