1 From: Miklos Szeredi <mszeredi@suse.cz>
2 Subject: fix kabi breakage from i_mutex locking fix
6 Splice splice_desc into two structures, splice_desc (the old version)
7 and splice_desc_ext, containing the new fields.
9 Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
11 fs/ocfs2/file.c | 18 +++++++++--------
12 fs/splice.c | 51 ++++++++++++++++++++++++++-----------------------
13 include/linux/splice.h | 12 +++++++----
14 3 files changed, 46 insertions(+), 35 deletions(-)
16 Index: linux-2.6.25-SL110_BRANCH/fs/ocfs2/file.c
17 ===================================================================
18 --- linux-2.6.25-SL110_BRANCH.orig/fs/ocfs2/file.c 2009-05-26 17:23:28.000000000 +0200
19 +++ linux-2.6.25-SL110_BRANCH/fs/ocfs2/file.c 2009-05-27 10:10:28.000000000 +0200
20 @@ -2073,9 +2073,10 @@ out_sems:
22 static int ocfs2_splice_to_file(struct pipe_inode_info *pipe,
24 - struct splice_desc *sd)
25 + struct splice_desc_ext *esd)
28 + struct splice_desc *sd = esd->sd;
30 ret = ocfs2_prepare_inode_for_write(out->f_path.dentry, &sd->pos,
31 sd->total_len, 0, NULL);
32 @@ -2084,7 +2085,7 @@ static int ocfs2_splice_to_file(struct p
36 - return splice_from_pipe_feed(pipe, sd, pipe_to_file);
37 + return splice_from_pipe_feed(pipe, esd, pipe_to_file);
40 static ssize_t ocfs2_file_splice_write(struct pipe_inode_info *pipe,
41 @@ -2102,6 +2103,7 @@ static ssize_t ocfs2_file_splice_write(s
45 + struct splice_desc_ext esd = { .sd = &sd };
47 mlog_entry("(0x%p, 0x%p, %u, '%.*s')\n", out, pipe,
49 @@ -2111,9 +2113,9 @@ static ssize_t ocfs2_file_splice_write(s
51 mutex_lock_nested(&pipe->inode->i_mutex, I_MUTEX_PARENT);
53 - splice_from_pipe_begin(&sd);
54 + splice_from_pipe_begin(&esd);
56 - ret = splice_from_pipe_next(pipe, &sd);
57 + ret = splice_from_pipe_next(pipe, &esd);
61 @@ -2122,18 +2124,18 @@ static ssize_t ocfs2_file_splice_write(s
65 - ret = ocfs2_splice_to_file(pipe, out, &sd);
66 + ret = ocfs2_splice_to_file(pipe, out, &esd);
67 ocfs2_rw_unlock(inode, 1);
69 mutex_unlock(&inode->i_mutex);
71 - splice_from_pipe_end(pipe, &sd);
72 + splice_from_pipe_end(pipe, &esd);
75 mutex_unlock(&pipe->inode->i_mutex);
78 - ret = sd.num_spliced;
79 + if (esd.num_spliced)
80 + ret = esd.num_spliced;
83 unsigned long nr_pages;
84 Index: linux-2.6.25-SL110_BRANCH/fs/splice.c
85 ===================================================================
86 --- linux-2.6.25-SL110_BRANCH.orig/fs/splice.c 2009-05-26 17:23:29.000000000 +0200
87 +++ linux-2.6.25-SL110_BRANCH/fs/splice.c 2009-05-27 10:09:01.000000000 +0200
88 @@ -619,10 +619,11 @@ static void wakeup_pipe_writers(struct p
89 * locking is required around copying the pipe buffers to the
92 -int splice_from_pipe_feed(struct pipe_inode_info *pipe, struct splice_desc *sd,
93 +int splice_from_pipe_feed(struct pipe_inode_info *pipe, struct splice_desc_ext *esd,
97 + struct splice_desc *sd = esd->sd;
99 while (pipe->nrbufs) {
100 struct pipe_buffer *buf = pipe->bufs + pipe->curbuf;
101 @@ -641,7 +642,7 @@ int splice_from_pipe_feed(struct pipe_in
105 - sd->num_spliced += ret;
106 + esd->num_spliced += ret;
109 sd->total_len -= ret;
110 @@ -652,7 +653,7 @@ int splice_from_pipe_feed(struct pipe_in
111 pipe->curbuf = (pipe->curbuf + 1) & (PIPE_BUFFERS - 1);
114 - sd->need_wakeup = true;
115 + esd->need_wakeup = true;
119 @@ -673,13 +674,15 @@ EXPORT_SYMBOL(splice_from_pipe_feed);
120 * value (one) if pipe buffers are available. It will return zero
121 * or -errno if no more data needs to be spliced.
123 -int splice_from_pipe_next(struct pipe_inode_info *pipe, struct splice_desc *sd)
124 +int splice_from_pipe_next(struct pipe_inode_info *pipe, struct splice_desc_ext *esd)
126 + struct splice_desc *sd = esd->sd;
128 while (!pipe->nrbufs) {
132 - if (!pipe->waiting_writers && sd->num_spliced)
133 + if (!pipe->waiting_writers && esd->num_spliced)
136 if (sd->flags & SPLICE_F_NONBLOCK)
137 @@ -688,9 +691,9 @@ int splice_from_pipe_next(struct pipe_in
138 if (signal_pending(current))
141 - if (sd->need_wakeup) {
142 + if (esd->need_wakeup) {
143 wakeup_pipe_writers(pipe);
144 - sd->need_wakeup = false;
145 + esd->need_wakeup = false;
149 @@ -709,10 +712,10 @@ EXPORT_SYMBOL(splice_from_pipe_next);
150 * splice_from_pipe_next() and splice_from_pipe_feed() to
151 * initialize the necessary fields of @sd.
153 -void splice_from_pipe_begin(struct splice_desc *sd)
154 +void splice_from_pipe_begin(struct splice_desc_ext *esd)
156 - sd->num_spliced = 0;
157 - sd->need_wakeup = false;
158 + esd->num_spliced = 0;
159 + esd->need_wakeup = false;
161 EXPORT_SYMBOL(splice_from_pipe_begin);
163 @@ -726,9 +729,9 @@ EXPORT_SYMBOL(splice_from_pipe_begin);
164 * be called after a loop containing splice_from_pipe_next() and
165 * splice_from_pipe_feed().
167 -void splice_from_pipe_end(struct pipe_inode_info *pipe, struct splice_desc *sd)
168 +void splice_from_pipe_end(struct pipe_inode_info *pipe, struct splice_desc_ext *esd)
170 - if (sd->need_wakeup)
171 + if (esd->need_wakeup)
172 wakeup_pipe_writers(pipe);
174 EXPORT_SYMBOL(splice_from_pipe_end);
175 @@ -750,16 +753,17 @@ ssize_t __splice_from_pipe(struct pipe_i
179 + struct splice_desc_ext esd = { .sd = sd };
181 - splice_from_pipe_begin(sd);
182 + splice_from_pipe_begin(&esd);
184 - ret = splice_from_pipe_next(pipe, sd);
185 + ret = splice_from_pipe_next(pipe, &esd);
187 - ret = splice_from_pipe_feed(pipe, sd, actor);
188 + ret = splice_from_pipe_feed(pipe, &esd, actor);
190 - splice_from_pipe_end(pipe, sd);
191 + splice_from_pipe_end(pipe, &esd);
193 - return sd->num_spliced ? sd->num_spliced : ret;
194 + return esd.num_spliced ? esd.num_spliced : ret;
196 EXPORT_SYMBOL(__splice_from_pipe);
198 @@ -882,30 +886,31 @@ generic_file_splice_write(struct pipe_in
202 + struct splice_desc_ext esd = { .sd = &sd };
206 mutex_lock_nested(&pipe->inode->i_mutex, I_MUTEX_PARENT);
208 - splice_from_pipe_begin(&sd);
209 + splice_from_pipe_begin(&esd);
211 - ret = splice_from_pipe_next(pipe, &sd);
212 + ret = splice_from_pipe_next(pipe, &esd);
216 mutex_lock_nested(&inode->i_mutex, I_MUTEX_CHILD);
217 ret = file_remove_suid(out);
219 - ret = splice_from_pipe_feed(pipe, &sd, pipe_to_file);
220 + ret = splice_from_pipe_feed(pipe, &esd, pipe_to_file);
221 mutex_unlock(&inode->i_mutex);
223 - splice_from_pipe_end(pipe, &sd);
224 + splice_from_pipe_end(pipe, &esd);
227 mutex_unlock(&pipe->inode->i_mutex);
229 - if (sd.num_spliced)
230 - ret = sd.num_spliced;
231 + if (esd.num_spliced)
232 + ret = esd.num_spliced;
235 unsigned long nr_pages;
236 Index: linux-2.6.25-SL110_BRANCH/include/linux/splice.h
237 ===================================================================
238 --- linux-2.6.25-SL110_BRANCH.orig/include/linux/splice.h 2009-05-26 17:23:28.000000000 +0200
239 +++ linux-2.6.25-SL110_BRANCH/include/linux/splice.h 2009-05-27 09:59:51.000000000 +0200
240 @@ -36,6 +36,10 @@ struct splice_desc {
241 void *data; /* cookie */
243 loff_t pos; /* file position */
246 +struct splice_desc_ext {
247 + struct splice_desc *sd;
248 size_t num_spliced; /* number of bytes already spliced */
249 bool need_wakeup; /* need to wake up writer */
251 @@ -68,13 +72,13 @@ extern ssize_t splice_from_pipe(struct p
253 extern ssize_t __splice_from_pipe(struct pipe_inode_info *,
254 struct splice_desc *, splice_actor *);
255 -extern int splice_from_pipe_feed(struct pipe_inode_info *, struct splice_desc *,
256 +extern int splice_from_pipe_feed(struct pipe_inode_info *, struct splice_desc_ext *,
258 extern int splice_from_pipe_next(struct pipe_inode_info *,
259 - struct splice_desc *);
260 -extern void splice_from_pipe_begin(struct splice_desc *);
261 + struct splice_desc_ext *);
262 +extern void splice_from_pipe_begin(struct splice_desc_ext *);
263 extern void splice_from_pipe_end(struct pipe_inode_info *,
264 - struct splice_desc *);
265 + struct splice_desc_ext *);
266 extern int pipe_to_file(struct pipe_inode_info *, struct pipe_buffer *,
267 struct splice_desc *);