aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorSergei Trofimovich <slyich@gmail.com>2011-09-11 10:52:24 -0400
committerChris Mason <chris.mason@oracle.com>2011-09-11 10:52:24 -0400
commite0b6d65be57fb37ca67b04ce8964546a74d2125c (patch)
tree9660c0424da2eaa5271e83533a9346b27389fab2 /fs
parent14c7cca780bd210564ae964f57a8bb807d0b3dbf (diff)
btrfs: fix warning in iput for bad-inode
iput() shouldn't be called for inodes in I_NEW state. We need to mark inode as constructed first. WARNING: at fs/inode.c:1309 iput+0x20b/0x210() Call Trace: [<ffffffff8103e7ba>] warn_slowpath_common+0x7a/0xb0 [<ffffffff8103e805>] warn_slowpath_null+0x15/0x20 [<ffffffff810eaf0b>] iput+0x20b/0x210 [<ffffffff811b96fb>] btrfs_iget+0x1eb/0x4a0 [<ffffffff811c3ad6>] btrfs_run_defrag_inodes+0x136/0x210 [<ffffffff811ad55f>] cleaner_kthread+0x17f/0x1a0 [<ffffffff81035b7d>] ? sub_preempt_count+0x9d/0xd0 [<ffffffff811ad3e0>] ? transaction_kthread+0x280/0x280 [<ffffffff8105af86>] kthread+0x96/0xa0 [<ffffffff814336d4>] kernel_thread_helper+0x4/0x10 [<ffffffff8105aef0>] ? kthread_worker_fn+0x190/0x190 [<ffffffff814336d0>] ? gs_change+0xb/0xb Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org> CC: Konstantin Khlebnikov <khlebnikov@openvz.org> Tested-by: David Sterba <dsterba@suse.cz> CC: Josef Bacik <josef@redhat.com> CC: Chris Mason <chris.mason@oracle.com> Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/btrfs/inode.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 34195f9fc6bb..edd45f709989 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -3952,7 +3952,6 @@ struct inode *btrfs_iget(struct super_block *s, struct btrfs_key *location,
3952 struct btrfs_root *root, int *new) 3952 struct btrfs_root *root, int *new)
3953{ 3953{
3954 struct inode *inode; 3954 struct inode *inode;
3955 int bad_inode = 0;
3956 3955
3957 inode = btrfs_iget_locked(s, location->objectid, root); 3956 inode = btrfs_iget_locked(s, location->objectid, root);
3958 if (!inode) 3957 if (!inode)
@@ -3968,15 +3967,12 @@ struct inode *btrfs_iget(struct super_block *s, struct btrfs_key *location,
3968 if (new) 3967 if (new)
3969 *new = 1; 3968 *new = 1;
3970 } else { 3969 } else {
3971 bad_inode = 1; 3970 unlock_new_inode(inode);
3971 iput(inode);
3972 inode = ERR_PTR(-ESTALE);
3972 } 3973 }
3973 } 3974 }
3974 3975
3975 if (bad_inode) {
3976 iput(inode);
3977 inode = ERR_PTR(-ESTALE);
3978 }
3979
3980 return inode; 3976 return inode;
3981} 3977}
3982 3978