diff options
Diffstat (limited to 'fs/sysv/inode.c')
-rw-r--r-- | fs/sysv/inode.c | 45 |
1 files changed, 16 insertions, 29 deletions
diff --git a/fs/sysv/inode.c b/fs/sysv/inode.c index a3f45fc626a1..425c976cfcd2 100644 --- a/fs/sysv/inode.c +++ b/fs/sysv/inode.c | |||
@@ -247,7 +247,7 @@ bad_inode: | |||
247 | return ERR_PTR(-EIO); | 247 | return ERR_PTR(-EIO); |
248 | } | 248 | } |
249 | 249 | ||
250 | static struct buffer_head * sysv_update_inode(struct inode * inode) | 250 | int sysv_write_inode(struct inode *inode, int wait) |
251 | { | 251 | { |
252 | struct super_block * sb = inode->i_sb; | 252 | struct super_block * sb = inode->i_sb; |
253 | struct sysv_sb_info * sbi = SYSV_SB(sb); | 253 | struct sysv_sb_info * sbi = SYSV_SB(sb); |
@@ -255,19 +255,21 @@ static struct buffer_head * sysv_update_inode(struct inode * inode) | |||
255 | struct sysv_inode * raw_inode; | 255 | struct sysv_inode * raw_inode; |
256 | struct sysv_inode_info * si; | 256 | struct sysv_inode_info * si; |
257 | unsigned int ino, block; | 257 | unsigned int ino, block; |
258 | int err = 0; | ||
258 | 259 | ||
259 | ino = inode->i_ino; | 260 | ino = inode->i_ino; |
260 | if (!ino || ino > sbi->s_ninodes) { | 261 | if (!ino || ino > sbi->s_ninodes) { |
261 | printk("Bad inode number on dev %s: %d is out of range\n", | 262 | printk("Bad inode number on dev %s: %d is out of range\n", |
262 | inode->i_sb->s_id, ino); | 263 | inode->i_sb->s_id, ino); |
263 | return NULL; | 264 | return -EIO; |
264 | } | 265 | } |
265 | raw_inode = sysv_raw_inode(sb, ino, &bh); | 266 | raw_inode = sysv_raw_inode(sb, ino, &bh); |
266 | if (!raw_inode) { | 267 | if (!raw_inode) { |
267 | printk("unable to read i-node block\n"); | 268 | printk("unable to read i-node block\n"); |
268 | return NULL; | 269 | return -EIO; |
269 | } | 270 | } |
270 | 271 | ||
272 | lock_kernel(); | ||
271 | raw_inode->i_mode = cpu_to_fs16(sbi, inode->i_mode); | 273 | raw_inode->i_mode = cpu_to_fs16(sbi, inode->i_mode); |
272 | raw_inode->i_uid = cpu_to_fs16(sbi, fs_high2lowuid(inode->i_uid)); | 274 | raw_inode->i_uid = cpu_to_fs16(sbi, fs_high2lowuid(inode->i_uid)); |
273 | raw_inode->i_gid = cpu_to_fs16(sbi, fs_high2lowgid(inode->i_gid)); | 275 | raw_inode->i_gid = cpu_to_fs16(sbi, fs_high2lowgid(inode->i_gid)); |
@@ -283,38 +285,23 @@ static struct buffer_head * sysv_update_inode(struct inode * inode) | |||
283 | for (block = 0; block < 10+1+1+1; block++) | 285 | for (block = 0; block < 10+1+1+1; block++) |
284 | write3byte(sbi, (u8 *)&si->i_data[block], | 286 | write3byte(sbi, (u8 *)&si->i_data[block], |
285 | &raw_inode->i_data[3*block]); | 287 | &raw_inode->i_data[3*block]); |
288 | unlock_kernel(); | ||
286 | mark_buffer_dirty(bh); | 289 | mark_buffer_dirty(bh); |
287 | return bh; | 290 | if (wait) { |
288 | } | 291 | sync_dirty_buffer(bh); |
289 | 292 | if (buffer_req(bh) && !buffer_uptodate(bh)) { | |
290 | int sysv_write_inode(struct inode * inode, int wait) | 293 | printk ("IO error syncing sysv inode [%s:%08x]\n", |
291 | { | 294 | sb->s_id, ino); |
292 | struct buffer_head *bh; | 295 | err = -EIO; |
293 | lock_kernel(); | 296 | } |
294 | bh = sysv_update_inode(inode); | 297 | } |
295 | brelse(bh); | 298 | brelse(bh); |
296 | unlock_kernel(); | ||
297 | return 0; | 299 | return 0; |
298 | } | 300 | } |
299 | 301 | ||
300 | int sysv_sync_inode(struct inode * inode) | 302 | int sysv_sync_inode(struct inode *inode) |
301 | { | 303 | { |
302 | int err = 0; | 304 | return sysv_write_inode(inode, 1); |
303 | struct buffer_head *bh; | ||
304 | |||
305 | bh = sysv_update_inode(inode); | ||
306 | if (bh && buffer_dirty(bh)) { | ||
307 | sync_dirty_buffer(bh); | ||
308 | if (buffer_req(bh) && !buffer_uptodate(bh)) { | ||
309 | printk ("IO error syncing sysv inode [%s:%08lx]\n", | ||
310 | inode->i_sb->s_id, inode->i_ino); | ||
311 | err = -1; | ||
312 | } | ||
313 | } | ||
314 | else if (!bh) | ||
315 | err = -1; | ||
316 | brelse (bh); | ||
317 | return err; | ||
318 | } | 305 | } |
319 | 306 | ||
320 | static void sysv_delete_inode(struct inode *inode) | 307 | static void sysv_delete_inode(struct inode *inode) |