v2.6.22.22-op1-rc1
[linux-2.6.22.y-op-patches.git] / patch-2.6.22.y / rc / patch-v2.6.22.21-op1-v2.6.22.22-op1-rc1
bloba42c095248da2aefa4f15a21b385d201c44cba9a
1 diff --git a/Makefile b/Makefile
2 index b5f32ce..3b1515e 100644
3 --- a/Makefile
4 +++ b/Makefile
5 @@ -1,7 +1,7 @@
6  VERSION = 2
7  PATCHLEVEL = 6
8  SUBLEVEL = 22
9 -EXTRAVERSION = .21-op1
10 +EXTRAVERSION = .22-op1-rc1
11  NAME = Holy Dancing Manatees, Batman!
13  # *DOCUMENTATION*
14 diff --git a/drivers/net/tulip/de2104x.c b/drivers/net/tulip/de2104x.c
15 index 8617298..e8fcce7 100644
16 --- a/drivers/net/tulip/de2104x.c
17 +++ b/drivers/net/tulip/de2104x.c
18 @@ -843,7 +843,7 @@ static inline int de_is_running (struct de_private *de)
19  static void de_stop_rxtx (struct de_private *de)
20  {
21         u32 macmode;
22 -       unsigned int work = 1000;
23 +       unsigned int i = 1300/100;
25         macmode = dr32(MacMode);
26         if (macmode & RxTx) {
27 @@ -851,10 +851,14 @@ static void de_stop_rxtx (struct de_private *de)
28                 dr32(MacMode);
29         }
31 -       while (--work > 0) {
32 +       /* wait until in-flight frame completes.
33 +        * Max time @ 10BT: 1500*8b/10Mbps == 1200us (+ 100us margin)
34 +        * Typically expect this loop to end in < 50 us on 100BT.
35 +        */
36 +       while (--i) {
37                 if (!de_is_running(de))
38                         return;
39 -               cpu_relax();
40 +               udelay(100);
41         }
43         printk(KERN_WARNING "%s: timeout expired stopping DMA\n", de->dev->name);
44 diff --git a/fs/aio.c b/fs/aio.c
45 index dbe699e..b3419c5 100644
46 --- a/fs/aio.c
47 +++ b/fs/aio.c
48 @@ -303,7 +303,7 @@ static void wait_for_all_aios(struct kioctx *ctx)
49         set_task_state(tsk, TASK_UNINTERRUPTIBLE);
50         while (ctx->reqs_active) {
51                 spin_unlock_irq(&ctx->ctx_lock);
52 -               schedule();
53 +               io_schedule();
54                 set_task_state(tsk, TASK_UNINTERRUPTIBLE);
55                 spin_lock_irq(&ctx->ctx_lock);
56         }
57 @@ -323,7 +323,7 @@ ssize_t fastcall wait_on_sync_kiocb(struct kiocb *iocb)
58                 set_current_state(TASK_UNINTERRUPTIBLE);
59                 if (!iocb->ki_users)
60                         break;
61 -               schedule();
62 +               io_schedule();
63         }
64         __set_current_state(TASK_RUNNING);
65         return iocb->ki_user_data;
66 @@ -946,14 +946,6 @@ int fastcall aio_complete(struct kiocb *iocb, long res, long res2)
67                 return 1;
68         }
70 -       /*
71 -        * Check if the user asked us to deliver the result through an
72 -        * eventfd. The eventfd_signal() function is safe to be called
73 -        * from IRQ context.
74 -        */
75 -       if (!IS_ERR(iocb->ki_eventfd))
76 -               eventfd_signal(iocb->ki_eventfd, 1);
78         info = &ctx->ring_info;
80         /* add a completion event to the ring buffer.
81 @@ -1002,6 +994,15 @@ int fastcall aio_complete(struct kiocb *iocb, long res, long res2)
82         kunmap_atomic(ring, KM_IRQ1);
84         pr_debug("added to ring %p at [%lu]\n", iocb, tail);
86 +       /*
87 +        * Check if the user asked us to deliver the result through an
88 +        * eventfd. The eventfd_signal() function is safe to be called
89 +        * from IRQ context.
90 +        */
91 +       if (!IS_ERR(iocb->ki_eventfd))
92 +               eventfd_signal(iocb->ki_eventfd, 1);
94  put_rq:
95         /* everything turned out well, dispose of the aiocb. */
96         ret = __aio_put_req(ctx, iocb);
97 @@ -1170,7 +1171,7 @@ retry:
98                         ret = 0;
99                         if (to.timed_out)       /* Only check after read evt */
100                                 break;
101 -                       schedule();
102 +                       io_schedule();
103                         if (signal_pending(tsk)) {
104                                 ret = -EINTR;
105                                 break;
106 diff --git a/fs/dcache.c b/fs/dcache.c
107 index 0e73aa0..c54dc50 100644
108 --- a/fs/dcache.c
109 +++ b/fs/dcache.c
110 @@ -1407,9 +1407,6 @@ void d_delete(struct dentry * dentry)
111         if (atomic_read(&dentry->d_count) == 1) {
112                 dentry_iput(dentry);
113                 fsnotify_nameremove(dentry, isdir);
115 -               /* remove this and other inotify debug checks after 2.6.18 */
116 -               dentry->d_flags &= ~DCACHE_INOTIFY_PARENT_WATCHED;
117                 return;
118         }
120 diff --git a/fs/inotify.c b/fs/inotify.c
121 index 7457501..8ee2b43 100644
122 --- a/fs/inotify.c
123 +++ b/fs/inotify.c
124 @@ -168,20 +168,14 @@ static void set_dentry_child_flags(struct inode *inode, int watched)
125                 struct dentry *child;
127                 list_for_each_entry(child, &alias->d_subdirs, d_u.d_child) {
128 -                       if (!child->d_inode) {
129 -                               WARN_ON(child->d_flags & DCACHE_INOTIFY_PARENT_WATCHED);
130 +                       if (!child->d_inode)
131                                 continue;
132 -                       }
134                         spin_lock(&child->d_lock);
135 -                       if (watched) {
136 -                               WARN_ON(child->d_flags &
137 -                                               DCACHE_INOTIFY_PARENT_WATCHED);
138 +                       if (watched)
139                                 child->d_flags |= DCACHE_INOTIFY_PARENT_WATCHED;
140 -                       } else {
141 -                               WARN_ON(!(child->d_flags &
142 -                                       DCACHE_INOTIFY_PARENT_WATCHED));
143 -                               child->d_flags&=~DCACHE_INOTIFY_PARENT_WATCHED;
144 -                       }
145 +                       else
146 +                               child->d_flags &=~DCACHE_INOTIFY_PARENT_WATCHED;
147                         spin_unlock(&child->d_lock);
148                 }
149         }
150 @@ -253,7 +247,6 @@ void inotify_d_instantiate(struct dentry *entry, struct inode *inode)
151         if (!inode)
152                 return;
154 -       WARN_ON(entry->d_flags & DCACHE_INOTIFY_PARENT_WATCHED);
155         spin_lock(&entry->d_lock);
156         parent = entry->d_parent;
157         if (parent->d_inode && inotify_inode_watched(parent->d_inode))
158 @@ -627,6 +620,7 @@ s32 inotify_add_watch(struct inotify_handle *ih, struct inotify_watch *watch,
159                       struct inode *inode, u32 mask)
161         int ret = 0;
162 +       int newly_watched;
164         /* don't allow invalid bits: we don't want flags set */
165         mask &= IN_ALL_EVENTS | IN_ONESHOT;
166 @@ -653,12 +647,18 @@ s32 inotify_add_watch(struct inotify_handle *ih, struct inotify_watch *watch,
167          */
168         watch->inode = igrab(inode);
170 -       if (!inotify_inode_watched(inode))
171 -               set_dentry_child_flags(inode, 1);
173         /* Add the watch to the handle's and the inode's list */
174 +       newly_watched = !inotify_inode_watched(inode);
175         list_add(&watch->h_list, &ih->watches);
176         list_add(&watch->i_list, &inode->inotify_watches);
177 +       /*
178 +        * Set child flags _after_ adding the watch, so there is no race
179 +        * windows where newly instantiated children could miss their parent's
180 +        * watched flag.
181 +        */
182 +       if (newly_watched)
183 +               set_dentry_child_flags(inode, 1);
185  out:
186         mutex_unlock(&ih->mutex);
187         mutex_unlock(&inode->inotify_mutex);
188 diff --git a/fs/splice.c b/fs/splice.c
189 index dbbe267..3da87fe 100644
190 --- a/fs/splice.c
191 +++ b/fs/splice.c
192 @@ -28,6 +28,7 @@
193  #include <linux/module.h>
194  #include <linux/syscalls.h>
195  #include <linux/uio.h>
196 +#include <linux/security.h>
198  struct partial_page {
199         unsigned int offset;
200 @@ -331,7 +332,7 @@ __generic_file_splice_read(struct file *in, loff_t *ppos,
201                                 break;
203                         error = add_to_page_cache_lru(page, mapping, index,
204 -                                             GFP_KERNEL);
205 +                                               mapping_gfp_mask(mapping));
206                         if (unlikely(error)) {
207                                 page_cache_release(page);
208                                 if (error == -EEXIST)
209 @@ -932,6 +933,10 @@ static long do_splice_from(struct pipe_inode_info *pipe, struct file *out,
210         if (unlikely(ret < 0))
211                 return ret;
213 +       ret = security_file_permission(out, MAY_WRITE);
214 +       if (unlikely(ret < 0))
215 +               return ret;
217         return out->f_op->splice_write(pipe, out, ppos, len, flags);
220 @@ -954,6 +959,10 @@ static long do_splice_to(struct file *in, loff_t *ppos,
221         if (unlikely(ret < 0))
222                 return ret;
224 +       ret = security_file_permission(in, MAY_READ);
225 +       if (unlikely(ret < 0))
226 +               return ret;
228         return in->f_op->splice_read(in, ppos, pipe, len, flags);
231 @@ -1489,6 +1498,13 @@ static int link_pipe(struct pipe_inode_info *ipipe,
232                 i++;
233         } while (len);
235 +       /*
236 +        * return EAGAIN if we have the potential of some data in the
237 +        * future, otherwise just return 0
238 +        */
239 +       if (!ret && ipipe->waiting_writers && (flags & SPLICE_F_NONBLOCK))
240 +               ret = -EAGAIN;
242         inode_double_unlock(ipipe->inode, opipe->inode);
244         /*
245 @@ -1529,11 +1545,8 @@ static long do_tee(struct file *in, struct file *out, size_t len,
246                 ret = link_ipipe_prep(ipipe, flags);
247                 if (!ret) {
248                         ret = link_opipe_prep(opipe, flags);
249 -                       if (!ret) {
250 +                       if (!ret)
251                                 ret = link_pipe(ipipe, opipe, len, flags);
252 -                               if (!ret && (flags & SPLICE_F_NONBLOCK))
253 -                                       ret = -EAGAIN;
254 -                       }
255                 }
256         }
258 diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
259 index eee57e6..de6e5df 100644
260 --- a/net/ipv4/tcp_output.c
261 +++ b/net/ipv4/tcp_output.c
262 @@ -246,7 +246,7 @@ static u16 tcp_select_window(struct sock *sk)
263                  *
264                  * Relax Will Robinson.
265                  */
266 -               new_win = cur_win;
267 +               new_win = ALIGN(cur_win, 1 << tp->rx_opt.rcv_wscale);
268         }
269         tp->rcv_wnd = new_win;
270         tp->rcv_wup = tp->rcv_nxt;