diff options
author | Ingo Molnar <mingo@elte.hu> | 2009-03-12 20:33:21 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-03-12 20:33:21 -0400 |
commit | 480c93df5b99699390f93a7024c9f60d09da0e96 (patch) | |
tree | b93b6c8c71c5f2e716dd05b126e01ef4e20ff0af /fs | |
parent | aecfcde920da8d32949f6cbbc1fc051b4ef9e7be (diff) | |
parent | d820ac4c2fa881079e6b689d2098adce337558ae (diff) |
Merge branch 'core/locking' into tracing/ftrace
Diffstat (limited to 'fs')
-rw-r--r-- | fs/devpts/inode.c | 5 | ||||
-rw-r--r-- | fs/fat/inode.c | 4 | ||||
-rw-r--r-- | fs/fs-writeback.c | 9 | ||||
-rw-r--r-- | fs/inode.c | 7 | ||||
-rw-r--r-- | fs/pipe.c | 8 | ||||
-rw-r--r-- | fs/proc/page.c | 2 | ||||
-rw-r--r-- | fs/squashfs/block.c | 21 | ||||
-rw-r--r-- | fs/super.c | 5 | ||||
-rw-r--r-- | fs/xfs/linux-2.6/xfs_buf.c | 12 | ||||
-rw-r--r-- | fs/xfs/linux-2.6/xfs_buf.h | 2 | ||||
-rw-r--r-- | fs/xfs/linux-2.6/xfs_super.c | 10 | ||||
-rw-r--r-- | fs/xfs/xfs_iget.c | 15 | ||||
-rw-r--r-- | fs/xfs/xfs_log_recover.c | 17 |
13 files changed, 69 insertions, 48 deletions
diff --git a/fs/devpts/inode.c b/fs/devpts/inode.c index 5f3231b9633f..bff4052b05e7 100644 --- a/fs/devpts/inode.c +++ b/fs/devpts/inode.c | |||
@@ -198,9 +198,6 @@ static int mknod_ptmx(struct super_block *sb) | |||
198 | 198 | ||
199 | fsi->ptmx_dentry = dentry; | 199 | fsi->ptmx_dentry = dentry; |
200 | rc = 0; | 200 | rc = 0; |
201 | |||
202 | printk(KERN_DEBUG "Created ptmx node in devpts ino %lu\n", | ||
203 | inode->i_ino); | ||
204 | out: | 201 | out: |
205 | mutex_unlock(&root->d_inode->i_mutex); | 202 | mutex_unlock(&root->d_inode->i_mutex); |
206 | return rc; | 203 | return rc; |
@@ -369,8 +366,6 @@ static int new_pts_mount(struct file_system_type *fs_type, int flags, | |||
369 | struct pts_fs_info *fsi; | 366 | struct pts_fs_info *fsi; |
370 | struct pts_mount_opts *opts; | 367 | struct pts_mount_opts *opts; |
371 | 368 | ||
372 | printk(KERN_NOTICE "devpts: newinstance mount\n"); | ||
373 | |||
374 | err = get_sb_nodev(fs_type, flags, data, devpts_fill_super, mnt); | 369 | err = get_sb_nodev(fs_type, flags, data, devpts_fill_super, mnt); |
375 | if (err) | 370 | if (err) |
376 | return err; | 371 | return err; |
diff --git a/fs/fat/inode.c b/fs/fat/inode.c index 6b74d09adbe5..de0004fe6e00 100644 --- a/fs/fat/inode.c +++ b/fs/fat/inode.c | |||
@@ -202,9 +202,9 @@ static sector_t _fat_bmap(struct address_space *mapping, sector_t block) | |||
202 | sector_t blocknr; | 202 | sector_t blocknr; |
203 | 203 | ||
204 | /* fat_get_cluster() assumes the requested blocknr isn't truncated. */ | 204 | /* fat_get_cluster() assumes the requested blocknr isn't truncated. */ |
205 | mutex_lock(&mapping->host->i_mutex); | 205 | down_read(&mapping->host->i_alloc_sem); |
206 | blocknr = generic_block_bmap(mapping, block, fat_get_block); | 206 | blocknr = generic_block_bmap(mapping, block, fat_get_block); |
207 | mutex_unlock(&mapping->host->i_mutex); | 207 | up_read(&mapping->host->i_alloc_sem); |
208 | 208 | ||
209 | return blocknr; | 209 | return blocknr; |
210 | } | 210 | } |
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c index e5eaa62fd17f..e3fe9918faaf 100644 --- a/fs/fs-writeback.c +++ b/fs/fs-writeback.c | |||
@@ -274,6 +274,7 @@ __sync_single_inode(struct inode *inode, struct writeback_control *wbc) | |||
274 | int ret; | 274 | int ret; |
275 | 275 | ||
276 | BUG_ON(inode->i_state & I_SYNC); | 276 | BUG_ON(inode->i_state & I_SYNC); |
277 | WARN_ON(inode->i_state & I_NEW); | ||
277 | 278 | ||
278 | /* Set I_SYNC, reset I_DIRTY */ | 279 | /* Set I_SYNC, reset I_DIRTY */ |
279 | dirty = inode->i_state & I_DIRTY; | 280 | dirty = inode->i_state & I_DIRTY; |
@@ -298,6 +299,7 @@ __sync_single_inode(struct inode *inode, struct writeback_control *wbc) | |||
298 | } | 299 | } |
299 | 300 | ||
300 | spin_lock(&inode_lock); | 301 | spin_lock(&inode_lock); |
302 | WARN_ON(inode->i_state & I_NEW); | ||
301 | inode->i_state &= ~I_SYNC; | 303 | inode->i_state &= ~I_SYNC; |
302 | if (!(inode->i_state & I_FREEING)) { | 304 | if (!(inode->i_state & I_FREEING)) { |
303 | if (!(inode->i_state & I_DIRTY) && | 305 | if (!(inode->i_state & I_DIRTY) && |
@@ -470,6 +472,11 @@ void generic_sync_sb_inodes(struct super_block *sb, | |||
470 | break; | 472 | break; |
471 | } | 473 | } |
472 | 474 | ||
475 | if (inode->i_state & I_NEW) { | ||
476 | requeue_io(inode); | ||
477 | continue; | ||
478 | } | ||
479 | |||
473 | if (wbc->nonblocking && bdi_write_congested(bdi)) { | 480 | if (wbc->nonblocking && bdi_write_congested(bdi)) { |
474 | wbc->encountered_congestion = 1; | 481 | wbc->encountered_congestion = 1; |
475 | if (!sb_is_blkdev_sb(sb)) | 482 | if (!sb_is_blkdev_sb(sb)) |
@@ -531,7 +538,7 @@ void generic_sync_sb_inodes(struct super_block *sb, | |||
531 | list_for_each_entry(inode, &sb->s_inodes, i_sb_list) { | 538 | list_for_each_entry(inode, &sb->s_inodes, i_sb_list) { |
532 | struct address_space *mapping; | 539 | struct address_space *mapping; |
533 | 540 | ||
534 | if (inode->i_state & (I_FREEING|I_WILL_FREE)) | 541 | if (inode->i_state & (I_FREEING|I_WILL_FREE|I_NEW)) |
535 | continue; | 542 | continue; |
536 | mapping = inode->i_mapping; | 543 | mapping = inode->i_mapping; |
537 | if (mapping->nrpages == 0) | 544 | if (mapping->nrpages == 0) |
diff --git a/fs/inode.c b/fs/inode.c index 913ab2d9a5d1..826fb0b9d1c3 100644 --- a/fs/inode.c +++ b/fs/inode.c | |||
@@ -359,6 +359,7 @@ static int invalidate_list(struct list_head *head, struct list_head *dispose) | |||
359 | invalidate_inode_buffers(inode); | 359 | invalidate_inode_buffers(inode); |
360 | if (!atomic_read(&inode->i_count)) { | 360 | if (!atomic_read(&inode->i_count)) { |
361 | list_move(&inode->i_list, dispose); | 361 | list_move(&inode->i_list, dispose); |
362 | WARN_ON(inode->i_state & I_NEW); | ||
362 | inode->i_state |= I_FREEING; | 363 | inode->i_state |= I_FREEING; |
363 | count++; | 364 | count++; |
364 | continue; | 365 | continue; |
@@ -460,6 +461,7 @@ static void prune_icache(int nr_to_scan) | |||
460 | continue; | 461 | continue; |
461 | } | 462 | } |
462 | list_move(&inode->i_list, &freeable); | 463 | list_move(&inode->i_list, &freeable); |
464 | WARN_ON(inode->i_state & I_NEW); | ||
463 | inode->i_state |= I_FREEING; | 465 | inode->i_state |= I_FREEING; |
464 | nr_pruned++; | 466 | nr_pruned++; |
465 | } | 467 | } |
@@ -656,6 +658,7 @@ void unlock_new_inode(struct inode *inode) | |||
656 | * just created it (so there can be no old holders | 658 | * just created it (so there can be no old holders |
657 | * that haven't tested I_LOCK). | 659 | * that haven't tested I_LOCK). |
658 | */ | 660 | */ |
661 | WARN_ON((inode->i_state & (I_LOCK|I_NEW)) != (I_LOCK|I_NEW)); | ||
659 | inode->i_state &= ~(I_LOCK|I_NEW); | 662 | inode->i_state &= ~(I_LOCK|I_NEW); |
660 | wake_up_inode(inode); | 663 | wake_up_inode(inode); |
661 | } | 664 | } |
@@ -1145,6 +1148,7 @@ void generic_delete_inode(struct inode *inode) | |||
1145 | 1148 | ||
1146 | list_del_init(&inode->i_list); | 1149 | list_del_init(&inode->i_list); |
1147 | list_del_init(&inode->i_sb_list); | 1150 | list_del_init(&inode->i_sb_list); |
1151 | WARN_ON(inode->i_state & I_NEW); | ||
1148 | inode->i_state |= I_FREEING; | 1152 | inode->i_state |= I_FREEING; |
1149 | inodes_stat.nr_inodes--; | 1153 | inodes_stat.nr_inodes--; |
1150 | spin_unlock(&inode_lock); | 1154 | spin_unlock(&inode_lock); |
@@ -1186,16 +1190,19 @@ static void generic_forget_inode(struct inode *inode) | |||
1186 | spin_unlock(&inode_lock); | 1190 | spin_unlock(&inode_lock); |
1187 | return; | 1191 | return; |
1188 | } | 1192 | } |
1193 | WARN_ON(inode->i_state & I_NEW); | ||
1189 | inode->i_state |= I_WILL_FREE; | 1194 | inode->i_state |= I_WILL_FREE; |
1190 | spin_unlock(&inode_lock); | 1195 | spin_unlock(&inode_lock); |
1191 | write_inode_now(inode, 1); | 1196 | write_inode_now(inode, 1); |
1192 | spin_lock(&inode_lock); | 1197 | spin_lock(&inode_lock); |
1198 | WARN_ON(inode->i_state & I_NEW); | ||
1193 | inode->i_state &= ~I_WILL_FREE; | 1199 | inode->i_state &= ~I_WILL_FREE; |
1194 | inodes_stat.nr_unused--; | 1200 | inodes_stat.nr_unused--; |
1195 | hlist_del_init(&inode->i_hash); | 1201 | hlist_del_init(&inode->i_hash); |
1196 | } | 1202 | } |
1197 | list_del_init(&inode->i_list); | 1203 | list_del_init(&inode->i_list); |
1198 | list_del_init(&inode->i_sb_list); | 1204 | list_del_init(&inode->i_sb_list); |
1205 | WARN_ON(inode->i_state & I_NEW); | ||
1199 | inode->i_state |= I_FREEING; | 1206 | inode->i_state |= I_FREEING; |
1200 | inodes_stat.nr_inodes--; | 1207 | inodes_stat.nr_inodes--; |
1201 | spin_unlock(&inode_lock); | 1208 | spin_unlock(&inode_lock); |
@@ -699,12 +699,12 @@ pipe_rdwr_fasync(int fd, struct file *filp, int on) | |||
699 | int retval; | 699 | int retval; |
700 | 700 | ||
701 | mutex_lock(&inode->i_mutex); | 701 | mutex_lock(&inode->i_mutex); |
702 | |||
703 | retval = fasync_helper(fd, filp, on, &pipe->fasync_readers); | 702 | retval = fasync_helper(fd, filp, on, &pipe->fasync_readers); |
704 | 703 | if (retval >= 0) { | |
705 | if (retval >= 0) | ||
706 | retval = fasync_helper(fd, filp, on, &pipe->fasync_writers); | 704 | retval = fasync_helper(fd, filp, on, &pipe->fasync_writers); |
707 | 705 | if (retval < 0) /* this can happen only if on == T */ | |
706 | fasync_helper(-1, filp, 0, &pipe->fasync_readers); | ||
707 | } | ||
708 | mutex_unlock(&inode->i_mutex); | 708 | mutex_unlock(&inode->i_mutex); |
709 | 709 | ||
710 | if (retval < 0) | 710 | if (retval < 0) |
diff --git a/fs/proc/page.c b/fs/proc/page.c index 2d1345112a42..e9983837d08d 100644 --- a/fs/proc/page.c +++ b/fs/proc/page.c | |||
@@ -80,7 +80,7 @@ static const struct file_operations proc_kpagecount_operations = { | |||
80 | #define KPF_RECLAIM 9 | 80 | #define KPF_RECLAIM 9 |
81 | #define KPF_BUDDY 10 | 81 | #define KPF_BUDDY 10 |
82 | 82 | ||
83 | #define kpf_copy_bit(flags, srcpos, dstpos) (((flags >> srcpos) & 1) << dstpos) | 83 | #define kpf_copy_bit(flags, dstpos, srcpos) (((flags >> srcpos) & 1) << dstpos) |
84 | 84 | ||
85 | static ssize_t kpageflags_read(struct file *file, char __user *buf, | 85 | static ssize_t kpageflags_read(struct file *file, char __user *buf, |
86 | size_t count, loff_t *ppos) | 86 | size_t count, loff_t *ppos) |
diff --git a/fs/squashfs/block.c b/fs/squashfs/block.c index 321728f48f2d..2a7960310349 100644 --- a/fs/squashfs/block.c +++ b/fs/squashfs/block.c | |||
@@ -184,15 +184,7 @@ int squashfs_read_data(struct super_block *sb, void **buffer, u64 index, | |||
184 | offset = 0; | 184 | offset = 0; |
185 | } | 185 | } |
186 | 186 | ||
187 | if (msblk->stream.avail_out == 0) { | 187 | if (msblk->stream.avail_out == 0 && page < pages) { |
188 | if (page == pages) { | ||
189 | ERROR("zlib_inflate tried to " | ||
190 | "decompress too much data, " | ||
191 | "expected %d bytes. Zlib " | ||
192 | "data probably corrupt\n", | ||
193 | srclength); | ||
194 | goto release_mutex; | ||
195 | } | ||
196 | msblk->stream.next_out = buffer[page++]; | 188 | msblk->stream.next_out = buffer[page++]; |
197 | msblk->stream.avail_out = PAGE_CACHE_SIZE; | 189 | msblk->stream.avail_out = PAGE_CACHE_SIZE; |
198 | } | 190 | } |
@@ -209,25 +201,20 @@ int squashfs_read_data(struct super_block *sb, void **buffer, u64 index, | |||
209 | zlib_init = 1; | 201 | zlib_init = 1; |
210 | } | 202 | } |
211 | 203 | ||
212 | zlib_err = zlib_inflate(&msblk->stream, Z_NO_FLUSH); | 204 | zlib_err = zlib_inflate(&msblk->stream, Z_SYNC_FLUSH); |
213 | 205 | ||
214 | if (msblk->stream.avail_in == 0 && k < b) | 206 | if (msblk->stream.avail_in == 0 && k < b) |
215 | put_bh(bh[k++]); | 207 | put_bh(bh[k++]); |
216 | } while (zlib_err == Z_OK); | 208 | } while (zlib_err == Z_OK); |
217 | 209 | ||
218 | if (zlib_err != Z_STREAM_END) { | 210 | if (zlib_err != Z_STREAM_END) { |
219 | ERROR("zlib_inflate returned unexpected result" | 211 | ERROR("zlib_inflate error, data probably corrupt\n"); |
220 | " 0x%x, srclength %d, avail_in %d," | ||
221 | " avail_out %d\n", zlib_err, srclength, | ||
222 | msblk->stream.avail_in, | ||
223 | msblk->stream.avail_out); | ||
224 | goto release_mutex; | 212 | goto release_mutex; |
225 | } | 213 | } |
226 | 214 | ||
227 | zlib_err = zlib_inflateEnd(&msblk->stream); | 215 | zlib_err = zlib_inflateEnd(&msblk->stream); |
228 | if (zlib_err != Z_OK) { | 216 | if (zlib_err != Z_OK) { |
229 | ERROR("zlib_inflateEnd returned unexpected result 0x%x," | 217 | ERROR("zlib_inflate error, data probably corrupt\n"); |
230 | " srclength %d\n", zlib_err, srclength); | ||
231 | goto release_mutex; | 218 | goto release_mutex; |
232 | } | 219 | } |
233 | length = msblk->stream.total_out; | 220 | length = msblk->stream.total_out; |
diff --git a/fs/super.c b/fs/super.c index 8349ed6b1412..6ce501447ada 100644 --- a/fs/super.c +++ b/fs/super.c | |||
@@ -371,8 +371,10 @@ retry: | |||
371 | continue; | 371 | continue; |
372 | if (!grab_super(old)) | 372 | if (!grab_super(old)) |
373 | goto retry; | 373 | goto retry; |
374 | if (s) | 374 | if (s) { |
375 | up_write(&s->s_umount); | ||
375 | destroy_super(s); | 376 | destroy_super(s); |
377 | } | ||
376 | return old; | 378 | return old; |
377 | } | 379 | } |
378 | } | 380 | } |
@@ -387,6 +389,7 @@ retry: | |||
387 | err = set(s, data); | 389 | err = set(s, data); |
388 | if (err) { | 390 | if (err) { |
389 | spin_unlock(&sb_lock); | 391 | spin_unlock(&sb_lock); |
392 | up_write(&s->s_umount); | ||
390 | destroy_super(s); | 393 | destroy_super(s); |
391 | return ERR_PTR(err); | 394 | return ERR_PTR(err); |
392 | } | 395 | } |
diff --git a/fs/xfs/linux-2.6/xfs_buf.c b/fs/xfs/linux-2.6/xfs_buf.c index cb329edc925b..aa1016bb9134 100644 --- a/fs/xfs/linux-2.6/xfs_buf.c +++ b/fs/xfs/linux-2.6/xfs_buf.c | |||
@@ -34,6 +34,12 @@ | |||
34 | #include <linux/backing-dev.h> | 34 | #include <linux/backing-dev.h> |
35 | #include <linux/freezer.h> | 35 | #include <linux/freezer.h> |
36 | 36 | ||
37 | #include "xfs_sb.h" | ||
38 | #include "xfs_inum.h" | ||
39 | #include "xfs_ag.h" | ||
40 | #include "xfs_dmapi.h" | ||
41 | #include "xfs_mount.h" | ||
42 | |||
37 | static kmem_zone_t *xfs_buf_zone; | 43 | static kmem_zone_t *xfs_buf_zone; |
38 | STATIC int xfsbufd(void *); | 44 | STATIC int xfsbufd(void *); |
39 | STATIC int xfsbufd_wakeup(int, gfp_t); | 45 | STATIC int xfsbufd_wakeup(int, gfp_t); |
@@ -1435,10 +1441,12 @@ xfs_unregister_buftarg( | |||
1435 | 1441 | ||
1436 | void | 1442 | void |
1437 | xfs_free_buftarg( | 1443 | xfs_free_buftarg( |
1438 | xfs_buftarg_t *btp) | 1444 | struct xfs_mount *mp, |
1445 | struct xfs_buftarg *btp) | ||
1439 | { | 1446 | { |
1440 | xfs_flush_buftarg(btp, 1); | 1447 | xfs_flush_buftarg(btp, 1); |
1441 | xfs_blkdev_issue_flush(btp); | 1448 | if (mp->m_flags & XFS_MOUNT_BARRIER) |
1449 | xfs_blkdev_issue_flush(btp); | ||
1442 | xfs_free_bufhash(btp); | 1450 | xfs_free_bufhash(btp); |
1443 | iput(btp->bt_mapping->host); | 1451 | iput(btp->bt_mapping->host); |
1444 | 1452 | ||
diff --git a/fs/xfs/linux-2.6/xfs_buf.h b/fs/xfs/linux-2.6/xfs_buf.h index 288ae7c4c800..9b4d666ad31f 100644 --- a/fs/xfs/linux-2.6/xfs_buf.h +++ b/fs/xfs/linux-2.6/xfs_buf.h | |||
@@ -413,7 +413,7 @@ static inline int XFS_bwrite(xfs_buf_t *bp) | |||
413 | * Handling of buftargs. | 413 | * Handling of buftargs. |
414 | */ | 414 | */ |
415 | extern xfs_buftarg_t *xfs_alloc_buftarg(struct block_device *, int); | 415 | extern xfs_buftarg_t *xfs_alloc_buftarg(struct block_device *, int); |
416 | extern void xfs_free_buftarg(xfs_buftarg_t *); | 416 | extern void xfs_free_buftarg(struct xfs_mount *, struct xfs_buftarg *); |
417 | extern void xfs_wait_buftarg(xfs_buftarg_t *); | 417 | extern void xfs_wait_buftarg(xfs_buftarg_t *); |
418 | extern int xfs_setsize_buftarg(xfs_buftarg_t *, unsigned int, unsigned int); | 418 | extern int xfs_setsize_buftarg(xfs_buftarg_t *, unsigned int, unsigned int); |
419 | extern int xfs_flush_buftarg(xfs_buftarg_t *, int); | 419 | extern int xfs_flush_buftarg(xfs_buftarg_t *, int); |
diff --git a/fs/xfs/linux-2.6/xfs_super.c b/fs/xfs/linux-2.6/xfs_super.c index c71e226da7f5..32ae5028e96b 100644 --- a/fs/xfs/linux-2.6/xfs_super.c +++ b/fs/xfs/linux-2.6/xfs_super.c | |||
@@ -734,15 +734,15 @@ xfs_close_devices( | |||
734 | { | 734 | { |
735 | if (mp->m_logdev_targp && mp->m_logdev_targp != mp->m_ddev_targp) { | 735 | if (mp->m_logdev_targp && mp->m_logdev_targp != mp->m_ddev_targp) { |
736 | struct block_device *logdev = mp->m_logdev_targp->bt_bdev; | 736 | struct block_device *logdev = mp->m_logdev_targp->bt_bdev; |
737 | xfs_free_buftarg(mp->m_logdev_targp); | 737 | xfs_free_buftarg(mp, mp->m_logdev_targp); |
738 | xfs_blkdev_put(logdev); | 738 | xfs_blkdev_put(logdev); |
739 | } | 739 | } |
740 | if (mp->m_rtdev_targp) { | 740 | if (mp->m_rtdev_targp) { |
741 | struct block_device *rtdev = mp->m_rtdev_targp->bt_bdev; | 741 | struct block_device *rtdev = mp->m_rtdev_targp->bt_bdev; |
742 | xfs_free_buftarg(mp->m_rtdev_targp); | 742 | xfs_free_buftarg(mp, mp->m_rtdev_targp); |
743 | xfs_blkdev_put(rtdev); | 743 | xfs_blkdev_put(rtdev); |
744 | } | 744 | } |
745 | xfs_free_buftarg(mp->m_ddev_targp); | 745 | xfs_free_buftarg(mp, mp->m_ddev_targp); |
746 | } | 746 | } |
747 | 747 | ||
748 | /* | 748 | /* |
@@ -811,9 +811,9 @@ xfs_open_devices( | |||
811 | 811 | ||
812 | out_free_rtdev_targ: | 812 | out_free_rtdev_targ: |
813 | if (mp->m_rtdev_targp) | 813 | if (mp->m_rtdev_targp) |
814 | xfs_free_buftarg(mp->m_rtdev_targp); | 814 | xfs_free_buftarg(mp, mp->m_rtdev_targp); |
815 | out_free_ddev_targ: | 815 | out_free_ddev_targ: |
816 | xfs_free_buftarg(mp->m_ddev_targp); | 816 | xfs_free_buftarg(mp, mp->m_ddev_targp); |
817 | out_close_rtdev: | 817 | out_close_rtdev: |
818 | if (rtdev) | 818 | if (rtdev) |
819 | xfs_blkdev_put(rtdev); | 819 | xfs_blkdev_put(rtdev); |
diff --git a/fs/xfs/xfs_iget.c b/fs/xfs/xfs_iget.c index e2fb6210d4c5..478e587087fe 100644 --- a/fs/xfs/xfs_iget.c +++ b/fs/xfs/xfs_iget.c | |||
@@ -246,9 +246,6 @@ xfs_iget_cache_miss( | |||
246 | goto out_destroy; | 246 | goto out_destroy; |
247 | } | 247 | } |
248 | 248 | ||
249 | if (lock_flags) | ||
250 | xfs_ilock(ip, lock_flags); | ||
251 | |||
252 | /* | 249 | /* |
253 | * Preload the radix tree so we can insert safely under the | 250 | * Preload the radix tree so we can insert safely under the |
254 | * write spinlock. Note that we cannot sleep inside the preload | 251 | * write spinlock. Note that we cannot sleep inside the preload |
@@ -256,7 +253,16 @@ xfs_iget_cache_miss( | |||
256 | */ | 253 | */ |
257 | if (radix_tree_preload(GFP_KERNEL)) { | 254 | if (radix_tree_preload(GFP_KERNEL)) { |
258 | error = EAGAIN; | 255 | error = EAGAIN; |
259 | goto out_unlock; | 256 | goto out_destroy; |
257 | } | ||
258 | |||
259 | /* | ||
260 | * Because the inode hasn't been added to the radix-tree yet it can't | ||
261 | * be found by another thread, so we can do the non-sleeping lock here. | ||
262 | */ | ||
263 | if (lock_flags) { | ||
264 | if (!xfs_ilock_nowait(ip, lock_flags)) | ||
265 | BUG(); | ||
260 | } | 266 | } |
261 | 267 | ||
262 | mask = ~(((XFS_INODE_CLUSTER_SIZE(mp) >> mp->m_sb.sb_inodelog)) - 1); | 268 | mask = ~(((XFS_INODE_CLUSTER_SIZE(mp) >> mp->m_sb.sb_inodelog)) - 1); |
@@ -284,7 +290,6 @@ xfs_iget_cache_miss( | |||
284 | out_preload_end: | 290 | out_preload_end: |
285 | write_unlock(&pag->pag_ici_lock); | 291 | write_unlock(&pag->pag_ici_lock); |
286 | radix_tree_preload_end(); | 292 | radix_tree_preload_end(); |
287 | out_unlock: | ||
288 | if (lock_flags) | 293 | if (lock_flags) |
289 | xfs_iunlock(ip, lock_flags); | 294 | xfs_iunlock(ip, lock_flags); |
290 | out_destroy: | 295 | out_destroy: |
diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c index b1047de2fffd..61af610d79b3 100644 --- a/fs/xfs/xfs_log_recover.c +++ b/fs/xfs/xfs_log_recover.c | |||
@@ -1455,10 +1455,19 @@ xlog_recover_add_to_trans( | |||
1455 | item = item->ri_prev; | 1455 | item = item->ri_prev; |
1456 | 1456 | ||
1457 | if (item->ri_total == 0) { /* first region to be added */ | 1457 | if (item->ri_total == 0) { /* first region to be added */ |
1458 | item->ri_total = in_f->ilf_size; | 1458 | if (in_f->ilf_size == 0 || |
1459 | ASSERT(item->ri_total <= XLOG_MAX_REGIONS_IN_ITEM); | 1459 | in_f->ilf_size > XLOG_MAX_REGIONS_IN_ITEM) { |
1460 | item->ri_buf = kmem_zalloc((item->ri_total * | 1460 | xlog_warn( |
1461 | sizeof(xfs_log_iovec_t)), KM_SLEEP); | 1461 | "XFS: bad number of regions (%d) in inode log format", |
1462 | in_f->ilf_size); | ||
1463 | ASSERT(0); | ||
1464 | return XFS_ERROR(EIO); | ||
1465 | } | ||
1466 | |||
1467 | item->ri_total = in_f->ilf_size; | ||
1468 | item->ri_buf = | ||
1469 | kmem_zalloc(item->ri_total * sizeof(xfs_log_iovec_t), | ||
1470 | KM_SLEEP); | ||
1462 | } | 1471 | } |
1463 | ASSERT(item->ri_total > item->ri_cnt); | 1472 | ASSERT(item->ri_total > item->ri_cnt); |
1464 | /* Description region is ri_buf[0] */ | 1473 | /* Description region is ri_buf[0] */ |