diff options
author | Chris Mason <chris.mason@oracle.com> | 2007-03-30 08:47:31 -0400 |
---|---|---|
committer | David Woodhouse <dwmw2@hera.kernel.org> | 2007-03-30 08:47:31 -0400 |
commit | 22b0ebda6c63a1ad66b6a9e806bd226a4a03a049 (patch) | |
tree | 391d141c7c143914969a98409e72e615cdcac226 /fs/btrfs/super.c | |
parent | f254e52c1ce550fdaa0d31f5e068f0d67c2485d4 (diff) |
Btrfs: hunting slab corruption
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/super.c')
-rw-r--r-- | fs/btrfs/super.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index 04428137d75..ab5419eea93 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c | |||
@@ -361,13 +361,16 @@ static struct dentry *btrfs_lookup(struct inode *dir, struct dentry *dentry, | |||
361 | struct nameidata *nd) | 361 | struct nameidata *nd) |
362 | { | 362 | { |
363 | struct inode * inode; | 363 | struct inode * inode; |
364 | struct btrfs_root *root = btrfs_sb(dir->i_sb); | ||
364 | ino_t ino; | 365 | ino_t ino; |
365 | int ret; | 366 | int ret; |
366 | 367 | ||
367 | if (dentry->d_name.len > BTRFS_NAME_LEN) | 368 | if (dentry->d_name.len > BTRFS_NAME_LEN) |
368 | return ERR_PTR(-ENAMETOOLONG); | 369 | return ERR_PTR(-ENAMETOOLONG); |
369 | 370 | ||
371 | mutex_lock(&root->fs_info->fs_mutex); | ||
370 | ret = btrfs_inode_by_name(dir, dentry, &ino); | 372 | ret = btrfs_inode_by_name(dir, dentry, &ino); |
373 | mutex_unlock(&root->fs_info->fs_mutex); | ||
371 | if (ret < 0) | 374 | if (ret < 0) |
372 | return ERR_PTR(ret); | 375 | return ERR_PTR(ret); |
373 | inode = NULL; | 376 | inode = NULL; |
@@ -395,6 +398,7 @@ static int btrfs_readdir(struct file *filp, void *dirent, filldir_t filldir) | |||
395 | unsigned char d_type = DT_UNKNOWN; | 398 | unsigned char d_type = DT_UNKNOWN; |
396 | int over = 0; | 399 | int over = 0; |
397 | 400 | ||
401 | mutex_lock(&root->fs_info->fs_mutex); | ||
398 | key.objectid = inode->i_ino; | 402 | key.objectid = inode->i_ino; |
399 | key.flags = 0; | 403 | key.flags = 0; |
400 | btrfs_set_key_type(&key, BTRFS_DIR_ITEM_KEY); | 404 | btrfs_set_key_type(&key, BTRFS_DIR_ITEM_KEY); |
@@ -446,6 +450,7 @@ static int btrfs_readdir(struct file *filp, void *dirent, filldir_t filldir) | |||
446 | ret = 0; | 450 | ret = 0; |
447 | err: | 451 | err: |
448 | btrfs_release_path(root, &path); | 452 | btrfs_release_path(root, &path); |
453 | mutex_unlock(&root->fs_info->fs_mutex); | ||
449 | return ret; | 454 | return ret; |
450 | } | 455 | } |
451 | 456 | ||
@@ -667,8 +672,8 @@ static int btrfs_create(struct inode *dir, struct dentry *dentry, | |||
667 | inode->i_op = &btrfs_file_inode_operations; | 672 | inode->i_op = &btrfs_file_inode_operations; |
668 | } | 673 | } |
669 | dir->i_sb->s_dirt = 1; | 674 | dir->i_sb->s_dirt = 1; |
670 | btrfs_end_transaction(trans, root); | ||
671 | out_unlock: | 675 | out_unlock: |
676 | btrfs_end_transaction(trans, root); | ||
672 | mutex_unlock(&root->fs_info->fs_mutex); | 677 | mutex_unlock(&root->fs_info->fs_mutex); |
673 | if (drop_inode) { | 678 | if (drop_inode) { |
674 | inode_dec_link_count(inode); | 679 | inode_dec_link_count(inode); |