Magellan Linux

Contents of /trunk/kernel26-alx/patches-2.6.17-r7/0103-2.6.17.10-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 199 - (show annotations) (download)
Fri May 18 11:04:36 2007 UTC (16 years, 11 months ago) by niro
File size: 8765 byte(s)
-import

1 diff --git a/block/elevator.c b/block/elevator.c
2 index a0afdd3..7be96bb 100644
3 --- a/block/elevator.c
4 +++ b/block/elevator.c
5 @@ -766,7 +766,8 @@ void elv_unregister(struct elevator_type
6 read_lock(&tasklist_lock);
7 do_each_thread(g, p) {
8 task_lock(p);
9 - e->ops.trim(p->io_context);
10 + if (p->io_context)
11 + e->ops.trim(p->io_context);
12 task_unlock(p);
13 } while_each_thread(g, p);
14 read_unlock(&tasklist_lock);
15 diff --git a/fs/udf/super.c b/fs/udf/super.c
16 index e45789f..73fc0d8 100644
17 --- a/fs/udf/super.c
18 +++ b/fs/udf/super.c
19 @@ -1653,7 +1653,7 @@ #endif
20 iput(inode);
21 goto error_out;
22 }
23 - sb->s_maxbytes = MAX_LFS_FILESIZE;
24 + sb->s_maxbytes = 1<<30;
25 return 0;
26
27 error_out:
28 diff --git a/fs/udf/truncate.c b/fs/udf/truncate.c
29 index e1b0e8c..0abd66c 100644
30 --- a/fs/udf/truncate.c
31 +++ b/fs/udf/truncate.c
32 @@ -239,37 +239,51 @@ void udf_truncate_extents(struct inode *
33 {
34 if (offset)
35 {
36 - extoffset -= adsize;
37 - etype = udf_next_aext(inode, &bloc, &extoffset, &eloc, &elen, &bh, 1);
38 - if (etype == (EXT_NOT_RECORDED_NOT_ALLOCATED >> 30))
39 - {
40 - extoffset -= adsize;
41 - elen = EXT_NOT_RECORDED_NOT_ALLOCATED | (elen + offset);
42 - udf_write_aext(inode, bloc, &extoffset, eloc, elen, bh, 0);
43 + /*
44 + * OK, there is not extent covering inode->i_size and
45 + * no extent above inode->i_size => truncate is
46 + * extending the file by 'offset'.
47 + */
48 + if ((!bh && extoffset == udf_file_entry_alloc_offset(inode)) ||
49 + (bh && extoffset == sizeof(struct allocExtDesc))) {
50 + /* File has no extents at all! */
51 + memset(&eloc, 0x00, sizeof(kernel_lb_addr));
52 + elen = EXT_NOT_RECORDED_NOT_ALLOCATED | offset;
53 + udf_add_aext(inode, &bloc, &extoffset, eloc, elen, &bh, 1);
54 }
55 - else if (etype == (EXT_NOT_RECORDED_ALLOCATED >> 30))
56 - {
57 - kernel_lb_addr neloc = { 0, 0 };
58 + else {
59 extoffset -= adsize;
60 - nelen = EXT_NOT_RECORDED_NOT_ALLOCATED |
61 - ((elen + offset + inode->i_sb->s_blocksize - 1) &
62 - ~(inode->i_sb->s_blocksize - 1));
63 - udf_write_aext(inode, bloc, &extoffset, neloc, nelen, bh, 1);
64 - udf_add_aext(inode, &bloc, &extoffset, eloc, (etype << 30) | elen, &bh, 1);
65 - }
66 - else
67 - {
68 - if (elen & (inode->i_sb->s_blocksize - 1))
69 + etype = udf_next_aext(inode, &bloc, &extoffset, &eloc, &elen, &bh, 1);
70 + if (etype == (EXT_NOT_RECORDED_NOT_ALLOCATED >> 30))
71 + {
72 + extoffset -= adsize;
73 + elen = EXT_NOT_RECORDED_NOT_ALLOCATED | (elen + offset);
74 + udf_write_aext(inode, bloc, &extoffset, eloc, elen, bh, 0);
75 + }
76 + else if (etype == (EXT_NOT_RECORDED_ALLOCATED >> 30))
77 {
78 + kernel_lb_addr neloc = { 0, 0 };
79 extoffset -= adsize;
80 - elen = EXT_RECORDED_ALLOCATED |
81 - ((elen + inode->i_sb->s_blocksize - 1) &
82 + nelen = EXT_NOT_RECORDED_NOT_ALLOCATED |
83 + ((elen + offset + inode->i_sb->s_blocksize - 1) &
84 ~(inode->i_sb->s_blocksize - 1));
85 - udf_write_aext(inode, bloc, &extoffset, eloc, elen, bh, 1);
86 + udf_write_aext(inode, bloc, &extoffset, neloc, nelen, bh, 1);
87 + udf_add_aext(inode, &bloc, &extoffset, eloc, (etype << 30) | elen, &bh, 1);
88 + }
89 + else
90 + {
91 + if (elen & (inode->i_sb->s_blocksize - 1))
92 + {
93 + extoffset -= adsize;
94 + elen = EXT_RECORDED_ALLOCATED |
95 + ((elen + inode->i_sb->s_blocksize - 1) &
96 + ~(inode->i_sb->s_blocksize - 1));
97 + udf_write_aext(inode, bloc, &extoffset, eloc, elen, bh, 1);
98 + }
99 + memset(&eloc, 0x00, sizeof(kernel_lb_addr));
100 + elen = EXT_NOT_RECORDED_NOT_ALLOCATED | offset;
101 + udf_add_aext(inode, &bloc, &extoffset, eloc, elen, &bh, 1);
102 }
103 - memset(&eloc, 0x00, sizeof(kernel_lb_addr));
104 - elen = EXT_NOT_RECORDED_NOT_ALLOCATED | offset;
105 - udf_add_aext(inode, &bloc, &extoffset, eloc, elen, &bh, 1);
106 }
107 }
108 }
109 diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
110 index aa6033c..225dcea 100644
111 --- a/include/net/sctp/sctp.h
112 +++ b/include/net/sctp/sctp.h
113 @@ -405,19 +405,6 @@ static inline int sctp_list_single_entry
114 return ((head->next != head) && (head->next == head->prev));
115 }
116
117 -/* Calculate the size (in bytes) occupied by the data of an iovec. */
118 -static inline size_t get_user_iov_size(struct iovec *iov, int iovlen)
119 -{
120 - size_t retval = 0;
121 -
122 - for (; iovlen > 0; --iovlen) {
123 - retval += iov->iov_len;
124 - iov++;
125 - }
126 -
127 - return retval;
128 -}
129 -
130 /* Generate a random jitter in the range of -50% ~ +50% of input RTO. */
131 static inline __s32 sctp_jitter(__u32 rto)
132 {
133 diff --git a/include/net/sctp/sm.h b/include/net/sctp/sm.h
134 index 1eac3d0..de313de 100644
135 --- a/include/net/sctp/sm.h
136 +++ b/include/net/sctp/sm.h
137 @@ -221,8 +221,7 @@ struct sctp_chunk *sctp_make_abort_no_da
138 const struct sctp_chunk *,
139 __u32 tsn);
140 struct sctp_chunk *sctp_make_abort_user(const struct sctp_association *,
141 - const struct sctp_chunk *,
142 - const struct msghdr *);
143 + const struct msghdr *, size_t msg_len);
144 struct sctp_chunk *sctp_make_abort_violation(const struct sctp_association *,
145 const struct sctp_chunk *,
146 const __u8 *,
147 diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
148 index 5e0de3c..b9b9070 100644
149 --- a/net/sctp/sm_make_chunk.c
150 +++ b/net/sctp/sm_make_chunk.c
151 @@ -806,38 +806,26 @@ no_mem:
152
153 /* Helper to create ABORT with a SCTP_ERROR_USER_ABORT error. */
154 struct sctp_chunk *sctp_make_abort_user(const struct sctp_association *asoc,
155 - const struct sctp_chunk *chunk,
156 - const struct msghdr *msg)
157 + const struct msghdr *msg,
158 + size_t paylen)
159 {
160 struct sctp_chunk *retval;
161 - void *payload = NULL, *payoff;
162 - size_t paylen = 0;
163 - struct iovec *iov = NULL;
164 - int iovlen = 0;
165 -
166 - if (msg) {
167 - iov = msg->msg_iov;
168 - iovlen = msg->msg_iovlen;
169 - paylen = get_user_iov_size(iov, iovlen);
170 - }
171 + void *payload = NULL;
172 + int err;
173
174 - retval = sctp_make_abort(asoc, chunk, sizeof(sctp_errhdr_t) + paylen);
175 + retval = sctp_make_abort(asoc, NULL, sizeof(sctp_errhdr_t) + paylen);
176 if (!retval)
177 goto err_chunk;
178
179 if (paylen) {
180 /* Put the msg_iov together into payload. */
181 - payload = kmalloc(paylen, GFP_ATOMIC);
182 + payload = kmalloc(paylen, GFP_KERNEL);
183 if (!payload)
184 goto err_payload;
185 - payoff = payload;
186
187 - for (; iovlen > 0; --iovlen) {
188 - if (copy_from_user(payoff, iov->iov_base,iov->iov_len))
189 - goto err_copy;
190 - payoff += iov->iov_len;
191 - iov++;
192 - }
193 + err = memcpy_fromiovec(payload, msg->msg_iov, paylen);
194 + if (err < 0)
195 + goto err_copy;
196 }
197
198 sctp_init_cause(retval, SCTP_ERROR_USER_ABORT, payload, paylen);
199 diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c
200 index 9e58144..66e9c5b 100644
201 --- a/net/sctp/sm_statefuns.c
202 +++ b/net/sctp/sm_statefuns.c
203 @@ -4026,18 +4026,12 @@ sctp_disposition_t sctp_sf_do_9_1_prm_ab
204 * from its upper layer, but retransmits data to the far end
205 * if necessary to fill gaps.
206 */
207 - struct msghdr *msg = arg;
208 - struct sctp_chunk *abort;
209 + struct sctp_chunk *abort = arg;
210 sctp_disposition_t retval;
211
212 retval = SCTP_DISPOSITION_CONSUME;
213
214 - /* Generate ABORT chunk to send the peer. */
215 - abort = sctp_make_abort_user(asoc, NULL, msg);
216 - if (!abort)
217 - retval = SCTP_DISPOSITION_NOMEM;
218 - else
219 - sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(abort));
220 + sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(abort));
221
222 /* Even if we can't send the ABORT due to low memory delete the
223 * TCB. This is a departure from our typical NOMEM handling.
224 @@ -4161,8 +4155,7 @@ sctp_disposition_t sctp_sf_cookie_wait_p
225 void *arg,
226 sctp_cmd_seq_t *commands)
227 {
228 - struct msghdr *msg = arg;
229 - struct sctp_chunk *abort;
230 + struct sctp_chunk *abort = arg;
231 sctp_disposition_t retval;
232
233 /* Stop T1-init timer */
234 @@ -4170,12 +4163,7 @@ sctp_disposition_t sctp_sf_cookie_wait_p
235 SCTP_TO(SCTP_EVENT_TIMEOUT_T1_INIT));
236 retval = SCTP_DISPOSITION_CONSUME;
237
238 - /* Generate ABORT chunk to send the peer */
239 - abort = sctp_make_abort_user(asoc, NULL, msg);
240 - if (!abort)
241 - retval = SCTP_DISPOSITION_NOMEM;
242 - else
243 - sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(abort));
244 + sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(abort));
245
246 sctp_add_cmd_sf(commands, SCTP_CMD_NEW_STATE,
247 SCTP_STATE(SCTP_STATE_CLOSED));
248 diff --git a/net/sctp/socket.c b/net/sctp/socket.c
249 index b811691..600eb59 100644
250 --- a/net/sctp/socket.c
251 +++ b/net/sctp/socket.c
252 @@ -1477,8 +1477,16 @@ SCTP_STATIC int sctp_sendmsg(struct kioc
253 goto out_unlock;
254 }
255 if (sinfo_flags & SCTP_ABORT) {
256 + struct sctp_chunk *chunk;
257 +
258 + chunk = sctp_make_abort_user(asoc, msg, msg_len);
259 + if (!chunk) {
260 + err = -ENOMEM;
261 + goto out_unlock;
262 + }
263 +
264 SCTP_DEBUG_PRINTK("Aborting association: %p\n", asoc);
265 - sctp_primitive_ABORT(asoc, msg);
266 + sctp_primitive_ABORT(asoc, chunk);
267 err = 0;
268 goto out_unlock;
269 }