diff options
Diffstat (limited to 'fs/xfs/xfs_rw.c')
-rw-r--r-- | fs/xfs/xfs_rw.c | 155 |
1 files changed, 0 insertions, 155 deletions
diff --git a/fs/xfs/xfs_rw.c b/fs/xfs/xfs_rw.c index 5aa07caea5f1..e336742a58a4 100644 --- a/fs/xfs/xfs_rw.c +++ b/fs/xfs/xfs_rw.c | |||
@@ -47,48 +47,6 @@ | |||
47 | #include "xfs_trace.h" | 47 | #include "xfs_trace.h" |
48 | 48 | ||
49 | /* | 49 | /* |
50 | * This is a subroutine for xfs_write() and other writers (xfs_ioctl) | ||
51 | * which clears the setuid and setgid bits when a file is written. | ||
52 | */ | ||
53 | int | ||
54 | xfs_write_clear_setuid( | ||
55 | xfs_inode_t *ip) | ||
56 | { | ||
57 | xfs_mount_t *mp; | ||
58 | xfs_trans_t *tp; | ||
59 | int error; | ||
60 | |||
61 | mp = ip->i_mount; | ||
62 | tp = xfs_trans_alloc(mp, XFS_TRANS_WRITEID); | ||
63 | if ((error = xfs_trans_reserve(tp, 0, | ||
64 | XFS_WRITEID_LOG_RES(mp), | ||
65 | 0, 0, 0))) { | ||
66 | xfs_trans_cancel(tp, 0); | ||
67 | return error; | ||
68 | } | ||
69 | xfs_ilock(ip, XFS_ILOCK_EXCL); | ||
70 | xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL); | ||
71 | xfs_trans_ihold(tp, ip); | ||
72 | ip->i_d.di_mode &= ~S_ISUID; | ||
73 | |||
74 | /* | ||
75 | * Note that we don't have to worry about mandatory | ||
76 | * file locking being disabled here because we only | ||
77 | * clear the S_ISGID bit if the Group execute bit is | ||
78 | * on, but if it was on then mandatory locking wouldn't | ||
79 | * have been enabled. | ||
80 | */ | ||
81 | if (ip->i_d.di_mode & S_IXGRP) { | ||
82 | ip->i_d.di_mode &= ~S_ISGID; | ||
83 | } | ||
84 | xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); | ||
85 | xfs_trans_set_sync(tp); | ||
86 | error = xfs_trans_commit(tp, 0); | ||
87 | xfs_iunlock(ip, XFS_ILOCK_EXCL); | ||
88 | return 0; | ||
89 | } | ||
90 | |||
91 | /* | ||
92 | * Force a shutdown of the filesystem instantly while keeping | 50 | * Force a shutdown of the filesystem instantly while keeping |
93 | * the filesystem consistent. We don't do an unmount here; just shutdown | 51 | * the filesystem consistent. We don't do an unmount here; just shutdown |
94 | * the shop, make sure that absolutely nothing persistent happens to | 52 | * the shop, make sure that absolutely nothing persistent happens to |
@@ -153,88 +111,6 @@ xfs_do_force_shutdown( | |||
153 | } | 111 | } |
154 | } | 112 | } |
155 | 113 | ||
156 | |||
157 | /* | ||
158 | * Called when we want to stop a buffer from getting written or read. | ||
159 | * We attach the EIO error, muck with its flags, and call biodone | ||
160 | * so that the proper iodone callbacks get called. | ||
161 | */ | ||
162 | int | ||
163 | xfs_bioerror( | ||
164 | xfs_buf_t *bp) | ||
165 | { | ||
166 | |||
167 | #ifdef XFSERRORDEBUG | ||
168 | ASSERT(XFS_BUF_ISREAD(bp) || bp->b_iodone); | ||
169 | #endif | ||
170 | |||
171 | /* | ||
172 | * No need to wait until the buffer is unpinned. | ||
173 | * We aren't flushing it. | ||
174 | */ | ||
175 | XFS_BUF_ERROR(bp, EIO); | ||
176 | /* | ||
177 | * We're calling biodone, so delete B_DONE flag. Either way | ||
178 | * we have to call the iodone callback, and calling biodone | ||
179 | * probably is the best way since it takes care of | ||
180 | * GRIO as well. | ||
181 | */ | ||
182 | XFS_BUF_UNREAD(bp); | ||
183 | XFS_BUF_UNDELAYWRITE(bp); | ||
184 | XFS_BUF_UNDONE(bp); | ||
185 | XFS_BUF_STALE(bp); | ||
186 | |||
187 | XFS_BUF_CLR_BDSTRAT_FUNC(bp); | ||
188 | xfs_biodone(bp); | ||
189 | |||
190 | return (EIO); | ||
191 | } | ||
192 | |||
193 | /* | ||
194 | * Same as xfs_bioerror, except that we are releasing the buffer | ||
195 | * here ourselves, and avoiding the biodone call. | ||
196 | * This is meant for userdata errors; metadata bufs come with | ||
197 | * iodone functions attached, so that we can track down errors. | ||
198 | */ | ||
199 | int | ||
200 | xfs_bioerror_relse( | ||
201 | xfs_buf_t *bp) | ||
202 | { | ||
203 | int64_t fl; | ||
204 | |||
205 | ASSERT(XFS_BUF_IODONE_FUNC(bp) != xfs_buf_iodone_callbacks); | ||
206 | ASSERT(XFS_BUF_IODONE_FUNC(bp) != xlog_iodone); | ||
207 | |||
208 | fl = XFS_BUF_BFLAGS(bp); | ||
209 | /* | ||
210 | * No need to wait until the buffer is unpinned. | ||
211 | * We aren't flushing it. | ||
212 | * | ||
213 | * chunkhold expects B_DONE to be set, whether | ||
214 | * we actually finish the I/O or not. We don't want to | ||
215 | * change that interface. | ||
216 | */ | ||
217 | XFS_BUF_UNREAD(bp); | ||
218 | XFS_BUF_UNDELAYWRITE(bp); | ||
219 | XFS_BUF_DONE(bp); | ||
220 | XFS_BUF_STALE(bp); | ||
221 | XFS_BUF_CLR_IODONE_FUNC(bp); | ||
222 | XFS_BUF_CLR_BDSTRAT_FUNC(bp); | ||
223 | if (!(fl & XFS_B_ASYNC)) { | ||
224 | /* | ||
225 | * Mark b_error and B_ERROR _both_. | ||
226 | * Lot's of chunkcache code assumes that. | ||
227 | * There's no reason to mark error for | ||
228 | * ASYNC buffers. | ||
229 | */ | ||
230 | XFS_BUF_ERROR(bp, EIO); | ||
231 | XFS_BUF_FINISH_IOWAIT(bp); | ||
232 | } else { | ||
233 | xfs_buf_relse(bp); | ||
234 | } | ||
235 | return (EIO); | ||
236 | } | ||
237 | |||
238 | /* | 114 | /* |
239 | * Prints out an ALERT message about I/O error. | 115 | * Prints out an ALERT message about I/O error. |
240 | */ | 116 | */ |
@@ -306,37 +182,6 @@ xfs_read_buf( | |||
306 | } | 182 | } |
307 | 183 | ||
308 | /* | 184 | /* |
309 | * Wrapper around bwrite() so that we can trap | ||
310 | * write errors, and act accordingly. | ||
311 | */ | ||
312 | int | ||
313 | xfs_bwrite( | ||
314 | struct xfs_mount *mp, | ||
315 | struct xfs_buf *bp) | ||
316 | { | ||
317 | int error; | ||
318 | |||
319 | /* | ||
320 | * XXXsup how does this work for quotas. | ||
321 | */ | ||
322 | XFS_BUF_SET_BDSTRAT_FUNC(bp, xfs_bdstrat_cb); | ||
323 | bp->b_mount = mp; | ||
324 | XFS_BUF_WRITE(bp); | ||
325 | |||
326 | if ((error = XFS_bwrite(bp))) { | ||
327 | ASSERT(mp); | ||
328 | /* | ||
329 | * Cannot put a buftrace here since if the buffer is not | ||
330 | * B_HOLD then we will brelse() the buffer before returning | ||
331 | * from bwrite and we could be tracing a buffer that has | ||
332 | * been reused. | ||
333 | */ | ||
334 | xfs_force_shutdown(mp, SHUTDOWN_META_IO_ERROR); | ||
335 | } | ||
336 | return (error); | ||
337 | } | ||
338 | |||
339 | /* | ||
340 | * helper function to extract extent size hint from inode | 185 | * helper function to extract extent size hint from inode |
341 | */ | 186 | */ |
342 | xfs_extlen_t | 187 | xfs_extlen_t |