diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2016-01-22 15:40:57 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2016-01-22 18:04:28 -0500 |
commit | 5955102c9984fa081b2d570cfac75c97eecf8f3b (patch) | |
tree | a4744386eac4b916e847eb4eedfada158f6527b4 /fs | |
parent | 57b8f112cfe6622ddddb8c2641206bb5fa8a112d (diff) |
wrappers for ->i_mutex access
parallel to mutex_{lock,unlock,trylock,is_locked,lock_nested},
inode_foo(inode) being mutex_foo(&inode->i_mutex).
Please, use those for access to ->i_mutex; over the coming cycle
->i_mutex will become rwsem, with ->lookup() done with it held
only shared.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs')
136 files changed, 722 insertions, 722 deletions
diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c index 7bf835f85bc8..eadc894faea2 100644 --- a/fs/9p/vfs_file.c +++ b/fs/9p/vfs_file.c | |||
@@ -449,14 +449,14 @@ static int v9fs_file_fsync(struct file *filp, loff_t start, loff_t end, | |||
449 | if (retval) | 449 | if (retval) |
450 | return retval; | 450 | return retval; |
451 | 451 | ||
452 | mutex_lock(&inode->i_mutex); | 452 | inode_lock(inode); |
453 | p9_debug(P9_DEBUG_VFS, "filp %p datasync %x\n", filp, datasync); | 453 | p9_debug(P9_DEBUG_VFS, "filp %p datasync %x\n", filp, datasync); |
454 | 454 | ||
455 | fid = filp->private_data; | 455 | fid = filp->private_data; |
456 | v9fs_blank_wstat(&wstat); | 456 | v9fs_blank_wstat(&wstat); |
457 | 457 | ||
458 | retval = p9_client_wstat(fid, &wstat); | 458 | retval = p9_client_wstat(fid, &wstat); |
459 | mutex_unlock(&inode->i_mutex); | 459 | inode_unlock(inode); |
460 | 460 | ||
461 | return retval; | 461 | return retval; |
462 | } | 462 | } |
@@ -472,13 +472,13 @@ int v9fs_file_fsync_dotl(struct file *filp, loff_t start, loff_t end, | |||
472 | if (retval) | 472 | if (retval) |
473 | return retval; | 473 | return retval; |
474 | 474 | ||
475 | mutex_lock(&inode->i_mutex); | 475 | inode_lock(inode); |
476 | p9_debug(P9_DEBUG_VFS, "filp %p datasync %x\n", filp, datasync); | 476 | p9_debug(P9_DEBUG_VFS, "filp %p datasync %x\n", filp, datasync); |
477 | 477 | ||
478 | fid = filp->private_data; | 478 | fid = filp->private_data; |
479 | 479 | ||
480 | retval = p9_client_fsync(fid, datasync); | 480 | retval = p9_client_fsync(fid, datasync); |
481 | mutex_unlock(&inode->i_mutex); | 481 | inode_unlock(inode); |
482 | 482 | ||
483 | return retval; | 483 | return retval; |
484 | } | 484 | } |
diff --git a/fs/affs/file.c b/fs/affs/file.c index 659c579c4588..0548c53f41d5 100644 --- a/fs/affs/file.c +++ b/fs/affs/file.c | |||
@@ -33,11 +33,11 @@ affs_file_release(struct inode *inode, struct file *filp) | |||
33 | inode->i_ino, atomic_read(&AFFS_I(inode)->i_opencnt)); | 33 | inode->i_ino, atomic_read(&AFFS_I(inode)->i_opencnt)); |
34 | 34 | ||
35 | if (atomic_dec_and_test(&AFFS_I(inode)->i_opencnt)) { | 35 | if (atomic_dec_and_test(&AFFS_I(inode)->i_opencnt)) { |
36 | mutex_lock(&inode->i_mutex); | 36 | inode_lock(inode); |
37 | if (inode->i_size != AFFS_I(inode)->mmu_private) | 37 | if (inode->i_size != AFFS_I(inode)->mmu_private) |
38 | affs_truncate(inode); | 38 | affs_truncate(inode); |
39 | affs_free_prealloc(inode); | 39 | affs_free_prealloc(inode); |
40 | mutex_unlock(&inode->i_mutex); | 40 | inode_unlock(inode); |
41 | } | 41 | } |
42 | 42 | ||
43 | return 0; | 43 | return 0; |
@@ -958,12 +958,12 @@ int affs_file_fsync(struct file *filp, loff_t start, loff_t end, int datasync) | |||
958 | if (err) | 958 | if (err) |
959 | return err; | 959 | return err; |
960 | 960 | ||
961 | mutex_lock(&inode->i_mutex); | 961 | inode_lock(inode); |
962 | ret = write_inode_now(inode, 0); | 962 | ret = write_inode_now(inode, 0); |
963 | err = sync_blockdev(inode->i_sb->s_bdev); | 963 | err = sync_blockdev(inode->i_sb->s_bdev); |
964 | if (!ret) | 964 | if (!ret) |
965 | ret = err; | 965 | ret = err; |
966 | mutex_unlock(&inode->i_mutex); | 966 | inode_unlock(inode); |
967 | return ret; | 967 | return ret; |
968 | } | 968 | } |
969 | const struct file_operations affs_file_operations = { | 969 | const struct file_operations affs_file_operations = { |
diff --git a/fs/afs/flock.c b/fs/afs/flock.c index 4baf1d2b39e4..d91a9c9cfbd0 100644 --- a/fs/afs/flock.c +++ b/fs/afs/flock.c | |||
@@ -483,7 +483,7 @@ static int afs_do_getlk(struct file *file, struct file_lock *fl) | |||
483 | 483 | ||
484 | fl->fl_type = F_UNLCK; | 484 | fl->fl_type = F_UNLCK; |
485 | 485 | ||
486 | mutex_lock(&vnode->vfs_inode.i_mutex); | 486 | inode_lock(&vnode->vfs_inode); |
487 | 487 | ||
488 | /* check local lock records first */ | 488 | /* check local lock records first */ |
489 | ret = 0; | 489 | ret = 0; |
@@ -505,7 +505,7 @@ static int afs_do_getlk(struct file *file, struct file_lock *fl) | |||
505 | } | 505 | } |
506 | 506 | ||
507 | error: | 507 | error: |
508 | mutex_unlock(&vnode->vfs_inode.i_mutex); | 508 | inode_unlock(&vnode->vfs_inode); |
509 | _leave(" = %d [%hd]", ret, fl->fl_type); | 509 | _leave(" = %d [%hd]", ret, fl->fl_type); |
510 | return ret; | 510 | return ret; |
511 | } | 511 | } |
diff --git a/fs/afs/write.c b/fs/afs/write.c index 0714abcd7f32..dfef94f70667 100644 --- a/fs/afs/write.c +++ b/fs/afs/write.c | |||
@@ -693,7 +693,7 @@ int afs_fsync(struct file *file, loff_t start, loff_t end, int datasync) | |||
693 | ret = filemap_write_and_wait_range(inode->i_mapping, start, end); | 693 | ret = filemap_write_and_wait_range(inode->i_mapping, start, end); |
694 | if (ret) | 694 | if (ret) |
695 | return ret; | 695 | return ret; |
696 | mutex_lock(&inode->i_mutex); | 696 | inode_lock(inode); |
697 | 697 | ||
698 | /* use a writeback record as a marker in the queue - when this reaches | 698 | /* use a writeback record as a marker in the queue - when this reaches |
699 | * the front of the queue, all the outstanding writes are either | 699 | * the front of the queue, all the outstanding writes are either |
@@ -735,7 +735,7 @@ int afs_fsync(struct file *file, loff_t start, loff_t end, int datasync) | |||
735 | afs_put_writeback(wb); | 735 | afs_put_writeback(wb); |
736 | _leave(" = %d", ret); | 736 | _leave(" = %d", ret); |
737 | out: | 737 | out: |
738 | mutex_unlock(&inode->i_mutex); | 738 | inode_unlock(inode); |
739 | return ret; | 739 | return ret; |
740 | } | 740 | } |
741 | 741 | ||
@@ -195,7 +195,7 @@ int notify_change(struct dentry * dentry, struct iattr * attr, struct inode **de | |||
195 | struct timespec now; | 195 | struct timespec now; |
196 | unsigned int ia_valid = attr->ia_valid; | 196 | unsigned int ia_valid = attr->ia_valid; |
197 | 197 | ||
198 | WARN_ON_ONCE(!mutex_is_locked(&inode->i_mutex)); | 198 | WARN_ON_ONCE(!inode_is_locked(inode)); |
199 | 199 | ||
200 | if (ia_valid & (ATTR_MODE | ATTR_UID | ATTR_GID | ATTR_TIMES_SET)) { | 200 | if (ia_valid & (ATTR_MODE | ATTR_UID | ATTR_GID | ATTR_TIMES_SET)) { |
201 | if (IS_IMMUTABLE(inode) || IS_APPEND(inode)) | 201 | if (IS_IMMUTABLE(inode) || IS_APPEND(inode)) |
diff --git a/fs/binfmt_misc.c b/fs/binfmt_misc.c index 78f005f37847..3a3ced779fc7 100644 --- a/fs/binfmt_misc.c +++ b/fs/binfmt_misc.c | |||
@@ -638,11 +638,11 @@ static ssize_t bm_entry_write(struct file *file, const char __user *buffer, | |||
638 | case 3: | 638 | case 3: |
639 | /* Delete this handler. */ | 639 | /* Delete this handler. */ |
640 | root = dget(file->f_path.dentry->d_sb->s_root); | 640 | root = dget(file->f_path.dentry->d_sb->s_root); |
641 | mutex_lock(&d_inode(root)->i_mutex); | 641 | inode_lock(d_inode(root)); |
642 | 642 | ||
643 | kill_node(e); | 643 | kill_node(e); |
644 | 644 | ||
645 | mutex_unlock(&d_inode(root)->i_mutex); | 645 | inode_unlock(d_inode(root)); |
646 | dput(root); | 646 | dput(root); |
647 | break; | 647 | break; |
648 | default: | 648 | default: |
@@ -675,7 +675,7 @@ static ssize_t bm_register_write(struct file *file, const char __user *buffer, | |||
675 | return PTR_ERR(e); | 675 | return PTR_ERR(e); |
676 | 676 | ||
677 | root = dget(sb->s_root); | 677 | root = dget(sb->s_root); |
678 | mutex_lock(&d_inode(root)->i_mutex); | 678 | inode_lock(d_inode(root)); |
679 | dentry = lookup_one_len(e->name, root, strlen(e->name)); | 679 | dentry = lookup_one_len(e->name, root, strlen(e->name)); |
680 | err = PTR_ERR(dentry); | 680 | err = PTR_ERR(dentry); |
681 | if (IS_ERR(dentry)) | 681 | if (IS_ERR(dentry)) |
@@ -711,7 +711,7 @@ static ssize_t bm_register_write(struct file *file, const char __user *buffer, | |||
711 | out2: | 711 | out2: |
712 | dput(dentry); | 712 | dput(dentry); |
713 | out: | 713 | out: |
714 | mutex_unlock(&d_inode(root)->i_mutex); | 714 | inode_unlock(d_inode(root)); |
715 | dput(root); | 715 | dput(root); |
716 | 716 | ||
717 | if (err) { | 717 | if (err) { |
@@ -754,12 +754,12 @@ static ssize_t bm_status_write(struct file *file, const char __user *buffer, | |||
754 | case 3: | 754 | case 3: |
755 | /* Delete all handlers. */ | 755 | /* Delete all handlers. */ |
756 | root = dget(file->f_path.dentry->d_sb->s_root); | 756 | root = dget(file->f_path.dentry->d_sb->s_root); |
757 | mutex_lock(&d_inode(root)->i_mutex); | 757 | inode_lock(d_inode(root)); |
758 | 758 | ||
759 | while (!list_empty(&entries)) | 759 | while (!list_empty(&entries)) |
760 | kill_node(list_entry(entries.next, Node, list)); | 760 | kill_node(list_entry(entries.next, Node, list)); |
761 | 761 | ||
762 | mutex_unlock(&d_inode(root)->i_mutex); | 762 | inode_unlock(d_inode(root)); |
763 | dput(root); | 763 | dput(root); |
764 | break; | 764 | break; |
765 | default: | 765 | default: |
diff --git a/fs/block_dev.c b/fs/block_dev.c index ba762ea07f67..2c3aeab17e20 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c | |||
@@ -346,9 +346,9 @@ static loff_t block_llseek(struct file *file, loff_t offset, int whence) | |||
346 | struct inode *bd_inode = bdev_file_inode(file); | 346 | struct inode *bd_inode = bdev_file_inode(file); |
347 | loff_t retval; | 347 | loff_t retval; |
348 | 348 | ||
349 | mutex_lock(&bd_inode->i_mutex); | 349 | inode_lock(bd_inode); |
350 | retval = fixed_size_llseek(file, offset, whence, i_size_read(bd_inode)); | 350 | retval = fixed_size_llseek(file, offset, whence, i_size_read(bd_inode)); |
351 | mutex_unlock(&bd_inode->i_mutex); | 351 | inode_unlock(bd_inode); |
352 | return retval; | 352 | return retval; |
353 | } | 353 | } |
354 | 354 | ||
@@ -1142,9 +1142,9 @@ void bd_set_size(struct block_device *bdev, loff_t size) | |||
1142 | { | 1142 | { |
1143 | unsigned bsize = bdev_logical_block_size(bdev); | 1143 | unsigned bsize = bdev_logical_block_size(bdev); |
1144 | 1144 | ||
1145 | mutex_lock(&bdev->bd_inode->i_mutex); | 1145 | inode_lock(bdev->bd_inode); |
1146 | i_size_write(bdev->bd_inode, size); | 1146 | i_size_write(bdev->bd_inode, size); |
1147 | mutex_unlock(&bdev->bd_inode->i_mutex); | 1147 | inode_unlock(bdev->bd_inode); |
1148 | while (bsize < PAGE_CACHE_SIZE) { | 1148 | while (bsize < PAGE_CACHE_SIZE) { |
1149 | if (size & bsize) | 1149 | if (size & bsize) |
1150 | break; | 1150 | break; |
@@ -1741,9 +1741,9 @@ static void blkdev_vm_open(struct vm_area_struct *vma) | |||
1741 | struct inode *bd_inode = bdev_file_inode(vma->vm_file); | 1741 | struct inode *bd_inode = bdev_file_inode(vma->vm_file); |
1742 | struct block_device *bdev = I_BDEV(bd_inode); | 1742 | struct block_device *bdev = I_BDEV(bd_inode); |
1743 | 1743 | ||
1744 | mutex_lock(&bd_inode->i_mutex); | 1744 | inode_lock(bd_inode); |
1745 | bdev->bd_map_count++; | 1745 | bdev->bd_map_count++; |
1746 | mutex_unlock(&bd_inode->i_mutex); | 1746 | inode_unlock(bd_inode); |
1747 | } | 1747 | } |
1748 | 1748 | ||
1749 | static void blkdev_vm_close(struct vm_area_struct *vma) | 1749 | static void blkdev_vm_close(struct vm_area_struct *vma) |
@@ -1751,9 +1751,9 @@ static void blkdev_vm_close(struct vm_area_struct *vma) | |||
1751 | struct inode *bd_inode = bdev_file_inode(vma->vm_file); | 1751 | struct inode *bd_inode = bdev_file_inode(vma->vm_file); |
1752 | struct block_device *bdev = I_BDEV(bd_inode); | 1752 | struct block_device *bdev = I_BDEV(bd_inode); |
1753 | 1753 | ||
1754 | mutex_lock(&bd_inode->i_mutex); | 1754 | inode_lock(bd_inode); |
1755 | bdev->bd_map_count--; | 1755 | bdev->bd_map_count--; |
1756 | mutex_unlock(&bd_inode->i_mutex); | 1756 | inode_unlock(bd_inode); |
1757 | } | 1757 | } |
1758 | 1758 | ||
1759 | static const struct vm_operations_struct blkdev_dax_vm_ops = { | 1759 | static const struct vm_operations_struct blkdev_dax_vm_ops = { |
@@ -1777,7 +1777,7 @@ static int blkdev_mmap(struct file *file, struct vm_area_struct *vma) | |||
1777 | struct block_device *bdev = I_BDEV(bd_inode); | 1777 | struct block_device *bdev = I_BDEV(bd_inode); |
1778 | 1778 | ||
1779 | file_accessed(file); | 1779 | file_accessed(file); |
1780 | mutex_lock(&bd_inode->i_mutex); | 1780 | inode_lock(bd_inode); |
1781 | bdev->bd_map_count++; | 1781 | bdev->bd_map_count++; |
1782 | if (IS_DAX(bd_inode)) { | 1782 | if (IS_DAX(bd_inode)) { |
1783 | vma->vm_ops = &blkdev_dax_vm_ops; | 1783 | vma->vm_ops = &blkdev_dax_vm_ops; |
@@ -1785,7 +1785,7 @@ static int blkdev_mmap(struct file *file, struct vm_area_struct *vma) | |||
1785 | } else { | 1785 | } else { |
1786 | vma->vm_ops = &blkdev_default_vm_ops; | 1786 | vma->vm_ops = &blkdev_default_vm_ops; |
1787 | } | 1787 | } |
1788 | mutex_unlock(&bd_inode->i_mutex); | 1788 | inode_unlock(bd_inode); |
1789 | 1789 | ||
1790 | return 0; | 1790 | return 0; |
1791 | } | 1791 | } |
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index 9f5cc1e8e126..098bb8f690c9 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c | |||
@@ -1762,17 +1762,17 @@ static ssize_t btrfs_file_write_iter(struct kiocb *iocb, | |||
1762 | loff_t pos; | 1762 | loff_t pos; |
1763 | size_t count; | 1763 | size_t count; |
1764 | 1764 | ||
1765 | mutex_lock(&inode->i_mutex); | 1765 | inode_lock(inode); |
1766 | err = generic_write_checks(iocb, from); | 1766 | err = generic_write_checks(iocb, from); |
1767 | if (err <= 0) { | 1767 | if (err <= 0) { |
1768 | mutex_unlock(&inode->i_mutex); | 1768 | inode_unlock(inode); |
1769 | return err; | 1769 | return err; |
1770 | } | 1770 | } |
1771 | 1771 | ||
1772 | current->backing_dev_info = inode_to_bdi(inode); | 1772 | current->backing_dev_info = inode_to_bdi(inode); |
1773 | err = file_remove_privs(file); | 1773 | err = file_remove_privs(file); |
1774 | if (err) { | 1774 | if (err) { |
1775 | mutex_unlock(&inode->i_mutex); | 1775 | inode_unlock(inode); |
1776 | goto out; | 1776 | goto out; |
1777 | } | 1777 | } |
1778 | 1778 | ||
@@ -1783,7 +1783,7 @@ static ssize_t btrfs_file_write_iter(struct kiocb *iocb, | |||
1783 | * to stop this write operation to ensure FS consistency. | 1783 | * to stop this write operation to ensure FS consistency. |
1784 | */ | 1784 | */ |
1785 | if (test_bit(BTRFS_FS_STATE_ERROR, &root->fs_info->fs_state)) { | 1785 | if (test_bit(BTRFS_FS_STATE_ERROR, &root->fs_info->fs_state)) { |
1786 | mutex_unlock(&inode->i_mutex); | 1786 | inode_unlock(inode); |
1787 | err = -EROFS; | 1787 | err = -EROFS; |
1788 | goto out; | 1788 | goto out; |
1789 | } | 1789 | } |
@@ -1804,7 +1804,7 @@ static ssize_t btrfs_file_write_iter(struct kiocb *iocb, | |||
1804 | end_pos = round_up(pos + count, root->sectorsize); | 1804 | end_pos = round_up(pos + count, root->sectorsize); |
1805 | err = btrfs_cont_expand(inode, i_size_read(inode), end_pos); | 1805 | err = btrfs_cont_expand(inode, i_size_read(inode), end_pos); |
1806 | if (err) { | 1806 | if (err) { |
1807 | mutex_unlock(&inode->i_mutex); | 1807 | inode_unlock(inode); |
1808 | goto out; | 1808 | goto out; |
1809 | } | 1809 | } |
1810 | } | 1810 | } |
@@ -1820,7 +1820,7 @@ static ssize_t btrfs_file_write_iter(struct kiocb *iocb, | |||
1820 | iocb->ki_pos = pos + num_written; | 1820 | iocb->ki_pos = pos + num_written; |
1821 | } | 1821 | } |
1822 | 1822 | ||
1823 | mutex_unlock(&inode->i_mutex); | 1823 | inode_unlock(inode); |
1824 | 1824 | ||
1825 | /* | 1825 | /* |
1826 | * We also have to set last_sub_trans to the current log transid, | 1826 | * We also have to set last_sub_trans to the current log transid, |
@@ -1909,7 +1909,7 @@ int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync) | |||
1909 | if (ret) | 1909 | if (ret) |
1910 | return ret; | 1910 | return ret; |
1911 | 1911 | ||
1912 | mutex_lock(&inode->i_mutex); | 1912 | inode_lock(inode); |
1913 | atomic_inc(&root->log_batch); | 1913 | atomic_inc(&root->log_batch); |
1914 | full_sync = test_bit(BTRFS_INODE_NEEDS_FULL_SYNC, | 1914 | full_sync = test_bit(BTRFS_INODE_NEEDS_FULL_SYNC, |
1915 | &BTRFS_I(inode)->runtime_flags); | 1915 | &BTRFS_I(inode)->runtime_flags); |
@@ -1961,7 +1961,7 @@ int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync) | |||
1961 | ret = start_ordered_ops(inode, start, end); | 1961 | ret = start_ordered_ops(inode, start, end); |
1962 | } | 1962 | } |
1963 | if (ret) { | 1963 | if (ret) { |
1964 | mutex_unlock(&inode->i_mutex); | 1964 | inode_unlock(inode); |
1965 | goto out; | 1965 | goto out; |
1966 | } | 1966 | } |
1967 | atomic_inc(&root->log_batch); | 1967 | atomic_inc(&root->log_batch); |
@@ -2007,7 +2007,7 @@ int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync) | |||
2007 | */ | 2007 | */ |
2008 | clear_bit(BTRFS_INODE_NEEDS_FULL_SYNC, | 2008 | clear_bit(BTRFS_INODE_NEEDS_FULL_SYNC, |
2009 | &BTRFS_I(inode)->runtime_flags); | 2009 | &BTRFS_I(inode)->runtime_flags); |
2010 | mutex_unlock(&inode->i_mutex); | 2010 | inode_unlock(inode); |
2011 | goto out; | 2011 | goto out; |
2012 | } | 2012 | } |
2013 | 2013 | ||
@@ -2031,7 +2031,7 @@ int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync) | |||
2031 | trans = btrfs_start_transaction(root, 0); | 2031 | trans = btrfs_start_transaction(root, 0); |
2032 | if (IS_ERR(trans)) { | 2032 | if (IS_ERR(trans)) { |
2033 | ret = PTR_ERR(trans); | 2033 | ret = PTR_ERR(trans); |
2034 | mutex_unlock(&inode->i_mutex); | 2034 | inode_unlock(inode); |
2035 | goto out; | 2035 | goto out; |
2036 | } | 2036 | } |
2037 | trans->sync = true; | 2037 | trans->sync = true; |
@@ -2054,7 +2054,7 @@ int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync) | |||
2054 | * file again, but that will end up using the synchronization | 2054 | * file again, but that will end up using the synchronization |
2055 | * inside btrfs_sync_log to keep things safe. | 2055 | * inside btrfs_sync_log to keep things safe. |
2056 | */ | 2056 | */ |
2057 | mutex_unlock(&inode->i_mutex); | 2057 | inode_unlock(inode); |
2058 | 2058 | ||
2059 | /* | 2059 | /* |
2060 | * If any of the ordered extents had an error, just return it to user | 2060 | * If any of the ordered extents had an error, just return it to user |
@@ -2303,7 +2303,7 @@ static int btrfs_punch_hole(struct inode *inode, loff_t offset, loff_t len) | |||
2303 | if (ret) | 2303 | if (ret) |
2304 | return ret; | 2304 | return ret; |
2305 | 2305 | ||
2306 | mutex_lock(&inode->i_mutex); | 2306 | inode_lock(inode); |
2307 | ino_size = round_up(inode->i_size, PAGE_CACHE_SIZE); | 2307 | ino_size = round_up(inode->i_size, PAGE_CACHE_SIZE); |
2308 | ret = find_first_non_hole(inode, &offset, &len); | 2308 | ret = find_first_non_hole(inode, &offset, &len); |
2309 | if (ret < 0) | 2309 | if (ret < 0) |
@@ -2343,7 +2343,7 @@ static int btrfs_punch_hole(struct inode *inode, loff_t offset, loff_t len) | |||
2343 | truncated_page = true; | 2343 | truncated_page = true; |
2344 | ret = btrfs_truncate_page(inode, offset, 0, 0); | 2344 | ret = btrfs_truncate_page(inode, offset, 0, 0); |
2345 | if (ret) { | 2345 | if (ret) { |
2346 | mutex_unlock(&inode->i_mutex); | 2346 | inode_unlock(inode); |
2347 | return ret; | 2347 | return ret; |
2348 | } | 2348 | } |
2349 | } | 2349 | } |
@@ -2419,7 +2419,7 @@ static int btrfs_punch_hole(struct inode *inode, loff_t offset, loff_t len) | |||
2419 | ret = btrfs_wait_ordered_range(inode, lockstart, | 2419 | ret = btrfs_wait_ordered_range(inode, lockstart, |
2420 | lockend - lockstart + 1); | 2420 | lockend - lockstart + 1); |
2421 | if (ret) { | 2421 | if (ret) { |
2422 | mutex_unlock(&inode->i_mutex); | 2422 | inode_unlock(inode); |
2423 | return ret; | 2423 | return ret; |
2424 | } | 2424 | } |
2425 | } | 2425 | } |
@@ -2574,7 +2574,7 @@ out_only_mutex: | |||
2574 | ret = btrfs_end_transaction(trans, root); | 2574 | ret = btrfs_end_transaction(trans, root); |
2575 | } | 2575 | } |
2576 | } | 2576 | } |
2577 | mutex_unlock(&inode->i_mutex); | 2577 | inode_unlock(inode); |
2578 | if (ret && !err) | 2578 | if (ret && !err) |
2579 | err = ret; | 2579 | err = ret; |
2580 | return err; | 2580 | return err; |
@@ -2658,7 +2658,7 @@ static long btrfs_fallocate(struct file *file, int mode, | |||
2658 | if (ret < 0) | 2658 | if (ret < 0) |
2659 | return ret; | 2659 | return ret; |
2660 | 2660 | ||
2661 | mutex_lock(&inode->i_mutex); | 2661 | inode_lock(inode); |
2662 | ret = inode_newsize_ok(inode, alloc_end); | 2662 | ret = inode_newsize_ok(inode, alloc_end); |
2663 | if (ret) | 2663 | if (ret) |
2664 | goto out; | 2664 | goto out; |
@@ -2816,7 +2816,7 @@ out: | |||
2816 | * So this is completely used as cleanup. | 2816 | * So this is completely used as cleanup. |
2817 | */ | 2817 | */ |
2818 | btrfs_qgroup_free_data(inode, alloc_start, alloc_end - alloc_start); | 2818 | btrfs_qgroup_free_data(inode, alloc_start, alloc_end - alloc_start); |
2819 | mutex_unlock(&inode->i_mutex); | 2819 | inode_unlock(inode); |
2820 | /* Let go of our reservation. */ | 2820 | /* Let go of our reservation. */ |
2821 | btrfs_free_reserved_data_space(inode, alloc_start, | 2821 | btrfs_free_reserved_data_space(inode, alloc_start, |
2822 | alloc_end - alloc_start); | 2822 | alloc_end - alloc_start); |
@@ -2892,7 +2892,7 @@ static loff_t btrfs_file_llseek(struct file *file, loff_t offset, int whence) | |||
2892 | struct inode *inode = file->f_mapping->host; | 2892 | struct inode *inode = file->f_mapping->host; |
2893 | int ret; | 2893 | int ret; |
2894 | 2894 | ||
2895 | mutex_lock(&inode->i_mutex); | 2895 | inode_lock(inode); |
2896 | switch (whence) { | 2896 | switch (whence) { |
2897 | case SEEK_END: | 2897 | case SEEK_END: |
2898 | case SEEK_CUR: | 2898 | case SEEK_CUR: |
@@ -2901,20 +2901,20 @@ static loff_t btrfs_file_llseek(struct file *file, loff_t offset, int whence) | |||
2901 | case SEEK_DATA: | 2901 | case SEEK_DATA: |
2902 | case SEEK_HOLE: | 2902 | case SEEK_HOLE: |
2903 | if (offset >= i_size_read(inode)) { | 2903 | if (offset >= i_size_read(inode)) { |
2904 | mutex_unlock(&inode->i_mutex); | 2904 | inode_unlock(inode); |
2905 | return -ENXIO; | 2905 | return -ENXIO; |
2906 | } | 2906 | } |
2907 | 2907 | ||
2908 | ret = find_desired_extent(inode, &offset, whence); | 2908 | ret = find_desired_extent(inode, &offset, whence); |
2909 | if (ret) { | 2909 | if (ret) { |
2910 | mutex_unlock(&inode->i_mutex); | 2910 | inode_unlock(inode); |
2911 | return ret; | 2911 | return ret; |
2912 | } | 2912 | } |
2913 | } | 2913 | } |
2914 | 2914 | ||
2915 | offset = vfs_setpos(file, offset, inode->i_sb->s_maxbytes); | 2915 | offset = vfs_setpos(file, offset, inode->i_sb->s_maxbytes); |
2916 | out: | 2916 | out: |
2917 | mutex_unlock(&inode->i_mutex); | 2917 | inode_unlock(inode); |
2918 | return offset; | 2918 | return offset; |
2919 | } | 2919 | } |
2920 | 2920 | ||
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 1b79dc9b12e4..e28f3d4691af 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -8447,7 +8447,7 @@ static ssize_t btrfs_direct_IO(struct kiocb *iocb, struct iov_iter *iter, | |||
8447 | * not unlock the i_mutex at this case. | 8447 | * not unlock the i_mutex at this case. |
8448 | */ | 8448 | */ |
8449 | if (offset + count <= inode->i_size) { | 8449 | if (offset + count <= inode->i_size) { |
8450 | mutex_unlock(&inode->i_mutex); | 8450 | inode_unlock(inode); |
8451 | relock = true; | 8451 | relock = true; |
8452 | } | 8452 | } |
8453 | ret = btrfs_delalloc_reserve_space(inode, offset, count); | 8453 | ret = btrfs_delalloc_reserve_space(inode, offset, count); |
@@ -8504,7 +8504,7 @@ out: | |||
8504 | if (wakeup) | 8504 | if (wakeup) |
8505 | inode_dio_end(inode); | 8505 | inode_dio_end(inode); |
8506 | if (relock) | 8506 | if (relock) |
8507 | mutex_lock(&inode->i_mutex); | 8507 | inode_lock(inode); |
8508 | 8508 | ||
8509 | return ret; | 8509 | return ret; |
8510 | } | 8510 | } |
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 9028737ee9b5..952172ca7e45 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c | |||
@@ -240,7 +240,7 @@ static int btrfs_ioctl_setflags(struct file *file, void __user *arg) | |||
240 | if (ret) | 240 | if (ret) |
241 | return ret; | 241 | return ret; |
242 | 242 | ||
243 | mutex_lock(&inode->i_mutex); | 243 | inode_lock(inode); |
244 | 244 | ||
245 | ip_oldflags = ip->flags; | 245 | ip_oldflags = ip->flags; |
246 | i_oldflags = inode->i_flags; | 246 | i_oldflags = inode->i_flags; |
@@ -358,7 +358,7 @@ static int btrfs_ioctl_setflags(struct file *file, void __user *arg) | |||
358 | } | 358 | } |
359 | 359 | ||
360 | out_unlock: | 360 | out_unlock: |
361 | mutex_unlock(&inode->i_mutex); | 361 | inode_unlock(inode); |
362 | mnt_drop_write_file(file); | 362 | mnt_drop_write_file(file); |
363 | return ret; | 363 | return ret; |
364 | } | 364 | } |
@@ -881,7 +881,7 @@ out_up_read: | |||
881 | out_dput: | 881 | out_dput: |
882 | dput(dentry); | 882 | dput(dentry); |
883 | out_unlock: | 883 | out_unlock: |
884 | mutex_unlock(&dir->i_mutex); | 884 | inode_unlock(dir); |
885 | return error; | 885 | return error; |
886 | } | 886 | } |
887 | 887 | ||
@@ -1393,18 +1393,18 @@ int btrfs_defrag_file(struct inode *inode, struct file *file, | |||
1393 | ra_index += cluster; | 1393 | ra_index += cluster; |
1394 | } | 1394 | } |
1395 | 1395 | ||
1396 | mutex_lock(&inode->i_mutex); | 1396 | inode_lock(inode); |
1397 | if (range->flags & BTRFS_DEFRAG_RANGE_COMPRESS) | 1397 | if (range->flags & BTRFS_DEFRAG_RANGE_COMPRESS) |
1398 | BTRFS_I(inode)->force_compress = compress_type; | 1398 | BTRFS_I(inode)->force_compress = compress_type; |
1399 | ret = cluster_pages_for_defrag(inode, pages, i, cluster); | 1399 | ret = cluster_pages_for_defrag(inode, pages, i, cluster); |
1400 | if (ret < 0) { | 1400 | if (ret < 0) { |
1401 | mutex_unlock(&inode->i_mutex); | 1401 | inode_unlock(inode); |
1402 | goto out_ra; | 1402 | goto out_ra; |
1403 | } | 1403 | } |
1404 | 1404 | ||
1405 | defrag_count += ret; | 1405 | defrag_count += ret; |
1406 | balance_dirty_pages_ratelimited(inode->i_mapping); | 1406 | balance_dirty_pages_ratelimited(inode->i_mapping); |
1407 | mutex_unlock(&inode->i_mutex); | 1407 | inode_unlock(inode); |
1408 | 1408 | ||
1409 | if (newer_than) { | 1409 | if (newer_than) { |
1410 | if (newer_off == (u64)-1) | 1410 | if (newer_off == (u64)-1) |
@@ -1465,9 +1465,9 @@ int btrfs_defrag_file(struct inode *inode, struct file *file, | |||
1465 | 1465 | ||
1466 | out_ra: | 1466 | out_ra: |
1467 | if (range->flags & BTRFS_DEFRAG_RANGE_COMPRESS) { | 1467 | if (range->flags & BTRFS_DEFRAG_RANGE_COMPRESS) { |
1468 | mutex_lock(&inode->i_mutex); | 1468 | inode_lock(inode); |
1469 | BTRFS_I(inode)->force_compress = BTRFS_COMPRESS_NONE; | 1469 | BTRFS_I(inode)->force_compress = BTRFS_COMPRESS_NONE; |
1470 | mutex_unlock(&inode->i_mutex); | 1470 | inode_unlock(inode); |
1471 | } | 1471 | } |
1472 | if (!file) | 1472 | if (!file) |
1473 | kfree(ra); | 1473 | kfree(ra); |
@@ -2430,7 +2430,7 @@ static noinline int btrfs_ioctl_snap_destroy(struct file *file, | |||
2430 | goto out_dput; | 2430 | goto out_dput; |
2431 | } | 2431 | } |
2432 | 2432 | ||
2433 | mutex_lock(&inode->i_mutex); | 2433 | inode_lock(inode); |
2434 | 2434 | ||
2435 | /* | 2435 | /* |
2436 | * Don't allow to delete a subvolume with send in progress. This is | 2436 | * Don't allow to delete a subvolume with send in progress. This is |
@@ -2543,7 +2543,7 @@ out_up_write: | |||
2543 | spin_unlock(&dest->root_item_lock); | 2543 | spin_unlock(&dest->root_item_lock); |
2544 | } | 2544 | } |
2545 | out_unlock_inode: | 2545 | out_unlock_inode: |
2546 | mutex_unlock(&inode->i_mutex); | 2546 | inode_unlock(inode); |
2547 | if (!err) { | 2547 | if (!err) { |
2548 | d_invalidate(dentry); | 2548 | d_invalidate(dentry); |
2549 | btrfs_invalidate_inodes(dest); | 2549 | btrfs_invalidate_inodes(dest); |
@@ -2559,7 +2559,7 @@ out_unlock_inode: | |||
2559 | out_dput: | 2559 | out_dput: |
2560 | dput(dentry); | 2560 | dput(dentry); |
2561 | out_unlock_dir: | 2561 | out_unlock_dir: |
2562 | mutex_unlock(&dir->i_mutex); | 2562 | inode_unlock(dir); |
2563 | out_drop_write: | 2563 | out_drop_write: |
2564 | mnt_drop_write_file(file); | 2564 | mnt_drop_write_file(file); |
2565 | out: | 2565 | out: |
@@ -2857,8 +2857,8 @@ static inline void lock_extent_range(struct inode *inode, u64 off, u64 len) | |||
2857 | 2857 | ||
2858 | static void btrfs_double_inode_unlock(struct inode *inode1, struct inode *inode2) | 2858 | static void btrfs_double_inode_unlock(struct inode *inode1, struct inode *inode2) |
2859 | { | 2859 | { |
2860 | mutex_unlock(&inode1->i_mutex); | 2860 | inode_unlock(inode1); |
2861 | mutex_unlock(&inode2->i_mutex); | 2861 | inode_unlock(inode2); |
2862 | } | 2862 | } |
2863 | 2863 | ||
2864 | static void btrfs_double_inode_lock(struct inode *inode1, struct inode *inode2) | 2864 | static void btrfs_double_inode_lock(struct inode *inode1, struct inode *inode2) |
@@ -2866,8 +2866,8 @@ static void btrfs_double_inode_lock(struct inode *inode1, struct inode *inode2) | |||
2866 | if (inode1 < inode2) | 2866 | if (inode1 < inode2) |
2867 | swap(inode1, inode2); | 2867 | swap(inode1, inode2); |
2868 | 2868 | ||
2869 | mutex_lock_nested(&inode1->i_mutex, I_MUTEX_PARENT); | 2869 | inode_lock_nested(inode1, I_MUTEX_PARENT); |
2870 | mutex_lock_nested(&inode2->i_mutex, I_MUTEX_CHILD); | 2870 | inode_lock_nested(inode2, I_MUTEX_CHILD); |
2871 | } | 2871 | } |
2872 | 2872 | ||
2873 | static void btrfs_double_extent_unlock(struct inode *inode1, u64 loff1, | 2873 | static void btrfs_double_extent_unlock(struct inode *inode1, u64 loff1, |
@@ -3026,7 +3026,7 @@ static int btrfs_extent_same(struct inode *src, u64 loff, u64 olen, | |||
3026 | return 0; | 3026 | return 0; |
3027 | 3027 | ||
3028 | if (same_inode) { | 3028 | if (same_inode) { |
3029 | mutex_lock(&src->i_mutex); | 3029 | inode_lock(src); |
3030 | 3030 | ||
3031 | ret = extent_same_check_offsets(src, loff, &len, olen); | 3031 | ret = extent_same_check_offsets(src, loff, &len, olen); |
3032 | if (ret) | 3032 | if (ret) |
@@ -3101,7 +3101,7 @@ static int btrfs_extent_same(struct inode *src, u64 loff, u64 olen, | |||
3101 | btrfs_cmp_data_free(&cmp); | 3101 | btrfs_cmp_data_free(&cmp); |
3102 | out_unlock: | 3102 | out_unlock: |
3103 | if (same_inode) | 3103 | if (same_inode) |
3104 | mutex_unlock(&src->i_mutex); | 3104 | inode_unlock(src); |
3105 | else | 3105 | else |
3106 | btrfs_double_inode_unlock(src, dst); | 3106 | btrfs_double_inode_unlock(src, dst); |
3107 | 3107 | ||
@@ -3749,7 +3749,7 @@ static noinline int btrfs_clone_files(struct file *file, struct file *file_src, | |||
3749 | if (!same_inode) { | 3749 | if (!same_inode) { |
3750 | btrfs_double_inode_lock(src, inode); | 3750 | btrfs_double_inode_lock(src, inode); |
3751 | } else { | 3751 | } else { |
3752 | mutex_lock(&src->i_mutex); | 3752 | inode_lock(src); |
3753 | } | 3753 | } |
3754 | 3754 | ||
3755 | /* determine range to clone */ | 3755 | /* determine range to clone */ |
@@ -3820,7 +3820,7 @@ out_unlock: | |||
3820 | if (!same_inode) | 3820 | if (!same_inode) |
3821 | btrfs_double_inode_unlock(src, inode); | 3821 | btrfs_double_inode_unlock(src, inode); |
3822 | else | 3822 | else |
3823 | mutex_unlock(&src->i_mutex); | 3823 | inode_unlock(src); |
3824 | return ret; | 3824 | return ret; |
3825 | } | 3825 | } |
3826 | 3826 | ||
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c index ef6d8fc85853..fd1c4d982463 100644 --- a/fs/btrfs/relocation.c +++ b/fs/btrfs/relocation.c | |||
@@ -3030,7 +3030,7 @@ int prealloc_file_extent_cluster(struct inode *inode, | |||
3030 | int ret = 0; | 3030 | int ret = 0; |
3031 | 3031 | ||
3032 | BUG_ON(cluster->start != cluster->boundary[0]); | 3032 | BUG_ON(cluster->start != cluster->boundary[0]); |
3033 | mutex_lock(&inode->i_mutex); | 3033 | inode_lock(inode); |
3034 | 3034 | ||
3035 | ret = btrfs_check_data_free_space(inode, cluster->start, | 3035 | ret = btrfs_check_data_free_space(inode, cluster->start, |
3036 | cluster->end + 1 - cluster->start); | 3036 | cluster->end + 1 - cluster->start); |
@@ -3057,7 +3057,7 @@ int prealloc_file_extent_cluster(struct inode *inode, | |||
3057 | btrfs_free_reserved_data_space(inode, cluster->start, | 3057 | btrfs_free_reserved_data_space(inode, cluster->start, |
3058 | cluster->end + 1 - cluster->start); | 3058 | cluster->end + 1 - cluster->start); |
3059 | out: | 3059 | out: |
3060 | mutex_unlock(&inode->i_mutex); | 3060 | inode_unlock(inode); |
3061 | return ret; | 3061 | return ret; |
3062 | } | 3062 | } |
3063 | 3063 | ||
diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c index b1a68530e911..92bf5ee732fb 100644 --- a/fs/btrfs/scrub.c +++ b/fs/btrfs/scrub.c | |||
@@ -4279,7 +4279,7 @@ static int copy_nocow_pages_for_inode(u64 inum, u64 offset, u64 root, | |||
4279 | return PTR_ERR(inode); | 4279 | return PTR_ERR(inode); |
4280 | 4280 | ||
4281 | /* Avoid truncate/dio/punch hole.. */ | 4281 | /* Avoid truncate/dio/punch hole.. */ |
4282 | mutex_lock(&inode->i_mutex); | 4282 | inode_lock(inode); |
4283 | inode_dio_wait(inode); | 4283 | inode_dio_wait(inode); |
4284 | 4284 | ||
4285 | physical_for_dev_replace = nocow_ctx->physical_for_dev_replace; | 4285 | physical_for_dev_replace = nocow_ctx->physical_for_dev_replace; |
@@ -4358,7 +4358,7 @@ next_page: | |||
4358 | } | 4358 | } |
4359 | ret = COPY_COMPLETE; | 4359 | ret = COPY_COMPLETE; |
4360 | out: | 4360 | out: |
4361 | mutex_unlock(&inode->i_mutex); | 4361 | inode_unlock(inode); |
4362 | iput(inode); | 4362 | iput(inode); |
4363 | return ret; | 4363 | return ret; |
4364 | } | 4364 | } |
diff --git a/fs/btrfs/xattr.c b/fs/btrfs/xattr.c index fd953c361a43..6c68d6356197 100644 --- a/fs/btrfs/xattr.c +++ b/fs/btrfs/xattr.c | |||
@@ -126,7 +126,7 @@ static int do_setxattr(struct btrfs_trans_handle *trans, | |||
126 | * locks the inode's i_mutex before calling setxattr or removexattr. | 126 | * locks the inode's i_mutex before calling setxattr or removexattr. |
127 | */ | 127 | */ |
128 | if (flags & XATTR_REPLACE) { | 128 | if (flags & XATTR_REPLACE) { |
129 | ASSERT(mutex_is_locked(&inode->i_mutex)); | 129 | ASSERT(inode_is_locked(inode)); |
130 | di = btrfs_lookup_xattr(NULL, root, path, btrfs_ino(inode), | 130 | di = btrfs_lookup_xattr(NULL, root, path, btrfs_ino(inode), |
131 | name, name_len, 0); | 131 | name, name_len, 0); |
132 | if (!di) | 132 | if (!di) |
diff --git a/fs/cachefiles/interface.c b/fs/cachefiles/interface.c index afa023dded5b..675a3332d72f 100644 --- a/fs/cachefiles/interface.c +++ b/fs/cachefiles/interface.c | |||
@@ -446,7 +446,7 @@ static int cachefiles_attr_changed(struct fscache_object *_object) | |||
446 | return 0; | 446 | return 0; |
447 | 447 | ||
448 | cachefiles_begin_secure(cache, &saved_cred); | 448 | cachefiles_begin_secure(cache, &saved_cred); |
449 | mutex_lock(&d_inode(object->backer)->i_mutex); | 449 | inode_lock(d_inode(object->backer)); |
450 | 450 | ||
451 | /* if there's an extension to a partial page at the end of the backing | 451 | /* if there's an extension to a partial page at the end of the backing |
452 | * file, we need to discard the partial page so that we pick up new | 452 | * file, we need to discard the partial page so that we pick up new |
@@ -465,7 +465,7 @@ static int cachefiles_attr_changed(struct fscache_object *_object) | |||
465 | ret = notify_change(object->backer, &newattrs, NULL); | 465 | ret = notify_change(object->backer, &newattrs, NULL); |
466 | 466 | ||
467 | truncate_failed: | 467 | truncate_failed: |
468 | mutex_unlock(&d_inode(object->backer)->i_mutex); | 468 | inode_unlock(d_inode(object->backer)); |
469 | cachefiles_end_secure(cache, saved_cred); | 469 | cachefiles_end_secure(cache, saved_cred); |
470 | 470 | ||
471 | if (ret == -EIO) { | 471 | if (ret == -EIO) { |
diff --git a/fs/cachefiles/namei.c b/fs/cachefiles/namei.c index c4b893453e0e..1c2334c163dd 100644 --- a/fs/cachefiles/namei.c +++ b/fs/cachefiles/namei.c | |||
@@ -295,7 +295,7 @@ static int cachefiles_bury_object(struct cachefiles_cache *cache, | |||
295 | cachefiles_mark_object_buried(cache, rep, why); | 295 | cachefiles_mark_object_buried(cache, rep, why); |
296 | } | 296 | } |
297 | 297 | ||
298 | mutex_unlock(&d_inode(dir)->i_mutex); | 298 | inode_unlock(d_inode(dir)); |
299 | 299 | ||
300 | if (ret == -EIO) | 300 | if (ret == -EIO) |
301 | cachefiles_io_error(cache, "Unlink failed"); | 301 | cachefiles_io_error(cache, "Unlink failed"); |
@@ -306,7 +306,7 @@ static int cachefiles_bury_object(struct cachefiles_cache *cache, | |||
306 | 306 | ||
307 | /* directories have to be moved to the graveyard */ | 307 | /* directories have to be moved to the graveyard */ |
308 | _debug("move stale object to graveyard"); | 308 | _debug("move stale object to graveyard"); |
309 | mutex_unlock(&d_inode(dir)->i_mutex); | 309 | inode_unlock(d_inode(dir)); |
310 | 310 | ||
311 | try_again: | 311 | try_again: |
312 | /* first step is to make up a grave dentry in the graveyard */ | 312 | /* first step is to make up a grave dentry in the graveyard */ |
@@ -423,13 +423,13 @@ int cachefiles_delete_object(struct cachefiles_cache *cache, | |||
423 | 423 | ||
424 | dir = dget_parent(object->dentry); | 424 | dir = dget_parent(object->dentry); |
425 | 425 | ||
426 | mutex_lock_nested(&d_inode(dir)->i_mutex, I_MUTEX_PARENT); | 426 | inode_lock_nested(d_inode(dir), I_MUTEX_PARENT); |
427 | 427 | ||
428 | if (test_bit(FSCACHE_OBJECT_KILLED_BY_CACHE, &object->fscache.flags)) { | 428 | if (test_bit(FSCACHE_OBJECT_KILLED_BY_CACHE, &object->fscache.flags)) { |
429 | /* object allocation for the same key preemptively deleted this | 429 | /* object allocation for the same key preemptively deleted this |
430 | * object's file so that it could create its own file */ | 430 | * object's file so that it could create its own file */ |
431 | _debug("object preemptively buried"); | 431 | _debug("object preemptively buried"); |
432 | mutex_unlock(&d_inode(dir)->i_mutex); | 432 | inode_unlock(d_inode(dir)); |
433 | ret = 0; | 433 | ret = 0; |
434 | } else { | 434 | } else { |
435 | /* we need to check that our parent is _still_ our parent - it | 435 | /* we need to check that our parent is _still_ our parent - it |
@@ -442,7 +442,7 @@ int cachefiles_delete_object(struct cachefiles_cache *cache, | |||
442 | /* it got moved, presumably by cachefilesd culling it, | 442 | /* it got moved, presumably by cachefilesd culling it, |
443 | * so it's no longer in the key path and we can ignore | 443 | * so it's no longer in the key path and we can ignore |
444 | * it */ | 444 | * it */ |
445 | mutex_unlock(&d_inode(dir)->i_mutex); | 445 | inode_unlock(d_inode(dir)); |
446 | ret = 0; | 446 | ret = 0; |
447 | } | 447 | } |
448 | } | 448 | } |
@@ -501,7 +501,7 @@ lookup_again: | |||
501 | /* search the current directory for the element name */ | 501 | /* search the current directory for the element name */ |
502 | _debug("lookup '%s'", name); | 502 | _debug("lookup '%s'", name); |
503 | 503 | ||
504 | mutex_lock_nested(&d_inode(dir)->i_mutex, I_MUTEX_PARENT); | 504 | inode_lock_nested(d_inode(dir), I_MUTEX_PARENT); |
505 | 505 | ||
506 | start = jiffies; | 506 | start = jiffies; |
507 | next = lookup_one_len(name, dir, nlen); | 507 | next = lookup_one_len(name, dir, nlen); |
@@ -585,7 +585,7 @@ lookup_again: | |||
585 | /* process the next component */ | 585 | /* process the next component */ |
586 | if (key) { | 586 | if (key) { |
587 | _debug("advance"); | 587 | _debug("advance"); |
588 | mutex_unlock(&d_inode(dir)->i_mutex); | 588 | inode_unlock(d_inode(dir)); |
589 | dput(dir); | 589 | dput(dir); |
590 | dir = next; | 590 | dir = next; |
591 | next = NULL; | 591 | next = NULL; |
@@ -623,7 +623,7 @@ lookup_again: | |||
623 | /* note that we're now using this object */ | 623 | /* note that we're now using this object */ |
624 | ret = cachefiles_mark_object_active(cache, object); | 624 | ret = cachefiles_mark_object_active(cache, object); |
625 | 625 | ||
626 | mutex_unlock(&d_inode(dir)->i_mutex); | 626 | inode_unlock(d_inode(dir)); |
627 | dput(dir); | 627 | dput(dir); |
628 | dir = NULL; | 628 | dir = NULL; |
629 | 629 | ||
@@ -705,7 +705,7 @@ lookup_error: | |||
705 | cachefiles_io_error(cache, "Lookup failed"); | 705 | cachefiles_io_error(cache, "Lookup failed"); |
706 | next = NULL; | 706 | next = NULL; |
707 | error: | 707 | error: |
708 | mutex_unlock(&d_inode(dir)->i_mutex); | 708 | inode_unlock(d_inode(dir)); |
709 | dput(next); | 709 | dput(next); |
710 | error_out2: | 710 | error_out2: |
711 | dput(dir); | 711 | dput(dir); |
@@ -729,7 +729,7 @@ struct dentry *cachefiles_get_directory(struct cachefiles_cache *cache, | |||
729 | _enter(",,%s", dirname); | 729 | _enter(",,%s", dirname); |
730 | 730 | ||
731 | /* search the current directory for the element name */ | 731 | /* search the current directory for the element name */ |
732 | mutex_lock(&d_inode(dir)->i_mutex); | 732 | inode_lock(d_inode(dir)); |
733 | 733 | ||
734 | start = jiffies; | 734 | start = jiffies; |
735 | subdir = lookup_one_len(dirname, dir, strlen(dirname)); | 735 | subdir = lookup_one_len(dirname, dir, strlen(dirname)); |
@@ -768,7 +768,7 @@ struct dentry *cachefiles_get_directory(struct cachefiles_cache *cache, | |||
768 | d_backing_inode(subdir)->i_ino); | 768 | d_backing_inode(subdir)->i_ino); |
769 | } | 769 | } |
770 | 770 | ||
771 | mutex_unlock(&d_inode(dir)->i_mutex); | 771 | inode_unlock(d_inode(dir)); |
772 | 772 | ||
773 | /* we need to make sure the subdir is a directory */ | 773 | /* we need to make sure the subdir is a directory */ |
774 | ASSERT(d_backing_inode(subdir)); | 774 | ASSERT(d_backing_inode(subdir)); |
@@ -800,19 +800,19 @@ check_error: | |||
800 | return ERR_PTR(ret); | 800 | return ERR_PTR(ret); |
801 | 801 | ||
802 | mkdir_error: | 802 | mkdir_error: |
803 | mutex_unlock(&d_inode(dir)->i_mutex); | 803 | inode_unlock(d_inode(dir)); |
804 | dput(subdir); | 804 | dput(subdir); |
805 | pr_err("mkdir %s failed with error %d\n", dirname, ret); | 805 | pr_err("mkdir %s failed with error %d\n", dirname, ret); |
806 | return ERR_PTR(ret); | 806 | return ERR_PTR(ret); |
807 | 807 | ||
808 | lookup_error: | 808 | lookup_error: |
809 | mutex_unlock(&d_inode(dir)->i_mutex); | 809 | inode_unlock(d_inode(dir)); |
810 | ret = PTR_ERR(subdir); | 810 | ret = PTR_ERR(subdir); |
811 | pr_err("Lookup %s failed with error %d\n", dirname, ret); | 811 | pr_err("Lookup %s failed with error %d\n", dirname, ret); |
812 | return ERR_PTR(ret); | 812 | return ERR_PTR(ret); |
813 | 813 | ||
814 | nomem_d_alloc: | 814 | nomem_d_alloc: |
815 | mutex_unlock(&d_inode(dir)->i_mutex); | 815 | inode_unlock(d_inode(dir)); |
816 | _leave(" = -ENOMEM"); | 816 | _leave(" = -ENOMEM"); |
817 | return ERR_PTR(-ENOMEM); | 817 | return ERR_PTR(-ENOMEM); |
818 | } | 818 | } |
@@ -837,7 +837,7 @@ static struct dentry *cachefiles_check_active(struct cachefiles_cache *cache, | |||
837 | // dir, filename); | 837 | // dir, filename); |
838 | 838 | ||
839 | /* look up the victim */ | 839 | /* look up the victim */ |
840 | mutex_lock_nested(&d_inode(dir)->i_mutex, I_MUTEX_PARENT); | 840 | inode_lock_nested(d_inode(dir), I_MUTEX_PARENT); |
841 | 841 | ||
842 | start = jiffies; | 842 | start = jiffies; |
843 | victim = lookup_one_len(filename, dir, strlen(filename)); | 843 | victim = lookup_one_len(filename, dir, strlen(filename)); |
@@ -852,7 +852,7 @@ static struct dentry *cachefiles_check_active(struct cachefiles_cache *cache, | |||
852 | * at the netfs's request whilst the cull was in progress | 852 | * at the netfs's request whilst the cull was in progress |
853 | */ | 853 | */ |
854 | if (d_is_negative(victim)) { | 854 | if (d_is_negative(victim)) { |
855 | mutex_unlock(&d_inode(dir)->i_mutex); | 855 | inode_unlock(d_inode(dir)); |
856 | dput(victim); | 856 | dput(victim); |
857 | _leave(" = -ENOENT [absent]"); | 857 | _leave(" = -ENOENT [absent]"); |
858 | return ERR_PTR(-ENOENT); | 858 | return ERR_PTR(-ENOENT); |
@@ -881,13 +881,13 @@ static struct dentry *cachefiles_check_active(struct cachefiles_cache *cache, | |||
881 | 881 | ||
882 | object_in_use: | 882 | object_in_use: |
883 | read_unlock(&cache->active_lock); | 883 | read_unlock(&cache->active_lock); |
884 | mutex_unlock(&d_inode(dir)->i_mutex); | 884 | inode_unlock(d_inode(dir)); |
885 | dput(victim); | 885 | dput(victim); |
886 | //_leave(" = -EBUSY [in use]"); | 886 | //_leave(" = -EBUSY [in use]"); |
887 | return ERR_PTR(-EBUSY); | 887 | return ERR_PTR(-EBUSY); |
888 | 888 | ||
889 | lookup_error: | 889 | lookup_error: |
890 | mutex_unlock(&d_inode(dir)->i_mutex); | 890 | inode_unlock(d_inode(dir)); |
891 | ret = PTR_ERR(victim); | 891 | ret = PTR_ERR(victim); |
892 | if (ret == -ENOENT) { | 892 | if (ret == -ENOENT) { |
893 | /* file or dir now absent - probably retired by netfs */ | 893 | /* file or dir now absent - probably retired by netfs */ |
@@ -947,7 +947,7 @@ int cachefiles_cull(struct cachefiles_cache *cache, struct dentry *dir, | |||
947 | return 0; | 947 | return 0; |
948 | 948 | ||
949 | error_unlock: | 949 | error_unlock: |
950 | mutex_unlock(&d_inode(dir)->i_mutex); | 950 | inode_unlock(d_inode(dir)); |
951 | error: | 951 | error: |
952 | dput(victim); | 952 | dput(victim); |
953 | if (ret == -ENOENT) { | 953 | if (ret == -ENOENT) { |
@@ -982,7 +982,7 @@ int cachefiles_check_in_use(struct cachefiles_cache *cache, struct dentry *dir, | |||
982 | if (IS_ERR(victim)) | 982 | if (IS_ERR(victim)) |
983 | return PTR_ERR(victim); | 983 | return PTR_ERR(victim); |
984 | 984 | ||
985 | mutex_unlock(&d_inode(dir)->i_mutex); | 985 | inode_unlock(d_inode(dir)); |
986 | dput(victim); | 986 | dput(victim); |
987 | //_leave(" = 0"); | 987 | //_leave(" = 0"); |
988 | return 0; | 988 | return 0; |
diff --git a/fs/ceph/cache.c b/fs/ceph/cache.c index a4766ded1ba7..7680e2626815 100644 --- a/fs/ceph/cache.c +++ b/fs/ceph/cache.c | |||
@@ -197,7 +197,7 @@ void ceph_fscache_register_inode_cookie(struct ceph_fs_client* fsc, | |||
197 | return; | 197 | return; |
198 | 198 | ||
199 | /* Avoid multiple racing open requests */ | 199 | /* Avoid multiple racing open requests */ |
200 | mutex_lock(&inode->i_mutex); | 200 | inode_lock(inode); |
201 | 201 | ||
202 | if (ci->fscache) | 202 | if (ci->fscache) |
203 | goto done; | 203 | goto done; |
@@ -207,7 +207,7 @@ void ceph_fscache_register_inode_cookie(struct ceph_fs_client* fsc, | |||
207 | ci, true); | 207 | ci, true); |
208 | fscache_check_consistency(ci->fscache); | 208 | fscache_check_consistency(ci->fscache); |
209 | done: | 209 | done: |
210 | mutex_unlock(&inode->i_mutex); | 210 | inode_unlock(inode); |
211 | 211 | ||
212 | } | 212 | } |
213 | 213 | ||
diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c index c69e1253b47b..cdbf8cf3d52c 100644 --- a/fs/ceph/caps.c +++ b/fs/ceph/caps.c | |||
@@ -2030,7 +2030,7 @@ int ceph_fsync(struct file *file, loff_t start, loff_t end, int datasync) | |||
2030 | if (datasync) | 2030 | if (datasync) |
2031 | goto out; | 2031 | goto out; |
2032 | 2032 | ||
2033 | mutex_lock(&inode->i_mutex); | 2033 | inode_lock(inode); |
2034 | 2034 | ||
2035 | dirty = try_flush_caps(inode, &flush_tid); | 2035 | dirty = try_flush_caps(inode, &flush_tid); |
2036 | dout("fsync dirty caps are %s\n", ceph_cap_string(dirty)); | 2036 | dout("fsync dirty caps are %s\n", ceph_cap_string(dirty)); |
@@ -2046,7 +2046,7 @@ int ceph_fsync(struct file *file, loff_t start, loff_t end, int datasync) | |||
2046 | ret = wait_event_interruptible(ci->i_cap_wq, | 2046 | ret = wait_event_interruptible(ci->i_cap_wq, |
2047 | caps_are_flushed(inode, flush_tid)); | 2047 | caps_are_flushed(inode, flush_tid)); |
2048 | } | 2048 | } |
2049 | mutex_unlock(&inode->i_mutex); | 2049 | inode_unlock(inode); |
2050 | out: | 2050 | out: |
2051 | dout("fsync %p%s result=%d\n", inode, datasync ? " datasync" : "", ret); | 2051 | dout("fsync %p%s result=%d\n", inode, datasync ? " datasync" : "", ret); |
2052 | return ret; | 2052 | return ret; |
diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c index 9314b4ea2375..fd11fb231a2e 100644 --- a/fs/ceph/dir.c +++ b/fs/ceph/dir.c | |||
@@ -507,7 +507,7 @@ static loff_t ceph_dir_llseek(struct file *file, loff_t offset, int whence) | |||
507 | loff_t old_offset = ceph_make_fpos(fi->frag, fi->next_offset); | 507 | loff_t old_offset = ceph_make_fpos(fi->frag, fi->next_offset); |
508 | loff_t retval; | 508 | loff_t retval; |
509 | 509 | ||
510 | mutex_lock(&inode->i_mutex); | 510 | inode_lock(inode); |
511 | retval = -EINVAL; | 511 | retval = -EINVAL; |
512 | switch (whence) { | 512 | switch (whence) { |
513 | case SEEK_CUR: | 513 | case SEEK_CUR: |
@@ -542,7 +542,7 @@ static loff_t ceph_dir_llseek(struct file *file, loff_t offset, int whence) | |||
542 | } | 542 | } |
543 | } | 543 | } |
544 | out: | 544 | out: |
545 | mutex_unlock(&inode->i_mutex); | 545 | inode_unlock(inode); |
546 | return retval; | 546 | return retval; |
547 | } | 547 | } |
548 | 548 | ||
diff --git a/fs/ceph/export.c b/fs/ceph/export.c index fe02ae7f056a..3b3172357326 100644 --- a/fs/ceph/export.c +++ b/fs/ceph/export.c | |||
@@ -215,7 +215,7 @@ static int ceph_get_name(struct dentry *parent, char *name, | |||
215 | if (IS_ERR(req)) | 215 | if (IS_ERR(req)) |
216 | return PTR_ERR(req); | 216 | return PTR_ERR(req); |
217 | 217 | ||
218 | mutex_lock(&d_inode(parent)->i_mutex); | 218 | inode_lock(d_inode(parent)); |
219 | 219 | ||
220 | req->r_inode = d_inode(child); | 220 | req->r_inode = d_inode(child); |
221 | ihold(d_inode(child)); | 221 | ihold(d_inode(child)); |
@@ -224,7 +224,7 @@ static int ceph_get_name(struct dentry *parent, char *name, | |||
224 | req->r_num_caps = 2; | 224 | req->r_num_caps = 2; |
225 | err = ceph_mdsc_do_request(mdsc, NULL, req); | 225 | err = ceph_mdsc_do_request(mdsc, NULL, req); |
226 | 226 | ||
227 | mutex_unlock(&d_inode(parent)->i_mutex); | 227 | inode_unlock(d_inode(parent)); |
228 | 228 | ||
229 | if (!err) { | 229 | if (!err) { |
230 | struct ceph_mds_reply_info_parsed *rinfo = &req->r_reply_info; | 230 | struct ceph_mds_reply_info_parsed *rinfo = &req->r_reply_info; |
diff --git a/fs/ceph/file.c b/fs/ceph/file.c index 3c68e6aee2f0..10c5ae79696e 100644 --- a/fs/ceph/file.c +++ b/fs/ceph/file.c | |||
@@ -1014,7 +1014,7 @@ static ssize_t ceph_write_iter(struct kiocb *iocb, struct iov_iter *from) | |||
1014 | if (!prealloc_cf) | 1014 | if (!prealloc_cf) |
1015 | return -ENOMEM; | 1015 | return -ENOMEM; |
1016 | 1016 | ||
1017 | mutex_lock(&inode->i_mutex); | 1017 | inode_lock(inode); |
1018 | 1018 | ||
1019 | /* We can write back this queue in page reclaim */ | 1019 | /* We can write back this queue in page reclaim */ |
1020 | current->backing_dev_info = inode_to_bdi(inode); | 1020 | current->backing_dev_info = inode_to_bdi(inode); |
@@ -1070,7 +1070,7 @@ retry_snap: | |||
1070 | (iocb->ki_flags & IOCB_DIRECT) || (fi->flags & CEPH_F_SYNC)) { | 1070 | (iocb->ki_flags & IOCB_DIRECT) || (fi->flags & CEPH_F_SYNC)) { |
1071 | struct ceph_snap_context *snapc; | 1071 | struct ceph_snap_context *snapc; |
1072 | struct iov_iter data; | 1072 | struct iov_iter data; |
1073 | mutex_unlock(&inode->i_mutex); | 1073 | inode_unlock(inode); |
1074 | 1074 | ||
1075 | spin_lock(&ci->i_ceph_lock); | 1075 | spin_lock(&ci->i_ceph_lock); |
1076 | if (__ceph_have_pending_cap_snap(ci)) { | 1076 | if (__ceph_have_pending_cap_snap(ci)) { |
@@ -1097,7 +1097,7 @@ retry_snap: | |||
1097 | "got EOLDSNAPC, retrying\n", | 1097 | "got EOLDSNAPC, retrying\n", |
1098 | inode, ceph_vinop(inode), | 1098 | inode, ceph_vinop(inode), |
1099 | pos, (unsigned)count); | 1099 | pos, (unsigned)count); |
1100 | mutex_lock(&inode->i_mutex); | 1100 | inode_lock(inode); |
1101 | goto retry_snap; | 1101 | goto retry_snap; |
1102 | } | 1102 | } |
1103 | if (written > 0) | 1103 | if (written > 0) |
@@ -1117,7 +1117,7 @@ retry_snap: | |||
1117 | iocb->ki_pos = pos + written; | 1117 | iocb->ki_pos = pos + written; |
1118 | if (inode->i_size > old_size) | 1118 | if (inode->i_size > old_size) |
1119 | ceph_fscache_update_objectsize(inode); | 1119 | ceph_fscache_update_objectsize(inode); |
1120 | mutex_unlock(&inode->i_mutex); | 1120 | inode_unlock(inode); |
1121 | } | 1121 | } |
1122 | 1122 | ||
1123 | if (written >= 0) { | 1123 | if (written >= 0) { |
@@ -1147,7 +1147,7 @@ retry_snap: | |||
1147 | goto out_unlocked; | 1147 | goto out_unlocked; |
1148 | 1148 | ||
1149 | out: | 1149 | out: |
1150 | mutex_unlock(&inode->i_mutex); | 1150 | inode_unlock(inode); |
1151 | out_unlocked: | 1151 | out_unlocked: |
1152 | ceph_free_cap_flush(prealloc_cf); | 1152 | ceph_free_cap_flush(prealloc_cf); |
1153 | current->backing_dev_info = NULL; | 1153 | current->backing_dev_info = NULL; |
@@ -1162,7 +1162,7 @@ static loff_t ceph_llseek(struct file *file, loff_t offset, int whence) | |||
1162 | struct inode *inode = file->f_mapping->host; | 1162 | struct inode *inode = file->f_mapping->host; |
1163 | int ret; | 1163 | int ret; |
1164 | 1164 | ||
1165 | mutex_lock(&inode->i_mutex); | 1165 | inode_lock(inode); |
1166 | 1166 | ||
1167 | if (whence == SEEK_END || whence == SEEK_DATA || whence == SEEK_HOLE) { | 1167 | if (whence == SEEK_END || whence == SEEK_DATA || whence == SEEK_HOLE) { |
1168 | ret = ceph_do_getattr(inode, CEPH_STAT_CAP_SIZE, false); | 1168 | ret = ceph_do_getattr(inode, CEPH_STAT_CAP_SIZE, false); |
@@ -1207,7 +1207,7 @@ static loff_t ceph_llseek(struct file *file, loff_t offset, int whence) | |||
1207 | offset = vfs_setpos(file, offset, inode->i_sb->s_maxbytes); | 1207 | offset = vfs_setpos(file, offset, inode->i_sb->s_maxbytes); |
1208 | 1208 | ||
1209 | out: | 1209 | out: |
1210 | mutex_unlock(&inode->i_mutex); | 1210 | inode_unlock(inode); |
1211 | return offset; | 1211 | return offset; |
1212 | } | 1212 | } |
1213 | 1213 | ||
@@ -1363,7 +1363,7 @@ static long ceph_fallocate(struct file *file, int mode, | |||
1363 | if (!prealloc_cf) | 1363 | if (!prealloc_cf) |
1364 | return -ENOMEM; | 1364 | return -ENOMEM; |
1365 | 1365 | ||
1366 | mutex_lock(&inode->i_mutex); | 1366 | inode_lock(inode); |
1367 | 1367 | ||
1368 | if (ceph_snap(inode) != CEPH_NOSNAP) { | 1368 | if (ceph_snap(inode) != CEPH_NOSNAP) { |
1369 | ret = -EROFS; | 1369 | ret = -EROFS; |
@@ -1418,7 +1418,7 @@ static long ceph_fallocate(struct file *file, int mode, | |||
1418 | 1418 | ||
1419 | ceph_put_cap_refs(ci, got); | 1419 | ceph_put_cap_refs(ci, got); |
1420 | unlock: | 1420 | unlock: |
1421 | mutex_unlock(&inode->i_mutex); | 1421 | inode_unlock(inode); |
1422 | ceph_free_cap_flush(prealloc_cf); | 1422 | ceph_free_cap_flush(prealloc_cf); |
1423 | return ret; | 1423 | return ret; |
1424 | } | 1424 | } |
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index c4c1169814b2..e24ca79b140c 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c | |||
@@ -640,9 +640,9 @@ cifs_get_root(struct smb_vol *vol, struct super_block *sb) | |||
640 | while (*s && *s != sep) | 640 | while (*s && *s != sep) |
641 | s++; | 641 | s++; |
642 | 642 | ||
643 | mutex_lock(&dir->i_mutex); | 643 | inode_lock(dir); |
644 | child = lookup_one_len(p, dentry, s - p); | 644 | child = lookup_one_len(p, dentry, s - p); |
645 | mutex_unlock(&dir->i_mutex); | 645 | inode_unlock(dir); |
646 | dput(dentry); | 646 | dput(dentry); |
647 | dentry = child; | 647 | dentry = child; |
648 | } while (!IS_ERR(dentry)); | 648 | } while (!IS_ERR(dentry)); |
diff --git a/fs/cifs/file.c b/fs/cifs/file.c index 0a2752b79e72..ff882aeaccc6 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c | |||
@@ -2267,7 +2267,7 @@ int cifs_strict_fsync(struct file *file, loff_t start, loff_t end, | |||
2267 | rc = filemap_write_and_wait_range(inode->i_mapping, start, end); | 2267 | rc = filemap_write_and_wait_range(inode->i_mapping, start, end); |
2268 | if (rc) | 2268 | if (rc) |
2269 | return rc; | 2269 | return rc; |
2270 | mutex_lock(&inode->i_mutex); | 2270 | inode_lock(inode); |
2271 | 2271 | ||
2272 | xid = get_xid(); | 2272 | xid = get_xid(); |
2273 | 2273 | ||
@@ -2292,7 +2292,7 @@ int cifs_strict_fsync(struct file *file, loff_t start, loff_t end, | |||
2292 | } | 2292 | } |
2293 | 2293 | ||
2294 | free_xid(xid); | 2294 | free_xid(xid); |
2295 | mutex_unlock(&inode->i_mutex); | 2295 | inode_unlock(inode); |
2296 | return rc; | 2296 | return rc; |
2297 | } | 2297 | } |
2298 | 2298 | ||
@@ -2309,7 +2309,7 @@ int cifs_fsync(struct file *file, loff_t start, loff_t end, int datasync) | |||
2309 | rc = filemap_write_and_wait_range(inode->i_mapping, start, end); | 2309 | rc = filemap_write_and_wait_range(inode->i_mapping, start, end); |
2310 | if (rc) | 2310 | if (rc) |
2311 | return rc; | 2311 | return rc; |
2312 | mutex_lock(&inode->i_mutex); | 2312 | inode_lock(inode); |
2313 | 2313 | ||
2314 | xid = get_xid(); | 2314 | xid = get_xid(); |
2315 | 2315 | ||
@@ -2326,7 +2326,7 @@ int cifs_fsync(struct file *file, loff_t start, loff_t end, int datasync) | |||
2326 | } | 2326 | } |
2327 | 2327 | ||
2328 | free_xid(xid); | 2328 | free_xid(xid); |
2329 | mutex_unlock(&inode->i_mutex); | 2329 | inode_unlock(inode); |
2330 | return rc; | 2330 | return rc; |
2331 | } | 2331 | } |
2332 | 2332 | ||
@@ -2672,7 +2672,7 @@ cifs_writev(struct kiocb *iocb, struct iov_iter *from) | |||
2672 | * with a brlock that prevents writing. | 2672 | * with a brlock that prevents writing. |
2673 | */ | 2673 | */ |
2674 | down_read(&cinode->lock_sem); | 2674 | down_read(&cinode->lock_sem); |
2675 | mutex_lock(&inode->i_mutex); | 2675 | inode_lock(inode); |
2676 | 2676 | ||
2677 | rc = generic_write_checks(iocb, from); | 2677 | rc = generic_write_checks(iocb, from); |
2678 | if (rc <= 0) | 2678 | if (rc <= 0) |
@@ -2685,7 +2685,7 @@ cifs_writev(struct kiocb *iocb, struct iov_iter *from) | |||
2685 | else | 2685 | else |
2686 | rc = -EACCES; | 2686 | rc = -EACCES; |
2687 | out: | 2687 | out: |
2688 | mutex_unlock(&inode->i_mutex); | 2688 | inode_unlock(inode); |
2689 | 2689 | ||
2690 | if (rc > 0) { | 2690 | if (rc > 0) { |
2691 | ssize_t err = generic_write_sync(file, iocb->ki_pos - rc, rc); | 2691 | ssize_t err = generic_write_sync(file, iocb->ki_pos - rc, rc); |
diff --git a/fs/coda/dir.c b/fs/coda/dir.c index fda9f4311212..42e731b8c80a 100644 --- a/fs/coda/dir.c +++ b/fs/coda/dir.c | |||
@@ -427,13 +427,13 @@ static int coda_readdir(struct file *coda_file, struct dir_context *ctx) | |||
427 | if (host_file->f_op->iterate) { | 427 | if (host_file->f_op->iterate) { |
428 | struct inode *host_inode = file_inode(host_file); | 428 | struct inode *host_inode = file_inode(host_file); |
429 | 429 | ||
430 | mutex_lock(&host_inode->i_mutex); | 430 | inode_lock(host_inode); |
431 | ret = -ENOENT; | 431 | ret = -ENOENT; |
432 | if (!IS_DEADDIR(host_inode)) { | 432 | if (!IS_DEADDIR(host_inode)) { |
433 | ret = host_file->f_op->iterate(host_file, ctx); | 433 | ret = host_file->f_op->iterate(host_file, ctx); |
434 | file_accessed(host_file); | 434 | file_accessed(host_file); |
435 | } | 435 | } |
436 | mutex_unlock(&host_inode->i_mutex); | 436 | inode_unlock(host_inode); |
437 | return ret; | 437 | return ret; |
438 | } | 438 | } |
439 | /* Venus: we must read Venus dirents from a file */ | 439 | /* Venus: we must read Venus dirents from a file */ |
diff --git a/fs/coda/file.c b/fs/coda/file.c index 1da3805f3ddc..f47c7483863b 100644 --- a/fs/coda/file.c +++ b/fs/coda/file.c | |||
@@ -71,12 +71,12 @@ coda_file_write_iter(struct kiocb *iocb, struct iov_iter *to) | |||
71 | 71 | ||
72 | host_file = cfi->cfi_container; | 72 | host_file = cfi->cfi_container; |
73 | file_start_write(host_file); | 73 | file_start_write(host_file); |
74 | mutex_lock(&coda_inode->i_mutex); | 74 | inode_lock(coda_inode); |
75 | ret = vfs_iter_write(cfi->cfi_container, to, &iocb->ki_pos); | 75 | ret = vfs_iter_write(cfi->cfi_container, to, &iocb->ki_pos); |
76 | coda_inode->i_size = file_inode(host_file)->i_size; | 76 | coda_inode->i_size = file_inode(host_file)->i_size; |
77 | coda_inode->i_blocks = (coda_inode->i_size + 511) >> 9; | 77 | coda_inode->i_blocks = (coda_inode->i_size + 511) >> 9; |
78 | coda_inode->i_mtime = coda_inode->i_ctime = CURRENT_TIME_SEC; | 78 | coda_inode->i_mtime = coda_inode->i_ctime = CURRENT_TIME_SEC; |
79 | mutex_unlock(&coda_inode->i_mutex); | 79 | inode_unlock(coda_inode); |
80 | file_end_write(host_file); | 80 | file_end_write(host_file); |
81 | return ret; | 81 | return ret; |
82 | } | 82 | } |
@@ -203,7 +203,7 @@ int coda_fsync(struct file *coda_file, loff_t start, loff_t end, int datasync) | |||
203 | err = filemap_write_and_wait_range(coda_inode->i_mapping, start, end); | 203 | err = filemap_write_and_wait_range(coda_inode->i_mapping, start, end); |
204 | if (err) | 204 | if (err) |
205 | return err; | 205 | return err; |
206 | mutex_lock(&coda_inode->i_mutex); | 206 | inode_lock(coda_inode); |
207 | 207 | ||
208 | cfi = CODA_FTOC(coda_file); | 208 | cfi = CODA_FTOC(coda_file); |
209 | BUG_ON(!cfi || cfi->cfi_magic != CODA_MAGIC); | 209 | BUG_ON(!cfi || cfi->cfi_magic != CODA_MAGIC); |
@@ -212,7 +212,7 @@ int coda_fsync(struct file *coda_file, loff_t start, loff_t end, int datasync) | |||
212 | err = vfs_fsync(host_file, datasync); | 212 | err = vfs_fsync(host_file, datasync); |
213 | if (!err && !datasync) | 213 | if (!err && !datasync) |
214 | err = venus_fsync(coda_inode->i_sb, coda_i2f(coda_inode)); | 214 | err = venus_fsync(coda_inode->i_sb, coda_i2f(coda_inode)); |
215 | mutex_unlock(&coda_inode->i_mutex); | 215 | inode_unlock(coda_inode); |
216 | 216 | ||
217 | return err; | 217 | return err; |
218 | } | 218 | } |
diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c index cab612b2ae76..f419519ec41f 100644 --- a/fs/configfs/dir.c +++ b/fs/configfs/dir.c | |||
@@ -640,13 +640,13 @@ static void detach_groups(struct config_group *group) | |||
640 | 640 | ||
641 | child = sd->s_dentry; | 641 | child = sd->s_dentry; |
642 | 642 | ||
643 | mutex_lock(&d_inode(child)->i_mutex); | 643 | inode_lock(d_inode(child)); |
644 | 644 | ||
645 | configfs_detach_group(sd->s_element); | 645 | configfs_detach_group(sd->s_element); |
646 | d_inode(child)->i_flags |= S_DEAD; | 646 | d_inode(child)->i_flags |= S_DEAD; |
647 | dont_mount(child); | 647 | dont_mount(child); |
648 | 648 | ||
649 | mutex_unlock(&d_inode(child)->i_mutex); | 649 | inode_unlock(d_inode(child)); |
650 | 650 | ||
651 | d_delete(child); | 651 | d_delete(child); |
652 | dput(child); | 652 | dput(child); |
@@ -834,11 +834,11 @@ static int configfs_attach_item(struct config_item *parent_item, | |||
834 | * the VFS may already have hit and used them. Thus, | 834 | * the VFS may already have hit and used them. Thus, |
835 | * we must lock them as rmdir() would. | 835 | * we must lock them as rmdir() would. |
836 | */ | 836 | */ |
837 | mutex_lock(&d_inode(dentry)->i_mutex); | 837 | inode_lock(d_inode(dentry)); |
838 | configfs_remove_dir(item); | 838 | configfs_remove_dir(item); |
839 | d_inode(dentry)->i_flags |= S_DEAD; | 839 | d_inode(dentry)->i_flags |= S_DEAD; |
840 | dont_mount(dentry); | 840 | dont_mount(dentry); |
841 | mutex_unlock(&d_inode(dentry)->i_mutex); | 841 | inode_unlock(d_inode(dentry)); |
842 | d_delete(dentry); | 842 | d_delete(dentry); |
843 | } | 843 | } |
844 | } | 844 | } |
@@ -874,7 +874,7 @@ static int configfs_attach_group(struct config_item *parent_item, | |||
874 | * We must also lock the inode to remove it safely in case of | 874 | * We must also lock the inode to remove it safely in case of |
875 | * error, as rmdir() would. | 875 | * error, as rmdir() would. |
876 | */ | 876 | */ |
877 | mutex_lock_nested(&d_inode(dentry)->i_mutex, I_MUTEX_CHILD); | 877 | inode_lock_nested(d_inode(dentry), I_MUTEX_CHILD); |
878 | configfs_adjust_dir_dirent_depth_before_populate(sd); | 878 | configfs_adjust_dir_dirent_depth_before_populate(sd); |
879 | ret = populate_groups(to_config_group(item)); | 879 | ret = populate_groups(to_config_group(item)); |
880 | if (ret) { | 880 | if (ret) { |
@@ -883,7 +883,7 @@ static int configfs_attach_group(struct config_item *parent_item, | |||
883 | dont_mount(dentry); | 883 | dont_mount(dentry); |
884 | } | 884 | } |
885 | configfs_adjust_dir_dirent_depth_after_populate(sd); | 885 | configfs_adjust_dir_dirent_depth_after_populate(sd); |
886 | mutex_unlock(&d_inode(dentry)->i_mutex); | 886 | inode_unlock(d_inode(dentry)); |
887 | if (ret) | 887 | if (ret) |
888 | d_delete(dentry); | 888 | d_delete(dentry); |
889 | } | 889 | } |
@@ -1135,7 +1135,7 @@ int configfs_depend_item(struct configfs_subsystem *subsys, | |||
1135 | * subsystem is really registered, and so we need to lock out | 1135 | * subsystem is really registered, and so we need to lock out |
1136 | * configfs_[un]register_subsystem(). | 1136 | * configfs_[un]register_subsystem(). |
1137 | */ | 1137 | */ |
1138 | mutex_lock(&d_inode(root)->i_mutex); | 1138 | inode_lock(d_inode(root)); |
1139 | 1139 | ||
1140 | subsys_sd = configfs_find_subsys_dentry(root->d_fsdata, s_item); | 1140 | subsys_sd = configfs_find_subsys_dentry(root->d_fsdata, s_item); |
1141 | if (!subsys_sd) { | 1141 | if (!subsys_sd) { |
@@ -1147,7 +1147,7 @@ int configfs_depend_item(struct configfs_subsystem *subsys, | |||
1147 | ret = configfs_do_depend_item(subsys_sd->s_dentry, target); | 1147 | ret = configfs_do_depend_item(subsys_sd->s_dentry, target); |
1148 | 1148 | ||
1149 | out_unlock_fs: | 1149 | out_unlock_fs: |
1150 | mutex_unlock(&d_inode(root)->i_mutex); | 1150 | inode_unlock(d_inode(root)); |
1151 | 1151 | ||
1152 | /* | 1152 | /* |
1153 | * If we succeeded, the fs is pinned via other methods. If not, | 1153 | * If we succeeded, the fs is pinned via other methods. If not, |
@@ -1230,7 +1230,7 @@ int configfs_depend_item_unlocked(struct configfs_subsystem *caller_subsys, | |||
1230 | * additional locking to prevent other subsystem from being | 1230 | * additional locking to prevent other subsystem from being |
1231 | * unregistered | 1231 | * unregistered |
1232 | */ | 1232 | */ |
1233 | mutex_lock(&d_inode(root->cg_item.ci_dentry)->i_mutex); | 1233 | inode_lock(d_inode(root->cg_item.ci_dentry)); |
1234 | 1234 | ||
1235 | /* | 1235 | /* |
1236 | * As we are trying to depend item from other subsystem | 1236 | * As we are trying to depend item from other subsystem |
@@ -1254,7 +1254,7 @@ out_root_unlock: | |||
1254 | * We were called from subsystem other than our target so we | 1254 | * We were called from subsystem other than our target so we |
1255 | * took some locks so now it's time to release them | 1255 | * took some locks so now it's time to release them |
1256 | */ | 1256 | */ |
1257 | mutex_unlock(&d_inode(root->cg_item.ci_dentry)->i_mutex); | 1257 | inode_unlock(d_inode(root->cg_item.ci_dentry)); |
1258 | 1258 | ||
1259 | return ret; | 1259 | return ret; |
1260 | } | 1260 | } |
@@ -1561,7 +1561,7 @@ int configfs_rename_dir(struct config_item * item, const char *new_name) | |||
1561 | down_write(&configfs_rename_sem); | 1561 | down_write(&configfs_rename_sem); |
1562 | parent = item->parent->dentry; | 1562 | parent = item->parent->dentry; |
1563 | 1563 | ||
1564 | mutex_lock(&d_inode(parent)->i_mutex); | 1564 | inode_lock(d_inode(parent)); |
1565 | 1565 | ||
1566 | new_dentry = lookup_one_len(new_name, parent, strlen(new_name)); | 1566 | new_dentry = lookup_one_len(new_name, parent, strlen(new_name)); |
1567 | if (!IS_ERR(new_dentry)) { | 1567 | if (!IS_ERR(new_dentry)) { |
@@ -1577,7 +1577,7 @@ int configfs_rename_dir(struct config_item * item, const char *new_name) | |||
1577 | error = -EEXIST; | 1577 | error = -EEXIST; |
1578 | dput(new_dentry); | 1578 | dput(new_dentry); |
1579 | } | 1579 | } |
1580 | mutex_unlock(&d_inode(parent)->i_mutex); | 1580 | inode_unlock(d_inode(parent)); |
1581 | up_write(&configfs_rename_sem); | 1581 | up_write(&configfs_rename_sem); |
1582 | 1582 | ||
1583 | return error; | 1583 | return error; |
@@ -1590,7 +1590,7 @@ static int configfs_dir_open(struct inode *inode, struct file *file) | |||
1590 | struct configfs_dirent * parent_sd = dentry->d_fsdata; | 1590 | struct configfs_dirent * parent_sd = dentry->d_fsdata; |
1591 | int err; | 1591 | int err; |
1592 | 1592 | ||
1593 | mutex_lock(&d_inode(dentry)->i_mutex); | 1593 | inode_lock(d_inode(dentry)); |
1594 | /* | 1594 | /* |
1595 | * Fake invisibility if dir belongs to a group/default groups hierarchy | 1595 | * Fake invisibility if dir belongs to a group/default groups hierarchy |
1596 | * being attached | 1596 | * being attached |
@@ -1603,7 +1603,7 @@ static int configfs_dir_open(struct inode *inode, struct file *file) | |||
1603 | else | 1603 | else |
1604 | err = 0; | 1604 | err = 0; |
1605 | } | 1605 | } |
1606 | mutex_unlock(&d_inode(dentry)->i_mutex); | 1606 | inode_unlock(d_inode(dentry)); |
1607 | 1607 | ||
1608 | return err; | 1608 | return err; |
1609 | } | 1609 | } |
@@ -1613,11 +1613,11 @@ static int configfs_dir_close(struct inode *inode, struct file *file) | |||
1613 | struct dentry * dentry = file->f_path.dentry; | 1613 | struct dentry * dentry = file->f_path.dentry; |
1614 | struct configfs_dirent * cursor = file->private_data; | 1614 | struct configfs_dirent * cursor = file->private_data; |
1615 | 1615 | ||
1616 | mutex_lock(&d_inode(dentry)->i_mutex); | 1616 | inode_lock(d_inode(dentry)); |
1617 | spin_lock(&configfs_dirent_lock); | 1617 | spin_lock(&configfs_dirent_lock); |
1618 | list_del_init(&cursor->s_sibling); | 1618 | list_del_init(&cursor->s_sibling); |
1619 | spin_unlock(&configfs_dirent_lock); | 1619 | spin_unlock(&configfs_dirent_lock); |
1620 | mutex_unlock(&d_inode(dentry)->i_mutex); | 1620 | inode_unlock(d_inode(dentry)); |
1621 | 1621 | ||
1622 | release_configfs_dirent(cursor); | 1622 | release_configfs_dirent(cursor); |
1623 | 1623 | ||
@@ -1698,7 +1698,7 @@ static loff_t configfs_dir_lseek(struct file *file, loff_t offset, int whence) | |||
1698 | { | 1698 | { |
1699 | struct dentry * dentry = file->f_path.dentry; | 1699 | struct dentry * dentry = file->f_path.dentry; |
1700 | 1700 | ||
1701 | mutex_lock(&d_inode(dentry)->i_mutex); | 1701 | inode_lock(d_inode(dentry)); |
1702 | switch (whence) { | 1702 | switch (whence) { |
1703 | case 1: | 1703 | case 1: |
1704 | offset += file->f_pos; | 1704 | offset += file->f_pos; |
@@ -1706,7 +1706,7 @@ static loff_t configfs_dir_lseek(struct file *file, loff_t offset, int whence) | |||
1706 | if (offset >= 0) | 1706 | if (offset >= 0) |
1707 | break; | 1707 | break; |
1708 | default: | 1708 | default: |
1709 | mutex_unlock(&d_inode(dentry)->i_mutex); | 1709 | inode_unlock(d_inode(dentry)); |
1710 | return -EINVAL; | 1710 | return -EINVAL; |
1711 | } | 1711 | } |
1712 | if (offset != file->f_pos) { | 1712 | if (offset != file->f_pos) { |
@@ -1732,7 +1732,7 @@ static loff_t configfs_dir_lseek(struct file *file, loff_t offset, int whence) | |||
1732 | spin_unlock(&configfs_dirent_lock); | 1732 | spin_unlock(&configfs_dirent_lock); |
1733 | } | 1733 | } |
1734 | } | 1734 | } |
1735 | mutex_unlock(&d_inode(dentry)->i_mutex); | 1735 | inode_unlock(d_inode(dentry)); |
1736 | return offset; | 1736 | return offset; |
1737 | } | 1737 | } |
1738 | 1738 | ||
@@ -1767,14 +1767,14 @@ int configfs_register_group(struct config_group *parent_group, | |||
1767 | 1767 | ||
1768 | parent = parent_group->cg_item.ci_dentry; | 1768 | parent = parent_group->cg_item.ci_dentry; |
1769 | 1769 | ||
1770 | mutex_lock_nested(&d_inode(parent)->i_mutex, I_MUTEX_PARENT); | 1770 | inode_lock_nested(d_inode(parent), I_MUTEX_PARENT); |
1771 | ret = create_default_group(parent_group, group); | 1771 | ret = create_default_group(parent_group, group); |
1772 | if (!ret) { | 1772 | if (!ret) { |
1773 | spin_lock(&configfs_dirent_lock); | 1773 | spin_lock(&configfs_dirent_lock); |
1774 | configfs_dir_set_ready(group->cg_item.ci_dentry->d_fsdata); | 1774 | configfs_dir_set_ready(group->cg_item.ci_dentry->d_fsdata); |
1775 | spin_unlock(&configfs_dirent_lock); | 1775 | spin_unlock(&configfs_dirent_lock); |
1776 | } | 1776 | } |
1777 | mutex_unlock(&d_inode(parent)->i_mutex); | 1777 | inode_unlock(d_inode(parent)); |
1778 | return ret; | 1778 | return ret; |
1779 | } | 1779 | } |
1780 | EXPORT_SYMBOL(configfs_register_group); | 1780 | EXPORT_SYMBOL(configfs_register_group); |
@@ -1791,7 +1791,7 @@ void configfs_unregister_group(struct config_group *group) | |||
1791 | struct dentry *dentry = group->cg_item.ci_dentry; | 1791 | struct dentry *dentry = group->cg_item.ci_dentry; |
1792 | struct dentry *parent = group->cg_item.ci_parent->ci_dentry; | 1792 | struct dentry *parent = group->cg_item.ci_parent->ci_dentry; |
1793 | 1793 | ||
1794 | mutex_lock_nested(&d_inode(parent)->i_mutex, I_MUTEX_PARENT); | 1794 | inode_lock_nested(d_inode(parent), I_MUTEX_PARENT); |
1795 | spin_lock(&configfs_dirent_lock); | 1795 | spin_lock(&configfs_dirent_lock); |
1796 | configfs_detach_prep(dentry, NULL); | 1796 | configfs_detach_prep(dentry, NULL); |
1797 | spin_unlock(&configfs_dirent_lock); | 1797 | spin_unlock(&configfs_dirent_lock); |
@@ -1800,7 +1800,7 @@ void configfs_unregister_group(struct config_group *group) | |||
1800 | d_inode(dentry)->i_flags |= S_DEAD; | 1800 | d_inode(dentry)->i_flags |= S_DEAD; |
1801 | dont_mount(dentry); | 1801 | dont_mount(dentry); |
1802 | d_delete(dentry); | 1802 | d_delete(dentry); |
1803 | mutex_unlock(&d_inode(parent)->i_mutex); | 1803 | inode_unlock(d_inode(parent)); |
1804 | 1804 | ||
1805 | dput(dentry); | 1805 | dput(dentry); |
1806 | 1806 | ||
@@ -1872,7 +1872,7 @@ int configfs_register_subsystem(struct configfs_subsystem *subsys) | |||
1872 | sd = root->d_fsdata; | 1872 | sd = root->d_fsdata; |
1873 | link_group(to_config_group(sd->s_element), group); | 1873 | link_group(to_config_group(sd->s_element), group); |
1874 | 1874 | ||
1875 | mutex_lock_nested(&d_inode(root)->i_mutex, I_MUTEX_PARENT); | 1875 | inode_lock_nested(d_inode(root), I_MUTEX_PARENT); |
1876 | 1876 | ||
1877 | err = -ENOMEM; | 1877 | err = -ENOMEM; |
1878 | dentry = d_alloc_name(root, group->cg_item.ci_name); | 1878 | dentry = d_alloc_name(root, group->cg_item.ci_name); |
@@ -1892,7 +1892,7 @@ int configfs_register_subsystem(struct configfs_subsystem *subsys) | |||
1892 | } | 1892 | } |
1893 | } | 1893 | } |
1894 | 1894 | ||
1895 | mutex_unlock(&d_inode(root)->i_mutex); | 1895 | inode_unlock(d_inode(root)); |
1896 | 1896 | ||
1897 | if (err) { | 1897 | if (err) { |
1898 | unlink_group(group); | 1898 | unlink_group(group); |
@@ -1913,9 +1913,9 @@ void configfs_unregister_subsystem(struct configfs_subsystem *subsys) | |||
1913 | return; | 1913 | return; |
1914 | } | 1914 | } |
1915 | 1915 | ||
1916 | mutex_lock_nested(&d_inode(root)->i_mutex, | 1916 | inode_lock_nested(d_inode(root), |
1917 | I_MUTEX_PARENT); | 1917 | I_MUTEX_PARENT); |
1918 | mutex_lock_nested(&d_inode(dentry)->i_mutex, I_MUTEX_CHILD); | 1918 | inode_lock_nested(d_inode(dentry), I_MUTEX_CHILD); |
1919 | mutex_lock(&configfs_symlink_mutex); | 1919 | mutex_lock(&configfs_symlink_mutex); |
1920 | spin_lock(&configfs_dirent_lock); | 1920 | spin_lock(&configfs_dirent_lock); |
1921 | if (configfs_detach_prep(dentry, NULL)) { | 1921 | if (configfs_detach_prep(dentry, NULL)) { |
@@ -1926,11 +1926,11 @@ void configfs_unregister_subsystem(struct configfs_subsystem *subsys) | |||
1926 | configfs_detach_group(&group->cg_item); | 1926 | configfs_detach_group(&group->cg_item); |
1927 | d_inode(dentry)->i_flags |= S_DEAD; | 1927 | d_inode(dentry)->i_flags |= S_DEAD; |
1928 | dont_mount(dentry); | 1928 | dont_mount(dentry); |
1929 | mutex_unlock(&d_inode(dentry)->i_mutex); | 1929 | inode_unlock(d_inode(dentry)); |
1930 | 1930 | ||
1931 | d_delete(dentry); | 1931 | d_delete(dentry); |
1932 | 1932 | ||
1933 | mutex_unlock(&d_inode(root)->i_mutex); | 1933 | inode_unlock(d_inode(root)); |
1934 | 1934 | ||
1935 | dput(dentry); | 1935 | dput(dentry); |
1936 | 1936 | ||
diff --git a/fs/configfs/file.c b/fs/configfs/file.c index 3687187c8ea5..33b7ee34eda5 100644 --- a/fs/configfs/file.c +++ b/fs/configfs/file.c | |||
@@ -540,10 +540,10 @@ int configfs_create_file(struct config_item * item, const struct configfs_attrib | |||
540 | umode_t mode = (attr->ca_mode & S_IALLUGO) | S_IFREG; | 540 | umode_t mode = (attr->ca_mode & S_IALLUGO) | S_IFREG; |
541 | int error = 0; | 541 | int error = 0; |
542 | 542 | ||
543 | mutex_lock_nested(&d_inode(dir)->i_mutex, I_MUTEX_NORMAL); | 543 | inode_lock_nested(d_inode(dir), I_MUTEX_NORMAL); |
544 | error = configfs_make_dirent(parent_sd, NULL, (void *) attr, mode, | 544 | error = configfs_make_dirent(parent_sd, NULL, (void *) attr, mode, |
545 | CONFIGFS_ITEM_ATTR); | 545 | CONFIGFS_ITEM_ATTR); |
546 | mutex_unlock(&d_inode(dir)->i_mutex); | 546 | inode_unlock(d_inode(dir)); |
547 | 547 | ||
548 | return error; | 548 | return error; |
549 | } | 549 | } |
@@ -562,10 +562,10 @@ int configfs_create_bin_file(struct config_item *item, | |||
562 | umode_t mode = (bin_attr->cb_attr.ca_mode & S_IALLUGO) | S_IFREG; | 562 | umode_t mode = (bin_attr->cb_attr.ca_mode & S_IALLUGO) | S_IFREG; |
563 | int error = 0; | 563 | int error = 0; |
564 | 564 | ||
565 | mutex_lock_nested(&dir->d_inode->i_mutex, I_MUTEX_NORMAL); | 565 | inode_lock_nested(dir->d_inode, I_MUTEX_NORMAL); |
566 | error = configfs_make_dirent(parent_sd, NULL, (void *) bin_attr, mode, | 566 | error = configfs_make_dirent(parent_sd, NULL, (void *) bin_attr, mode, |
567 | CONFIGFS_ITEM_BIN_ATTR); | 567 | CONFIGFS_ITEM_BIN_ATTR); |
568 | mutex_unlock(&dir->d_inode->i_mutex); | 568 | inode_unlock(dir->d_inode); |
569 | 569 | ||
570 | return error; | 570 | return error; |
571 | } | 571 | } |
diff --git a/fs/configfs/inode.c b/fs/configfs/inode.c index 0cc810e9dccc..cee087d8f7e0 100644 --- a/fs/configfs/inode.c +++ b/fs/configfs/inode.c | |||
@@ -255,7 +255,7 @@ void configfs_hash_and_remove(struct dentry * dir, const char * name) | |||
255 | /* no inode means this hasn't been made visible yet */ | 255 | /* no inode means this hasn't been made visible yet */ |
256 | return; | 256 | return; |
257 | 257 | ||
258 | mutex_lock(&d_inode(dir)->i_mutex); | 258 | inode_lock(d_inode(dir)); |
259 | list_for_each_entry(sd, &parent_sd->s_children, s_sibling) { | 259 | list_for_each_entry(sd, &parent_sd->s_children, s_sibling) { |
260 | if (!sd->s_element) | 260 | if (!sd->s_element) |
261 | continue; | 261 | continue; |
@@ -268,5 +268,5 @@ void configfs_hash_and_remove(struct dentry * dir, const char * name) | |||
268 | break; | 268 | break; |
269 | } | 269 | } |
270 | } | 270 | } |
271 | mutex_unlock(&d_inode(dir)->i_mutex); | 271 | inode_unlock(d_inode(dir)); |
272 | } | 272 | } |
@@ -248,10 +248,10 @@ ssize_t dax_do_io(struct kiocb *iocb, struct inode *inode, | |||
248 | 248 | ||
249 | if ((flags & DIO_LOCKING) && iov_iter_rw(iter) == READ) { | 249 | if ((flags & DIO_LOCKING) && iov_iter_rw(iter) == READ) { |
250 | struct address_space *mapping = inode->i_mapping; | 250 | struct address_space *mapping = inode->i_mapping; |
251 | mutex_lock(&inode->i_mutex); | 251 | inode_lock(inode); |
252 | retval = filemap_write_and_wait_range(mapping, pos, end - 1); | 252 | retval = filemap_write_and_wait_range(mapping, pos, end - 1); |
253 | if (retval) { | 253 | if (retval) { |
254 | mutex_unlock(&inode->i_mutex); | 254 | inode_unlock(inode); |
255 | goto out; | 255 | goto out; |
256 | } | 256 | } |
257 | } | 257 | } |
@@ -263,7 +263,7 @@ ssize_t dax_do_io(struct kiocb *iocb, struct inode *inode, | |||
263 | retval = dax_io(inode, iter, pos, end, get_block, &bh); | 263 | retval = dax_io(inode, iter, pos, end, get_block, &bh); |
264 | 264 | ||
265 | if ((flags & DIO_LOCKING) && iov_iter_rw(iter) == READ) | 265 | if ((flags & DIO_LOCKING) && iov_iter_rw(iter) == READ) |
266 | mutex_unlock(&inode->i_mutex); | 266 | inode_unlock(inode); |
267 | 267 | ||
268 | if ((retval > 0) && end_io) | 268 | if ((retval > 0) && end_io) |
269 | end_io(iocb, pos, retval, bh.b_private); | 269 | end_io(iocb, pos, retval, bh.b_private); |
diff --git a/fs/dcache.c b/fs/dcache.c index b4539e84e577..92d5140de851 100644 --- a/fs/dcache.c +++ b/fs/dcache.c | |||
@@ -2462,7 +2462,7 @@ EXPORT_SYMBOL(d_rehash); | |||
2462 | */ | 2462 | */ |
2463 | void dentry_update_name_case(struct dentry *dentry, struct qstr *name) | 2463 | void dentry_update_name_case(struct dentry *dentry, struct qstr *name) |
2464 | { | 2464 | { |
2465 | BUG_ON(!mutex_is_locked(&dentry->d_parent->d_inode->i_mutex)); | 2465 | BUG_ON(!inode_is_locked(dentry->d_parent->d_inode)); |
2466 | BUG_ON(dentry->d_name.len != name->len); /* d_lookup gives this */ | 2466 | BUG_ON(dentry->d_name.len != name->len); /* d_lookup gives this */ |
2467 | 2467 | ||
2468 | spin_lock(&dentry->d_lock); | 2468 | spin_lock(&dentry->d_lock); |
@@ -2738,7 +2738,7 @@ static int __d_unalias(struct inode *inode, | |||
2738 | if (!mutex_trylock(&dentry->d_sb->s_vfs_rename_mutex)) | 2738 | if (!mutex_trylock(&dentry->d_sb->s_vfs_rename_mutex)) |
2739 | goto out_err; | 2739 | goto out_err; |
2740 | m1 = &dentry->d_sb->s_vfs_rename_mutex; | 2740 | m1 = &dentry->d_sb->s_vfs_rename_mutex; |
2741 | if (!mutex_trylock(&alias->d_parent->d_inode->i_mutex)) | 2741 | if (!inode_trylock(alias->d_parent->d_inode)) |
2742 | goto out_err; | 2742 | goto out_err; |
2743 | m2 = &alias->d_parent->d_inode->i_mutex; | 2743 | m2 = &alias->d_parent->d_inode->i_mutex; |
2744 | out_unalias: | 2744 | out_unalias: |
diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c index b7fcc0de0b2f..bece948b363d 100644 --- a/fs/debugfs/inode.c +++ b/fs/debugfs/inode.c | |||
@@ -265,7 +265,7 @@ static struct dentry *start_creating(const char *name, struct dentry *parent) | |||
265 | if (!parent) | 265 | if (!parent) |
266 | parent = debugfs_mount->mnt_root; | 266 | parent = debugfs_mount->mnt_root; |
267 | 267 | ||
268 | mutex_lock(&d_inode(parent)->i_mutex); | 268 | inode_lock(d_inode(parent)); |
269 | dentry = lookup_one_len(name, parent, strlen(name)); | 269 | dentry = lookup_one_len(name, parent, strlen(name)); |
270 | if (!IS_ERR(dentry) && d_really_is_positive(dentry)) { | 270 | if (!IS_ERR(dentry) && d_really_is_positive(dentry)) { |
271 | dput(dentry); | 271 | dput(dentry); |
@@ -273,7 +273,7 @@ static struct dentry *start_creating(const char *name, struct dentry *parent) | |||
273 | } | 273 | } |
274 | 274 | ||
275 | if (IS_ERR(dentry)) { | 275 | if (IS_ERR(dentry)) { |
276 | mutex_unlock(&d_inode(parent)->i_mutex); | 276 | inode_unlock(d_inode(parent)); |
277 | simple_release_fs(&debugfs_mount, &debugfs_mount_count); | 277 | simple_release_fs(&debugfs_mount, &debugfs_mount_count); |
278 | } | 278 | } |
279 | 279 | ||
@@ -282,7 +282,7 @@ static struct dentry *start_creating(const char *name, struct dentry *parent) | |||
282 | 282 | ||
283 | static struct dentry *failed_creating(struct dentry *dentry) | 283 | static struct dentry *failed_creating(struct dentry *dentry) |
284 | { | 284 | { |
285 | mutex_unlock(&d_inode(dentry->d_parent)->i_mutex); | 285 | inode_unlock(d_inode(dentry->d_parent)); |
286 | dput(dentry); | 286 | dput(dentry); |
287 | simple_release_fs(&debugfs_mount, &debugfs_mount_count); | 287 | simple_release_fs(&debugfs_mount, &debugfs_mount_count); |
288 | return NULL; | 288 | return NULL; |
@@ -290,7 +290,7 @@ static struct dentry *failed_creating(struct dentry *dentry) | |||
290 | 290 | ||
291 | static struct dentry *end_creating(struct dentry *dentry) | 291 | static struct dentry *end_creating(struct dentry *dentry) |
292 | { | 292 | { |
293 | mutex_unlock(&d_inode(dentry->d_parent)->i_mutex); | 293 | inode_unlock(d_inode(dentry->d_parent)); |
294 | return dentry; | 294 | return dentry; |
295 | } | 295 | } |
296 | 296 | ||
@@ -560,9 +560,9 @@ void debugfs_remove(struct dentry *dentry) | |||
560 | if (!parent || d_really_is_negative(parent)) | 560 | if (!parent || d_really_is_negative(parent)) |
561 | return; | 561 | return; |
562 | 562 | ||
563 | mutex_lock(&d_inode(parent)->i_mutex); | 563 | inode_lock(d_inode(parent)); |
564 | ret = __debugfs_remove(dentry, parent); | 564 | ret = __debugfs_remove(dentry, parent); |
565 | mutex_unlock(&d_inode(parent)->i_mutex); | 565 | inode_unlock(d_inode(parent)); |
566 | if (!ret) | 566 | if (!ret) |
567 | simple_release_fs(&debugfs_mount, &debugfs_mount_count); | 567 | simple_release_fs(&debugfs_mount, &debugfs_mount_count); |
568 | } | 568 | } |
@@ -594,7 +594,7 @@ void debugfs_remove_recursive(struct dentry *dentry) | |||
594 | 594 | ||
595 | parent = dentry; | 595 | parent = dentry; |
596 | down: | 596 | down: |
597 | mutex_lock(&d_inode(parent)->i_mutex); | 597 | inode_lock(d_inode(parent)); |
598 | loop: | 598 | loop: |
599 | /* | 599 | /* |
600 | * The parent->d_subdirs is protected by the d_lock. Outside that | 600 | * The parent->d_subdirs is protected by the d_lock. Outside that |
@@ -609,7 +609,7 @@ void debugfs_remove_recursive(struct dentry *dentry) | |||
609 | /* perhaps simple_empty(child) makes more sense */ | 609 | /* perhaps simple_empty(child) makes more sense */ |
610 | if (!list_empty(&child->d_subdirs)) { | 610 | if (!list_empty(&child->d_subdirs)) { |
611 | spin_unlock(&parent->d_lock); | 611 | spin_unlock(&parent->d_lock); |
612 | mutex_unlock(&d_inode(parent)->i_mutex); | 612 | inode_unlock(d_inode(parent)); |
613 | parent = child; | 613 | parent = child; |
614 | goto down; | 614 | goto down; |
615 | } | 615 | } |
@@ -630,10 +630,10 @@ void debugfs_remove_recursive(struct dentry *dentry) | |||
630 | } | 630 | } |
631 | spin_unlock(&parent->d_lock); | 631 | spin_unlock(&parent->d_lock); |
632 | 632 | ||
633 | mutex_unlock(&d_inode(parent)->i_mutex); | 633 | inode_unlock(d_inode(parent)); |
634 | child = parent; | 634 | child = parent; |
635 | parent = parent->d_parent; | 635 | parent = parent->d_parent; |
636 | mutex_lock(&d_inode(parent)->i_mutex); | 636 | inode_lock(d_inode(parent)); |
637 | 637 | ||
638 | if (child != dentry) | 638 | if (child != dentry) |
639 | /* go up */ | 639 | /* go up */ |
@@ -641,7 +641,7 @@ void debugfs_remove_recursive(struct dentry *dentry) | |||
641 | 641 | ||
642 | if (!__debugfs_remove(child, parent)) | 642 | if (!__debugfs_remove(child, parent)) |
643 | simple_release_fs(&debugfs_mount, &debugfs_mount_count); | 643 | simple_release_fs(&debugfs_mount, &debugfs_mount_count); |
644 | mutex_unlock(&d_inode(parent)->i_mutex); | 644 | inode_unlock(d_inode(parent)); |
645 | } | 645 | } |
646 | EXPORT_SYMBOL_GPL(debugfs_remove_recursive); | 646 | EXPORT_SYMBOL_GPL(debugfs_remove_recursive); |
647 | 647 | ||
diff --git a/fs/devpts/inode.c b/fs/devpts/inode.c index c35ffdc12bba..1f107fd51328 100644 --- a/fs/devpts/inode.c +++ b/fs/devpts/inode.c | |||
@@ -255,7 +255,7 @@ static int mknod_ptmx(struct super_block *sb) | |||
255 | if (!uid_valid(root_uid) || !gid_valid(root_gid)) | 255 | if (!uid_valid(root_uid) || !gid_valid(root_gid)) |
256 | return -EINVAL; | 256 | return -EINVAL; |
257 | 257 | ||
258 | mutex_lock(&d_inode(root)->i_mutex); | 258 | inode_lock(d_inode(root)); |
259 | 259 | ||
260 | /* If we have already created ptmx node, return */ | 260 | /* If we have already created ptmx node, return */ |
261 | if (fsi->ptmx_dentry) { | 261 | if (fsi->ptmx_dentry) { |
@@ -292,7 +292,7 @@ static int mknod_ptmx(struct super_block *sb) | |||
292 | fsi->ptmx_dentry = dentry; | 292 | fsi->ptmx_dentry = dentry; |
293 | rc = 0; | 293 | rc = 0; |
294 | out: | 294 | out: |
295 | mutex_unlock(&d_inode(root)->i_mutex); | 295 | inode_unlock(d_inode(root)); |
296 | return rc; | 296 | return rc; |
297 | } | 297 | } |
298 | 298 | ||
@@ -615,7 +615,7 @@ struct inode *devpts_pty_new(struct inode *ptmx_inode, dev_t device, int index, | |||
615 | 615 | ||
616 | sprintf(s, "%d", index); | 616 | sprintf(s, "%d", index); |
617 | 617 | ||
618 | mutex_lock(&d_inode(root)->i_mutex); | 618 | inode_lock(d_inode(root)); |
619 | 619 | ||
620 | dentry = d_alloc_name(root, s); | 620 | dentry = d_alloc_name(root, s); |
621 | if (dentry) { | 621 | if (dentry) { |
@@ -626,7 +626,7 @@ struct inode *devpts_pty_new(struct inode *ptmx_inode, dev_t device, int index, | |||
626 | inode = ERR_PTR(-ENOMEM); | 626 | inode = ERR_PTR(-ENOMEM); |
627 | } | 627 | } |
628 | 628 | ||
629 | mutex_unlock(&d_inode(root)->i_mutex); | 629 | inode_unlock(d_inode(root)); |
630 | 630 | ||
631 | return inode; | 631 | return inode; |
632 | } | 632 | } |
@@ -671,7 +671,7 @@ void devpts_pty_kill(struct inode *inode) | |||
671 | 671 | ||
672 | BUG_ON(inode->i_rdev == MKDEV(TTYAUX_MAJOR, PTMX_MINOR)); | 672 | BUG_ON(inode->i_rdev == MKDEV(TTYAUX_MAJOR, PTMX_MINOR)); |
673 | 673 | ||
674 | mutex_lock(&d_inode(root)->i_mutex); | 674 | inode_lock(d_inode(root)); |
675 | 675 | ||
676 | dentry = d_find_alias(inode); | 676 | dentry = d_find_alias(inode); |
677 | 677 | ||
@@ -680,7 +680,7 @@ void devpts_pty_kill(struct inode *inode) | |||
680 | dput(dentry); /* d_alloc_name() in devpts_pty_new() */ | 680 | dput(dentry); /* d_alloc_name() in devpts_pty_new() */ |
681 | dput(dentry); /* d_find_alias above */ | 681 | dput(dentry); /* d_find_alias above */ |
682 | 682 | ||
683 | mutex_unlock(&d_inode(root)->i_mutex); | 683 | inode_unlock(d_inode(root)); |
684 | } | 684 | } |
685 | 685 | ||
686 | static int __init init_devpts_fs(void) | 686 | static int __init init_devpts_fs(void) |
diff --git a/fs/direct-io.c b/fs/direct-io.c index 602e8441bc0f..1b2f7ffc8b84 100644 --- a/fs/direct-io.c +++ b/fs/direct-io.c | |||
@@ -1157,12 +1157,12 @@ do_blockdev_direct_IO(struct kiocb *iocb, struct inode *inode, | |||
1157 | iocb->ki_filp->f_mapping; | 1157 | iocb->ki_filp->f_mapping; |
1158 | 1158 | ||
1159 | /* will be released by direct_io_worker */ | 1159 | /* will be released by direct_io_worker */ |
1160 | mutex_lock(&inode->i_mutex); | 1160 | inode_lock(inode); |
1161 | 1161 | ||
1162 | retval = filemap_write_and_wait_range(mapping, offset, | 1162 | retval = filemap_write_and_wait_range(mapping, offset, |
1163 | end - 1); | 1163 | end - 1); |
1164 | if (retval) { | 1164 | if (retval) { |
1165 | mutex_unlock(&inode->i_mutex); | 1165 | inode_unlock(inode); |
1166 | kmem_cache_free(dio_cache, dio); | 1166 | kmem_cache_free(dio_cache, dio); |
1167 | goto out; | 1167 | goto out; |
1168 | } | 1168 | } |
@@ -1173,7 +1173,7 @@ do_blockdev_direct_IO(struct kiocb *iocb, struct inode *inode, | |||
1173 | dio->i_size = i_size_read(inode); | 1173 | dio->i_size = i_size_read(inode); |
1174 | if (iov_iter_rw(iter) == READ && offset >= dio->i_size) { | 1174 | if (iov_iter_rw(iter) == READ && offset >= dio->i_size) { |
1175 | if (dio->flags & DIO_LOCKING) | 1175 | if (dio->flags & DIO_LOCKING) |
1176 | mutex_unlock(&inode->i_mutex); | 1176 | inode_unlock(inode); |
1177 | kmem_cache_free(dio_cache, dio); | 1177 | kmem_cache_free(dio_cache, dio); |
1178 | retval = 0; | 1178 | retval = 0; |
1179 | goto out; | 1179 | goto out; |
@@ -1295,7 +1295,7 @@ do_blockdev_direct_IO(struct kiocb *iocb, struct inode *inode, | |||
1295 | * of protecting us from looking up uninitialized blocks. | 1295 | * of protecting us from looking up uninitialized blocks. |
1296 | */ | 1296 | */ |
1297 | if (iov_iter_rw(iter) == READ && (dio->flags & DIO_LOCKING)) | 1297 | if (iov_iter_rw(iter) == READ && (dio->flags & DIO_LOCKING)) |
1298 | mutex_unlock(&dio->inode->i_mutex); | 1298 | inode_unlock(dio->inode); |
1299 | 1299 | ||
1300 | /* | 1300 | /* |
1301 | * The only time we want to leave bios in flight is when a successful | 1301 | * The only time we want to leave bios in flight is when a successful |
diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c index 040aa879d634..4e685ac1024d 100644 --- a/fs/ecryptfs/inode.c +++ b/fs/ecryptfs/inode.c | |||
@@ -41,13 +41,13 @@ static struct dentry *lock_parent(struct dentry *dentry) | |||
41 | struct dentry *dir; | 41 | struct dentry *dir; |
42 | 42 | ||
43 | dir = dget_parent(dentry); | 43 | dir = dget_parent(dentry); |
44 | mutex_lock_nested(&(d_inode(dir)->i_mutex), I_MUTEX_PARENT); | 44 | inode_lock_nested(d_inode(dir), I_MUTEX_PARENT); |
45 | return dir; | 45 | return dir; |
46 | } | 46 | } |
47 | 47 | ||
48 | static void unlock_dir(struct dentry *dir) | 48 | static void unlock_dir(struct dentry *dir) |
49 | { | 49 | { |
50 | mutex_unlock(&d_inode(dir)->i_mutex); | 50 | inode_unlock(d_inode(dir)); |
51 | dput(dir); | 51 | dput(dir); |
52 | } | 52 | } |
53 | 53 | ||
@@ -397,11 +397,11 @@ static struct dentry *ecryptfs_lookup(struct inode *ecryptfs_dir_inode, | |||
397 | int rc = 0; | 397 | int rc = 0; |
398 | 398 | ||
399 | lower_dir_dentry = ecryptfs_dentry_to_lower(ecryptfs_dentry->d_parent); | 399 | lower_dir_dentry = ecryptfs_dentry_to_lower(ecryptfs_dentry->d_parent); |
400 | mutex_lock(&d_inode(lower_dir_dentry)->i_mutex); | 400 | inode_lock(d_inode(lower_dir_dentry)); |
401 | lower_dentry = lookup_one_len(ecryptfs_dentry->d_name.name, | 401 | lower_dentry = lookup_one_len(ecryptfs_dentry->d_name.name, |
402 | lower_dir_dentry, | 402 | lower_dir_dentry, |
403 | ecryptfs_dentry->d_name.len); | 403 | ecryptfs_dentry->d_name.len); |
404 | mutex_unlock(&d_inode(lower_dir_dentry)->i_mutex); | 404 | inode_unlock(d_inode(lower_dir_dentry)); |
405 | if (IS_ERR(lower_dentry)) { | 405 | if (IS_ERR(lower_dentry)) { |
406 | rc = PTR_ERR(lower_dentry); | 406 | rc = PTR_ERR(lower_dentry); |
407 | ecryptfs_printk(KERN_DEBUG, "%s: lookup_one_len() returned " | 407 | ecryptfs_printk(KERN_DEBUG, "%s: lookup_one_len() returned " |
@@ -426,11 +426,11 @@ static struct dentry *ecryptfs_lookup(struct inode *ecryptfs_dir_inode, | |||
426 | "filename; rc = [%d]\n", __func__, rc); | 426 | "filename; rc = [%d]\n", __func__, rc); |
427 | goto out; | 427 | goto out; |
428 | } | 428 | } |
429 | mutex_lock(&d_inode(lower_dir_dentry)->i_mutex); | 429 | inode_lock(d_inode(lower_dir_dentry)); |
430 | lower_dentry = lookup_one_len(encrypted_and_encoded_name, | 430 | lower_dentry = lookup_one_len(encrypted_and_encoded_name, |
431 | lower_dir_dentry, | 431 | lower_dir_dentry, |
432 | encrypted_and_encoded_name_size); | 432 | encrypted_and_encoded_name_size); |
433 | mutex_unlock(&d_inode(lower_dir_dentry)->i_mutex); | 433 | inode_unlock(d_inode(lower_dir_dentry)); |
434 | if (IS_ERR(lower_dentry)) { | 434 | if (IS_ERR(lower_dentry)) { |
435 | rc = PTR_ERR(lower_dentry); | 435 | rc = PTR_ERR(lower_dentry); |
436 | ecryptfs_printk(KERN_DEBUG, "%s: lookup_one_len() returned " | 436 | ecryptfs_printk(KERN_DEBUG, "%s: lookup_one_len() returned " |
@@ -869,9 +869,9 @@ int ecryptfs_truncate(struct dentry *dentry, loff_t new_length) | |||
869 | if (!rc && lower_ia.ia_valid & ATTR_SIZE) { | 869 | if (!rc && lower_ia.ia_valid & ATTR_SIZE) { |
870 | struct dentry *lower_dentry = ecryptfs_dentry_to_lower(dentry); | 870 | struct dentry *lower_dentry = ecryptfs_dentry_to_lower(dentry); |
871 | 871 | ||
872 | mutex_lock(&d_inode(lower_dentry)->i_mutex); | 872 | inode_lock(d_inode(lower_dentry)); |
873 | rc = notify_change(lower_dentry, &lower_ia, NULL); | 873 | rc = notify_change(lower_dentry, &lower_ia, NULL); |
874 | mutex_unlock(&d_inode(lower_dentry)->i_mutex); | 874 | inode_unlock(d_inode(lower_dentry)); |
875 | } | 875 | } |
876 | return rc; | 876 | return rc; |
877 | } | 877 | } |
@@ -970,9 +970,9 @@ static int ecryptfs_setattr(struct dentry *dentry, struct iattr *ia) | |||
970 | if (lower_ia.ia_valid & (ATTR_KILL_SUID | ATTR_KILL_SGID)) | 970 | if (lower_ia.ia_valid & (ATTR_KILL_SUID | ATTR_KILL_SGID)) |
971 | lower_ia.ia_valid &= ~ATTR_MODE; | 971 | lower_ia.ia_valid &= ~ATTR_MODE; |
972 | 972 | ||
973 | mutex_lock(&d_inode(lower_dentry)->i_mutex); | 973 | inode_lock(d_inode(lower_dentry)); |
974 | rc = notify_change(lower_dentry, &lower_ia, NULL); | 974 | rc = notify_change(lower_dentry, &lower_ia, NULL); |
975 | mutex_unlock(&d_inode(lower_dentry)->i_mutex); | 975 | inode_unlock(d_inode(lower_dentry)); |
976 | out: | 976 | out: |
977 | fsstack_copy_attr_all(inode, lower_inode); | 977 | fsstack_copy_attr_all(inode, lower_inode); |
978 | return rc; | 978 | return rc; |
@@ -1048,10 +1048,10 @@ ecryptfs_getxattr_lower(struct dentry *lower_dentry, const char *name, | |||
1048 | rc = -EOPNOTSUPP; | 1048 | rc = -EOPNOTSUPP; |
1049 | goto out; | 1049 | goto out; |
1050 | } | 1050 | } |
1051 | mutex_lock(&d_inode(lower_dentry)->i_mutex); | 1051 | inode_lock(d_inode(lower_dentry)); |
1052 | rc = d_inode(lower_dentry)->i_op->getxattr(lower_dentry, name, value, | 1052 | rc = d_inode(lower_dentry)->i_op->getxattr(lower_dentry, name, value, |
1053 | size); | 1053 | size); |
1054 | mutex_unlock(&d_inode(lower_dentry)->i_mutex); | 1054 | inode_unlock(d_inode(lower_dentry)); |
1055 | out: | 1055 | out: |
1056 | return rc; | 1056 | return rc; |
1057 | } | 1057 | } |
@@ -1075,9 +1075,9 @@ ecryptfs_listxattr(struct dentry *dentry, char *list, size_t size) | |||
1075 | rc = -EOPNOTSUPP; | 1075 | rc = -EOPNOTSUPP; |
1076 | goto out; | 1076 | goto out; |
1077 | } | 1077 | } |
1078 | mutex_lock(&d_inode(lower_dentry)->i_mutex); | 1078 | inode_lock(d_inode(lower_dentry)); |
1079 | rc = d_inode(lower_dentry)->i_op->listxattr(lower_dentry, list, size); | 1079 | rc = d_inode(lower_dentry)->i_op->listxattr(lower_dentry, list, size); |
1080 | mutex_unlock(&d_inode(lower_dentry)->i_mutex); | 1080 | inode_unlock(d_inode(lower_dentry)); |
1081 | out: | 1081 | out: |
1082 | return rc; | 1082 | return rc; |
1083 | } | 1083 | } |
@@ -1092,9 +1092,9 @@ static int ecryptfs_removexattr(struct dentry *dentry, const char *name) | |||
1092 | rc = -EOPNOTSUPP; | 1092 | rc = -EOPNOTSUPP; |
1093 | goto out; | 1093 | goto out; |
1094 | } | 1094 | } |
1095 | mutex_lock(&d_inode(lower_dentry)->i_mutex); | 1095 | inode_lock(d_inode(lower_dentry)); |
1096 | rc = d_inode(lower_dentry)->i_op->removexattr(lower_dentry, name); | 1096 | rc = d_inode(lower_dentry)->i_op->removexattr(lower_dentry, name); |
1097 | mutex_unlock(&d_inode(lower_dentry)->i_mutex); | 1097 | inode_unlock(d_inode(lower_dentry)); |
1098 | out: | 1098 | out: |
1099 | return rc; | 1099 | return rc; |
1100 | } | 1100 | } |
diff --git a/fs/ecryptfs/mmap.c b/fs/ecryptfs/mmap.c index caba848ac763..c6ced4cbf0cf 100644 --- a/fs/ecryptfs/mmap.c +++ b/fs/ecryptfs/mmap.c | |||
@@ -436,7 +436,7 @@ static int ecryptfs_write_inode_size_to_xattr(struct inode *ecryptfs_inode) | |||
436 | rc = -ENOMEM; | 436 | rc = -ENOMEM; |
437 | goto out; | 437 | goto out; |
438 | } | 438 | } |
439 | mutex_lock(&lower_inode->i_mutex); | 439 | inode_lock(lower_inode); |
440 | size = lower_inode->i_op->getxattr(lower_dentry, ECRYPTFS_XATTR_NAME, | 440 | size = lower_inode->i_op->getxattr(lower_dentry, ECRYPTFS_XATTR_NAME, |
441 | xattr_virt, PAGE_CACHE_SIZE); | 441 | xattr_virt, PAGE_CACHE_SIZE); |
442 | if (size < 0) | 442 | if (size < 0) |
@@ -444,7 +444,7 @@ static int ecryptfs_write_inode_size_to_xattr(struct inode *ecryptfs_inode) | |||
444 | put_unaligned_be64(i_size_read(ecryptfs_inode), xattr_virt); | 444 | put_unaligned_be64(i_size_read(ecryptfs_inode), xattr_virt); |
445 | rc = lower_inode->i_op->setxattr(lower_dentry, ECRYPTFS_XATTR_NAME, | 445 | rc = lower_inode->i_op->setxattr(lower_dentry, ECRYPTFS_XATTR_NAME, |
446 | xattr_virt, size, 0); | 446 | xattr_virt, size, 0); |
447 | mutex_unlock(&lower_inode->i_mutex); | 447 | inode_unlock(lower_inode); |
448 | if (rc) | 448 | if (rc) |
449 | printk(KERN_ERR "Error whilst attempting to write inode size " | 449 | printk(KERN_ERR "Error whilst attempting to write inode size " |
450 | "to lower file xattr; rc = [%d]\n", rc); | 450 | "to lower file xattr; rc = [%d]\n", rc); |
diff --git a/fs/efivarfs/file.c b/fs/efivarfs/file.c index 90001da9abfd..c424e4813ec8 100644 --- a/fs/efivarfs/file.c +++ b/fs/efivarfs/file.c | |||
@@ -50,9 +50,9 @@ static ssize_t efivarfs_file_write(struct file *file, | |||
50 | d_delete(file->f_path.dentry); | 50 | d_delete(file->f_path.dentry); |
51 | dput(file->f_path.dentry); | 51 | dput(file->f_path.dentry); |
52 | } else { | 52 | } else { |
53 | mutex_lock(&inode->i_mutex); | 53 | inode_lock(inode); |
54 | i_size_write(inode, datasize + sizeof(attributes)); | 54 | i_size_write(inode, datasize + sizeof(attributes)); |
55 | mutex_unlock(&inode->i_mutex); | 55 | inode_unlock(inode); |
56 | } | 56 | } |
57 | 57 | ||
58 | bytes = count; | 58 | bytes = count; |
diff --git a/fs/efivarfs/super.c b/fs/efivarfs/super.c index 86a2121828c3..b8a564f29107 100644 --- a/fs/efivarfs/super.c +++ b/fs/efivarfs/super.c | |||
@@ -160,10 +160,10 @@ static int efivarfs_callback(efi_char16_t *name16, efi_guid_t vendor, | |||
160 | efivar_entry_size(entry, &size); | 160 | efivar_entry_size(entry, &size); |
161 | efivar_entry_add(entry, &efivarfs_list); | 161 | efivar_entry_add(entry, &efivarfs_list); |
162 | 162 | ||
163 | mutex_lock(&inode->i_mutex); | 163 | inode_lock(inode); |
164 | inode->i_private = entry; | 164 | inode->i_private = entry; |
165 | i_size_write(inode, size + sizeof(entry->var.Attributes)); | 165 | i_size_write(inode, size + sizeof(entry->var.Attributes)); |
166 | mutex_unlock(&inode->i_mutex); | 166 | inode_unlock(inode); |
167 | d_add(dentry, inode); | 167 | d_add(dentry, inode); |
168 | 168 | ||
169 | return 0; | 169 | return 0; |
@@ -1307,13 +1307,13 @@ static void bprm_fill_uid(struct linux_binprm *bprm) | |||
1307 | return; | 1307 | return; |
1308 | 1308 | ||
1309 | /* Be careful if suid/sgid is set */ | 1309 | /* Be careful if suid/sgid is set */ |
1310 | mutex_lock(&inode->i_mutex); | 1310 | inode_lock(inode); |
1311 | 1311 | ||
1312 | /* reload atomically mode/uid/gid now that lock held */ | 1312 | /* reload atomically mode/uid/gid now that lock held */ |
1313 | mode = inode->i_mode; | 1313 | mode = inode->i_mode; |
1314 | uid = inode->i_uid; | 1314 | uid = inode->i_uid; |
1315 | gid = inode->i_gid; | 1315 | gid = inode->i_gid; |
1316 | mutex_unlock(&inode->i_mutex); | 1316 | inode_unlock(inode); |
1317 | 1317 | ||
1318 | /* We ignore suid/sgid if there are no mappings for them in the ns */ | 1318 | /* We ignore suid/sgid if there are no mappings for them in the ns */ |
1319 | if (!kuid_has_mapping(bprm->cred->user_ns, uid) || | 1319 | if (!kuid_has_mapping(bprm->cred->user_ns, uid) || |
diff --git a/fs/exofs/file.c b/fs/exofs/file.c index 906de66e8e7e..28645f0640f7 100644 --- a/fs/exofs/file.c +++ b/fs/exofs/file.c | |||
@@ -52,9 +52,9 @@ static int exofs_file_fsync(struct file *filp, loff_t start, loff_t end, | |||
52 | if (ret) | 52 | if (ret) |
53 | return ret; | 53 | return ret; |
54 | 54 | ||
55 | mutex_lock(&inode->i_mutex); | 55 | inode_lock(inode); |
56 | ret = sync_inode_metadata(filp->f_mapping->host, 1); | 56 | ret = sync_inode_metadata(filp->f_mapping->host, 1); |
57 | mutex_unlock(&inode->i_mutex); | 57 | inode_unlock(inode); |
58 | return ret; | 58 | return ret; |
59 | } | 59 | } |
60 | 60 | ||
diff --git a/fs/exportfs/expfs.c b/fs/exportfs/expfs.c index 714cd37a6ba3..c46f1a190b8d 100644 --- a/fs/exportfs/expfs.c +++ b/fs/exportfs/expfs.c | |||
@@ -124,10 +124,10 @@ static struct dentry *reconnect_one(struct vfsmount *mnt, | |||
124 | int err; | 124 | int err; |
125 | 125 | ||
126 | parent = ERR_PTR(-EACCES); | 126 | parent = ERR_PTR(-EACCES); |
127 | mutex_lock(&dentry->d_inode->i_mutex); | 127 | inode_lock(dentry->d_inode); |
128 | if (mnt->mnt_sb->s_export_op->get_parent) | 128 | if (mnt->mnt_sb->s_export_op->get_parent) |
129 | parent = mnt->mnt_sb->s_export_op->get_parent(dentry); | 129 | parent = mnt->mnt_sb->s_export_op->get_parent(dentry); |
130 | mutex_unlock(&dentry->d_inode->i_mutex); | 130 | inode_unlock(dentry->d_inode); |
131 | 131 | ||
132 | if (IS_ERR(parent)) { | 132 | if (IS_ERR(parent)) { |
133 | dprintk("%s: get_parent of %ld failed, err %d\n", | 133 | dprintk("%s: get_parent of %ld failed, err %d\n", |
@@ -143,9 +143,9 @@ static struct dentry *reconnect_one(struct vfsmount *mnt, | |||
143 | if (err) | 143 | if (err) |
144 | goto out_err; | 144 | goto out_err; |
145 | dprintk("%s: found name: %s\n", __func__, nbuf); | 145 | dprintk("%s: found name: %s\n", __func__, nbuf); |
146 | mutex_lock(&parent->d_inode->i_mutex); | 146 | inode_lock(parent->d_inode); |
147 | tmp = lookup_one_len(nbuf, parent, strlen(nbuf)); | 147 | tmp = lookup_one_len(nbuf, parent, strlen(nbuf)); |
148 | mutex_unlock(&parent->d_inode->i_mutex); | 148 | inode_unlock(parent->d_inode); |
149 | if (IS_ERR(tmp)) { | 149 | if (IS_ERR(tmp)) { |
150 | dprintk("%s: lookup failed: %d\n", __func__, PTR_ERR(tmp)); | 150 | dprintk("%s: lookup failed: %d\n", __func__, PTR_ERR(tmp)); |
151 | goto out_err; | 151 | goto out_err; |
@@ -503,10 +503,10 @@ struct dentry *exportfs_decode_fh(struct vfsmount *mnt, struct fid *fid, | |||
503 | */ | 503 | */ |
504 | err = exportfs_get_name(mnt, target_dir, nbuf, result); | 504 | err = exportfs_get_name(mnt, target_dir, nbuf, result); |
505 | if (!err) { | 505 | if (!err) { |
506 | mutex_lock(&target_dir->d_inode->i_mutex); | 506 | inode_lock(target_dir->d_inode); |
507 | nresult = lookup_one_len(nbuf, target_dir, | 507 | nresult = lookup_one_len(nbuf, target_dir, |
508 | strlen(nbuf)); | 508 | strlen(nbuf)); |
509 | mutex_unlock(&target_dir->d_inode->i_mutex); | 509 | inode_unlock(target_dir->d_inode); |
510 | if (!IS_ERR(nresult)) { | 510 | if (!IS_ERR(nresult)) { |
511 | if (nresult->d_inode) { | 511 | if (nresult->d_inode) { |
512 | dput(result); | 512 | dput(result); |
diff --git a/fs/ext2/ioctl.c b/fs/ext2/ioctl.c index 5d46c09863f0..b386af2e45f4 100644 --- a/fs/ext2/ioctl.c +++ b/fs/ext2/ioctl.c | |||
@@ -51,10 +51,10 @@ long ext2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | |||
51 | 51 | ||
52 | flags = ext2_mask_flags(inode->i_mode, flags); | 52 | flags = ext2_mask_flags(inode->i_mode, flags); |
53 | 53 | ||
54 | mutex_lock(&inode->i_mutex); | 54 | inode_lock(inode); |
55 | /* Is it quota file? Do not allow user to mess with it */ | 55 | /* Is it quota file? Do not allow user to mess with it */ |
56 | if (IS_NOQUOTA(inode)) { | 56 | if (IS_NOQUOTA(inode)) { |
57 | mutex_unlock(&inode->i_mutex); | 57 | inode_unlock(inode); |
58 | ret = -EPERM; | 58 | ret = -EPERM; |
59 | goto setflags_out; | 59 | goto setflags_out; |
60 | } | 60 | } |
@@ -68,7 +68,7 @@ long ext2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | |||
68 | */ | 68 | */ |
69 | if ((flags ^ oldflags) & (EXT2_APPEND_FL | EXT2_IMMUTABLE_FL)) { | 69 | if ((flags ^ oldflags) & (EXT2_APPEND_FL | EXT2_IMMUTABLE_FL)) { |
70 | if (!capable(CAP_LINUX_IMMUTABLE)) { | 70 | if (!capable(CAP_LINUX_IMMUTABLE)) { |
71 | mutex_unlock(&inode->i_mutex); | 71 | inode_unlock(inode); |
72 | ret = -EPERM; | 72 | ret = -EPERM; |
73 | goto setflags_out; | 73 | goto setflags_out; |
74 | } | 74 | } |
@@ -80,7 +80,7 @@ long ext2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | |||
80 | 80 | ||
81 | ext2_set_inode_flags(inode); | 81 | ext2_set_inode_flags(inode); |
82 | inode->i_ctime = CURRENT_TIME_SEC; | 82 | inode->i_ctime = CURRENT_TIME_SEC; |
83 | mutex_unlock(&inode->i_mutex); | 83 | inode_unlock(inode); |
84 | 84 | ||
85 | mark_inode_dirty(inode); | 85 | mark_inode_dirty(inode); |
86 | setflags_out: | 86 | setflags_out: |
@@ -102,10 +102,10 @@ setflags_out: | |||
102 | goto setversion_out; | 102 | goto setversion_out; |
103 | } | 103 | } |
104 | 104 | ||
105 | mutex_lock(&inode->i_mutex); | 105 | inode_lock(inode); |
106 | inode->i_ctime = CURRENT_TIME_SEC; | 106 | inode->i_ctime = CURRENT_TIME_SEC; |
107 | inode->i_generation = generation; | 107 | inode->i_generation = generation; |
108 | mutex_unlock(&inode->i_mutex); | 108 | inode_unlock(inode); |
109 | 109 | ||
110 | mark_inode_dirty(inode); | 110 | mark_inode_dirty(inode); |
111 | setversion_out: | 111 | setversion_out: |
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index 1c127213363a..0662b285dc8a 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h | |||
@@ -2896,7 +2896,7 @@ do { \ | |||
2896 | static inline void ext4_update_i_disksize(struct inode *inode, loff_t newsize) | 2896 | static inline void ext4_update_i_disksize(struct inode *inode, loff_t newsize) |
2897 | { | 2897 | { |
2898 | WARN_ON_ONCE(S_ISREG(inode->i_mode) && | 2898 | WARN_ON_ONCE(S_ISREG(inode->i_mode) && |
2899 | !mutex_is_locked(&inode->i_mutex)); | 2899 | !inode_is_locked(inode)); |
2900 | down_write(&EXT4_I(inode)->i_data_sem); | 2900 | down_write(&EXT4_I(inode)->i_data_sem); |
2901 | if (newsize > EXT4_I(inode)->i_disksize) | 2901 | if (newsize > EXT4_I(inode)->i_disksize) |
2902 | EXT4_I(inode)->i_disksize = newsize; | 2902 | EXT4_I(inode)->i_disksize = newsize; |
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c index b52fea3b7219..0ffabaf90aa5 100644 --- a/fs/ext4/extents.c +++ b/fs/ext4/extents.c | |||
@@ -4799,7 +4799,7 @@ static long ext4_zero_range(struct file *file, loff_t offset, | |||
4799 | else | 4799 | else |
4800 | max_blocks -= lblk; | 4800 | max_blocks -= lblk; |
4801 | 4801 | ||
4802 | mutex_lock(&inode->i_mutex); | 4802 | inode_lock(inode); |
4803 | 4803 | ||
4804 | /* | 4804 | /* |
4805 | * Indirect files do not support unwritten extnets | 4805 | * Indirect files do not support unwritten extnets |
@@ -4902,7 +4902,7 @@ static long ext4_zero_range(struct file *file, loff_t offset, | |||
4902 | out_dio: | 4902 | out_dio: |
4903 | ext4_inode_resume_unlocked_dio(inode); | 4903 | ext4_inode_resume_unlocked_dio(inode); |
4904 | out_mutex: | 4904 | out_mutex: |
4905 | mutex_unlock(&inode->i_mutex); | 4905 | inode_unlock(inode); |
4906 | return ret; | 4906 | return ret; |
4907 | } | 4907 | } |
4908 | 4908 | ||
@@ -4973,7 +4973,7 @@ long ext4_fallocate(struct file *file, int mode, loff_t offset, loff_t len) | |||
4973 | if (mode & FALLOC_FL_KEEP_SIZE) | 4973 | if (mode & FALLOC_FL_KEEP_SIZE) |
4974 | flags |= EXT4_GET_BLOCKS_KEEP_SIZE; | 4974 | flags |= EXT4_GET_BLOCKS_KEEP_SIZE; |
4975 | 4975 | ||
4976 | mutex_lock(&inode->i_mutex); | 4976 | inode_lock(inode); |
4977 | 4977 | ||
4978 | /* | 4978 | /* |
4979 | * We only support preallocation for extent-based files only | 4979 | * We only support preallocation for extent-based files only |
@@ -5006,7 +5006,7 @@ long ext4_fallocate(struct file *file, int mode, loff_t offset, loff_t len) | |||
5006 | EXT4_I(inode)->i_sync_tid); | 5006 | EXT4_I(inode)->i_sync_tid); |
5007 | } | 5007 | } |
5008 | out: | 5008 | out: |
5009 | mutex_unlock(&inode->i_mutex); | 5009 | inode_unlock(inode); |
5010 | trace_ext4_fallocate_exit(inode, offset, max_blocks, ret); | 5010 | trace_ext4_fallocate_exit(inode, offset, max_blocks, ret); |
5011 | return ret; | 5011 | return ret; |
5012 | } | 5012 | } |
@@ -5492,7 +5492,7 @@ int ext4_collapse_range(struct inode *inode, loff_t offset, loff_t len) | |||
5492 | return ret; | 5492 | return ret; |
5493 | } | 5493 | } |
5494 | 5494 | ||
5495 | mutex_lock(&inode->i_mutex); | 5495 | inode_lock(inode); |
5496 | /* | 5496 | /* |
5497 | * There is no need to overlap collapse range with EOF, in which case | 5497 | * There is no need to overlap collapse range with EOF, in which case |
5498 | * it is effectively a truncate operation | 5498 | * it is effectively a truncate operation |
@@ -5587,7 +5587,7 @@ out_mmap: | |||
5587 | up_write(&EXT4_I(inode)->i_mmap_sem); | 5587 | up_write(&EXT4_I(inode)->i_mmap_sem); |
5588 | ext4_inode_resume_unlocked_dio(inode); | 5588 | ext4_inode_resume_unlocked_dio(inode); |
5589 | out_mutex: | 5589 | out_mutex: |
5590 | mutex_unlock(&inode->i_mutex); | 5590 | inode_unlock(inode); |
5591 | return ret; | 5591 | return ret; |
5592 | } | 5592 | } |
5593 | 5593 | ||
@@ -5638,7 +5638,7 @@ int ext4_insert_range(struct inode *inode, loff_t offset, loff_t len) | |||
5638 | return ret; | 5638 | return ret; |
5639 | } | 5639 | } |
5640 | 5640 | ||
5641 | mutex_lock(&inode->i_mutex); | 5641 | inode_lock(inode); |
5642 | /* Currently just for extent based files */ | 5642 | /* Currently just for extent based files */ |
5643 | if (!ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS)) { | 5643 | if (!ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS)) { |
5644 | ret = -EOPNOTSUPP; | 5644 | ret = -EOPNOTSUPP; |
@@ -5757,7 +5757,7 @@ out_mmap: | |||
5757 | up_write(&EXT4_I(inode)->i_mmap_sem); | 5757 | up_write(&EXT4_I(inode)->i_mmap_sem); |
5758 | ext4_inode_resume_unlocked_dio(inode); | 5758 | ext4_inode_resume_unlocked_dio(inode); |
5759 | out_mutex: | 5759 | out_mutex: |
5760 | mutex_unlock(&inode->i_mutex); | 5760 | inode_unlock(inode); |
5761 | return ret; | 5761 | return ret; |
5762 | } | 5762 | } |
5763 | 5763 | ||
@@ -5792,8 +5792,8 @@ ext4_swap_extents(handle_t *handle, struct inode *inode1, | |||
5792 | 5792 | ||
5793 | BUG_ON(!rwsem_is_locked(&EXT4_I(inode1)->i_data_sem)); | 5793 | BUG_ON(!rwsem_is_locked(&EXT4_I(inode1)->i_data_sem)); |
5794 | BUG_ON(!rwsem_is_locked(&EXT4_I(inode2)->i_data_sem)); | 5794 | BUG_ON(!rwsem_is_locked(&EXT4_I(inode2)->i_data_sem)); |
5795 | BUG_ON(!mutex_is_locked(&inode1->i_mutex)); | 5795 | BUG_ON(!inode_is_locked(inode1)); |
5796 | BUG_ON(!mutex_is_locked(&inode2->i_mutex)); | 5796 | BUG_ON(!inode_is_locked(inode2)); |
5797 | 5797 | ||
5798 | *erp = ext4_es_remove_extent(inode1, lblk1, count); | 5798 | *erp = ext4_es_remove_extent(inode1, lblk1, count); |
5799 | if (unlikely(*erp)) | 5799 | if (unlikely(*erp)) |
diff --git a/fs/ext4/file.c b/fs/ext4/file.c index 749b222e6498..8eb87e3e2752 100644 --- a/fs/ext4/file.c +++ b/fs/ext4/file.c | |||
@@ -113,7 +113,7 @@ ext4_file_write_iter(struct kiocb *iocb, struct iov_iter *from) | |||
113 | ext4_unwritten_wait(inode); | 113 | ext4_unwritten_wait(inode); |
114 | } | 114 | } |
115 | 115 | ||
116 | mutex_lock(&inode->i_mutex); | 116 | inode_lock(inode); |
117 | ret = generic_write_checks(iocb, from); | 117 | ret = generic_write_checks(iocb, from); |
118 | if (ret <= 0) | 118 | if (ret <= 0) |
119 | goto out; | 119 | goto out; |
@@ -169,7 +169,7 @@ ext4_file_write_iter(struct kiocb *iocb, struct iov_iter *from) | |||
169 | } | 169 | } |
170 | 170 | ||
171 | ret = __generic_file_write_iter(iocb, from); | 171 | ret = __generic_file_write_iter(iocb, from); |
172 | mutex_unlock(&inode->i_mutex); | 172 | inode_unlock(inode); |
173 | 173 | ||
174 | if (ret > 0) { | 174 | if (ret > 0) { |
175 | ssize_t err; | 175 | ssize_t err; |
@@ -186,7 +186,7 @@ ext4_file_write_iter(struct kiocb *iocb, struct iov_iter *from) | |||
186 | return ret; | 186 | return ret; |
187 | 187 | ||
188 | out: | 188 | out: |
189 | mutex_unlock(&inode->i_mutex); | 189 | inode_unlock(inode); |
190 | if (aio_mutex) | 190 | if (aio_mutex) |
191 | mutex_unlock(aio_mutex); | 191 | mutex_unlock(aio_mutex); |
192 | return ret; | 192 | return ret; |
@@ -561,11 +561,11 @@ static loff_t ext4_seek_data(struct file *file, loff_t offset, loff_t maxsize) | |||
561 | int blkbits; | 561 | int blkbits; |
562 | int ret = 0; | 562 | int ret = 0; |
563 | 563 | ||
564 | mutex_lock(&inode->i_mutex); | 564 | inode_lock(inode); |
565 | 565 | ||
566 | isize = i_size_read(inode); | 566 | isize = i_size_read(inode); |
567 | if (offset >= isize) { | 567 | if (offset >= isize) { |
568 | mutex_unlock(&inode->i_mutex); | 568 | inode_unlock(inode); |
569 | return -ENXIO; | 569 | return -ENXIO; |
570 | } | 570 | } |
571 | 571 | ||
@@ -613,7 +613,7 @@ static loff_t ext4_seek_data(struct file *file, loff_t offset, loff_t maxsize) | |||
613 | dataoff = (loff_t)last << blkbits; | 613 | dataoff = (loff_t)last << blkbits; |
614 | } while (last <= end); | 614 | } while (last <= end); |
615 | 615 | ||
616 | mutex_unlock(&inode->i_mutex); | 616 | inode_unlock(inode); |
617 | 617 | ||
618 | if (dataoff > isize) | 618 | if (dataoff > isize) |
619 | return -ENXIO; | 619 | return -ENXIO; |
@@ -634,11 +634,11 @@ static loff_t ext4_seek_hole(struct file *file, loff_t offset, loff_t maxsize) | |||
634 | int blkbits; | 634 | int blkbits; |
635 | int ret = 0; | 635 | int ret = 0; |
636 | 636 | ||
637 | mutex_lock(&inode->i_mutex); | 637 | inode_lock(inode); |
638 | 638 | ||
639 | isize = i_size_read(inode); | 639 | isize = i_size_read(inode); |
640 | if (offset >= isize) { | 640 | if (offset >= isize) { |
641 | mutex_unlock(&inode->i_mutex); | 641 | inode_unlock(inode); |
642 | return -ENXIO; | 642 | return -ENXIO; |
643 | } | 643 | } |
644 | 644 | ||
@@ -689,7 +689,7 @@ static loff_t ext4_seek_hole(struct file *file, loff_t offset, loff_t maxsize) | |||
689 | break; | 689 | break; |
690 | } while (last <= end); | 690 | } while (last <= end); |
691 | 691 | ||
692 | mutex_unlock(&inode->i_mutex); | 692 | inode_unlock(inode); |
693 | 693 | ||
694 | if (holeoff > isize) | 694 | if (holeoff > isize) |
695 | holeoff = isize; | 695 | holeoff = isize; |
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index d964195ea0e2..83bc8bfb3bea 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c | |||
@@ -3231,7 +3231,7 @@ static ssize_t ext4_ext_direct_IO(struct kiocb *iocb, struct iov_iter *iter, | |||
3231 | overwrite = *((int *)iocb->private); | 3231 | overwrite = *((int *)iocb->private); |
3232 | 3232 | ||
3233 | if (overwrite) | 3233 | if (overwrite) |
3234 | mutex_unlock(&inode->i_mutex); | 3234 | inode_unlock(inode); |
3235 | 3235 | ||
3236 | /* | 3236 | /* |
3237 | * We could direct write to holes and fallocate. | 3237 | * We could direct write to holes and fallocate. |
@@ -3331,7 +3331,7 @@ retake_lock: | |||
3331 | inode_dio_end(inode); | 3331 | inode_dio_end(inode); |
3332 | /* take i_mutex locking again if we do a ovewrite dio */ | 3332 | /* take i_mutex locking again if we do a ovewrite dio */ |
3333 | if (overwrite) | 3333 | if (overwrite) |
3334 | mutex_lock(&inode->i_mutex); | 3334 | inode_lock(inode); |
3335 | 3335 | ||
3336 | return ret; | 3336 | return ret; |
3337 | } | 3337 | } |
@@ -3653,7 +3653,7 @@ int ext4_update_disksize_before_punch(struct inode *inode, loff_t offset, | |||
3653 | handle_t *handle; | 3653 | handle_t *handle; |
3654 | loff_t size = i_size_read(inode); | 3654 | loff_t size = i_size_read(inode); |
3655 | 3655 | ||
3656 | WARN_ON(!mutex_is_locked(&inode->i_mutex)); | 3656 | WARN_ON(!inode_is_locked(inode)); |
3657 | if (offset > size || offset + len < size) | 3657 | if (offset > size || offset + len < size) |
3658 | return 0; | 3658 | return 0; |
3659 | 3659 | ||
@@ -3707,7 +3707,7 @@ int ext4_punch_hole(struct inode *inode, loff_t offset, loff_t length) | |||
3707 | return ret; | 3707 | return ret; |
3708 | } | 3708 | } |
3709 | 3709 | ||
3710 | mutex_lock(&inode->i_mutex); | 3710 | inode_lock(inode); |
3711 | 3711 | ||
3712 | /* No need to punch hole beyond i_size */ | 3712 | /* No need to punch hole beyond i_size */ |
3713 | if (offset >= inode->i_size) | 3713 | if (offset >= inode->i_size) |
@@ -3809,7 +3809,7 @@ out_dio: | |||
3809 | up_write(&EXT4_I(inode)->i_mmap_sem); | 3809 | up_write(&EXT4_I(inode)->i_mmap_sem); |
3810 | ext4_inode_resume_unlocked_dio(inode); | 3810 | ext4_inode_resume_unlocked_dio(inode); |
3811 | out_mutex: | 3811 | out_mutex: |
3812 | mutex_unlock(&inode->i_mutex); | 3812 | inode_unlock(inode); |
3813 | return ret; | 3813 | return ret; |
3814 | } | 3814 | } |
3815 | 3815 | ||
@@ -3879,7 +3879,7 @@ void ext4_truncate(struct inode *inode) | |||
3879 | * have i_mutex locked because it's not necessary. | 3879 | * have i_mutex locked because it's not necessary. |
3880 | */ | 3880 | */ |
3881 | if (!(inode->i_state & (I_NEW|I_FREEING))) | 3881 | if (!(inode->i_state & (I_NEW|I_FREEING))) |
3882 | WARN_ON(!mutex_is_locked(&inode->i_mutex)); | 3882 | WARN_ON(!inode_is_locked(inode)); |
3883 | trace_ext4_truncate_enter(inode); | 3883 | trace_ext4_truncate_enter(inode); |
3884 | 3884 | ||
3885 | if (!ext4_can_truncate(inode)) | 3885 | if (!ext4_can_truncate(inode)) |
diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c index 2b0cb84255eb..0f6c36922c24 100644 --- a/fs/ext4/ioctl.c +++ b/fs/ext4/ioctl.c | |||
@@ -330,7 +330,7 @@ static int ext4_ioctl_setproject(struct file *filp, __u32 projid) | |||
330 | return err; | 330 | return err; |
331 | 331 | ||
332 | err = -EPERM; | 332 | err = -EPERM; |
333 | mutex_lock(&inode->i_mutex); | 333 | inode_lock(inode); |
334 | /* Is it quota file? Do not allow user to mess with it */ | 334 | /* Is it quota file? Do not allow user to mess with it */ |
335 | if (IS_NOQUOTA(inode)) | 335 | if (IS_NOQUOTA(inode)) |
336 | goto out_unlock; | 336 | goto out_unlock; |
@@ -381,7 +381,7 @@ out_dirty: | |||
381 | out_stop: | 381 | out_stop: |
382 | ext4_journal_stop(handle); | 382 | ext4_journal_stop(handle); |
383 | out_unlock: | 383 | out_unlock: |
384 | mutex_unlock(&inode->i_mutex); | 384 | inode_unlock(inode); |
385 | mnt_drop_write_file(filp); | 385 | mnt_drop_write_file(filp); |
386 | return err; | 386 | return err; |
387 | } | 387 | } |
@@ -464,9 +464,9 @@ long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | |||
464 | 464 | ||
465 | flags = ext4_mask_flags(inode->i_mode, flags); | 465 | flags = ext4_mask_flags(inode->i_mode, flags); |
466 | 466 | ||
467 | mutex_lock(&inode->i_mutex); | 467 | inode_lock(inode); |
468 | err = ext4_ioctl_setflags(inode, flags); | 468 | err = ext4_ioctl_setflags(inode, flags); |
469 | mutex_unlock(&inode->i_mutex); | 469 | inode_unlock(inode); |
470 | mnt_drop_write_file(filp); | 470 | mnt_drop_write_file(filp); |
471 | return err; | 471 | return err; |
472 | } | 472 | } |
@@ -497,7 +497,7 @@ long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | |||
497 | goto setversion_out; | 497 | goto setversion_out; |
498 | } | 498 | } |
499 | 499 | ||
500 | mutex_lock(&inode->i_mutex); | 500 | inode_lock(inode); |
501 | handle = ext4_journal_start(inode, EXT4_HT_INODE, 1); | 501 | handle = ext4_journal_start(inode, EXT4_HT_INODE, 1); |
502 | if (IS_ERR(handle)) { | 502 | if (IS_ERR(handle)) { |
503 | err = PTR_ERR(handle); | 503 | err = PTR_ERR(handle); |
@@ -512,7 +512,7 @@ long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | |||
512 | ext4_journal_stop(handle); | 512 | ext4_journal_stop(handle); |
513 | 513 | ||
514 | unlock_out: | 514 | unlock_out: |
515 | mutex_unlock(&inode->i_mutex); | 515 | inode_unlock(inode); |
516 | setversion_out: | 516 | setversion_out: |
517 | mnt_drop_write_file(filp); | 517 | mnt_drop_write_file(filp); |
518 | return err; | 518 | return err; |
@@ -658,9 +658,9 @@ group_add_out: | |||
658 | * ext4_ext_swap_inode_data before we switch the | 658 | * ext4_ext_swap_inode_data before we switch the |
659 | * inode format to prevent read. | 659 | * inode format to prevent read. |
660 | */ | 660 | */ |
661 | mutex_lock(&(inode->i_mutex)); | 661 | inode_lock((inode)); |
662 | err = ext4_ext_migrate(inode); | 662 | err = ext4_ext_migrate(inode); |
663 | mutex_unlock(&(inode->i_mutex)); | 663 | inode_unlock((inode)); |
664 | mnt_drop_write_file(filp); | 664 | mnt_drop_write_file(filp); |
665 | return err; | 665 | return err; |
666 | } | 666 | } |
@@ -876,11 +876,11 @@ encryption_policy_out: | |||
876 | flags = ext4_xflags_to_iflags(fa.fsx_xflags); | 876 | flags = ext4_xflags_to_iflags(fa.fsx_xflags); |
877 | flags = ext4_mask_flags(inode->i_mode, flags); | 877 | flags = ext4_mask_flags(inode->i_mode, flags); |
878 | 878 | ||
879 | mutex_lock(&inode->i_mutex); | 879 | inode_lock(inode); |
880 | flags = (ei->i_flags & ~EXT4_FL_XFLAG_VISIBLE) | | 880 | flags = (ei->i_flags & ~EXT4_FL_XFLAG_VISIBLE) | |
881 | (flags & EXT4_FL_XFLAG_VISIBLE); | 881 | (flags & EXT4_FL_XFLAG_VISIBLE); |
882 | err = ext4_ioctl_setflags(inode, flags); | 882 | err = ext4_ioctl_setflags(inode, flags); |
883 | mutex_unlock(&inode->i_mutex); | 883 | inode_unlock(inode); |
884 | mnt_drop_write_file(filp); | 884 | mnt_drop_write_file(filp); |
885 | if (err) | 885 | if (err) |
886 | return err; | 886 | return err; |
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c index 854f75de4599..06574dd77614 100644 --- a/fs/ext4/namei.c +++ b/fs/ext4/namei.c | |||
@@ -2753,7 +2753,7 @@ int ext4_orphan_add(handle_t *handle, struct inode *inode) | |||
2753 | return 0; | 2753 | return 0; |
2754 | 2754 | ||
2755 | WARN_ON_ONCE(!(inode->i_state & (I_NEW | I_FREEING)) && | 2755 | WARN_ON_ONCE(!(inode->i_state & (I_NEW | I_FREEING)) && |
2756 | !mutex_is_locked(&inode->i_mutex)); | 2756 | !inode_is_locked(inode)); |
2757 | /* | 2757 | /* |
2758 | * Exit early if inode already is on orphan list. This is a big speedup | 2758 | * Exit early if inode already is on orphan list. This is a big speedup |
2759 | * since we don't have to contend on the global s_orphan_lock. | 2759 | * since we don't have to contend on the global s_orphan_lock. |
@@ -2835,7 +2835,7 @@ int ext4_orphan_del(handle_t *handle, struct inode *inode) | |||
2835 | return 0; | 2835 | return 0; |
2836 | 2836 | ||
2837 | WARN_ON_ONCE(!(inode->i_state & (I_NEW | I_FREEING)) && | 2837 | WARN_ON_ONCE(!(inode->i_state & (I_NEW | I_FREEING)) && |
2838 | !mutex_is_locked(&inode->i_mutex)); | 2838 | !inode_is_locked(inode)); |
2839 | /* Do this quick check before taking global s_orphan_lock. */ | 2839 | /* Do this quick check before taking global s_orphan_lock. */ |
2840 | if (list_empty(&ei->i_orphan)) | 2840 | if (list_empty(&ei->i_orphan)) |
2841 | return 0; | 2841 | return 0; |
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 00c98fab6333..3ed01ec011d7 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c | |||
@@ -2286,10 +2286,10 @@ static void ext4_orphan_cleanup(struct super_block *sb, | |||
2286 | __func__, inode->i_ino, inode->i_size); | 2286 | __func__, inode->i_ino, inode->i_size); |
2287 | jbd_debug(2, "truncating inode %lu to %lld bytes\n", | 2287 | jbd_debug(2, "truncating inode %lu to %lld bytes\n", |
2288 | inode->i_ino, inode->i_size); | 2288 | inode->i_ino, inode->i_size); |
2289 | mutex_lock(&inode->i_mutex); | 2289 | inode_lock(inode); |
2290 | truncate_inode_pages(inode->i_mapping, inode->i_size); | 2290 | truncate_inode_pages(inode->i_mapping, inode->i_size); |
2291 | ext4_truncate(inode); | 2291 | ext4_truncate(inode); |
2292 | mutex_unlock(&inode->i_mutex); | 2292 | inode_unlock(inode); |
2293 | nr_truncates++; | 2293 | nr_truncates++; |
2294 | } else { | 2294 | } else { |
2295 | if (test_opt(sb, DEBUG)) | 2295 | if (test_opt(sb, DEBUG)) |
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index ac9e7c6aac74..5c06db17e41f 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c | |||
@@ -794,7 +794,7 @@ int f2fs_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, | |||
794 | return ret; | 794 | return ret; |
795 | } | 795 | } |
796 | 796 | ||
797 | mutex_lock(&inode->i_mutex); | 797 | inode_lock(inode); |
798 | 798 | ||
799 | isize = i_size_read(inode); | 799 | isize = i_size_read(inode); |
800 | if (start >= isize) | 800 | if (start >= isize) |
@@ -860,7 +860,7 @@ out: | |||
860 | if (ret == 1) | 860 | if (ret == 1) |
861 | ret = 0; | 861 | ret = 0; |
862 | 862 | ||
863 | mutex_unlock(&inode->i_mutex); | 863 | inode_unlock(inode); |
864 | return ret; | 864 | return ret; |
865 | } | 865 | } |
866 | 866 | ||
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 18ddb1e5182a..ea272be62677 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c | |||
@@ -333,7 +333,7 @@ static loff_t f2fs_seek_block(struct file *file, loff_t offset, int whence) | |||
333 | loff_t isize; | 333 | loff_t isize; |
334 | int err = 0; | 334 | int err = 0; |
335 | 335 | ||
336 | mutex_lock(&inode->i_mutex); | 336 | inode_lock(inode); |
337 | 337 | ||
338 | isize = i_size_read(inode); | 338 | isize = i_size_read(inode); |
339 | if (offset >= isize) | 339 | if (offset >= isize) |
@@ -388,10 +388,10 @@ static loff_t f2fs_seek_block(struct file *file, loff_t offset, int whence) | |||
388 | found: | 388 | found: |
389 | if (whence == SEEK_HOLE && data_ofs > isize) | 389 | if (whence == SEEK_HOLE && data_ofs > isize) |
390 | data_ofs = isize; | 390 | data_ofs = isize; |
391 | mutex_unlock(&inode->i_mutex); | 391 | inode_unlock(inode); |
392 | return vfs_setpos(file, data_ofs, maxbytes); | 392 | return vfs_setpos(file, data_ofs, maxbytes); |
393 | fail: | 393 | fail: |
394 | mutex_unlock(&inode->i_mutex); | 394 | inode_unlock(inode); |
395 | return -ENXIO; | 395 | return -ENXIO; |
396 | } | 396 | } |
397 | 397 | ||
@@ -1219,7 +1219,7 @@ static long f2fs_fallocate(struct file *file, int mode, | |||
1219 | FALLOC_FL_INSERT_RANGE)) | 1219 | FALLOC_FL_INSERT_RANGE)) |
1220 | return -EOPNOTSUPP; | 1220 | return -EOPNOTSUPP; |
1221 | 1221 | ||
1222 | mutex_lock(&inode->i_mutex); | 1222 | inode_lock(inode); |
1223 | 1223 | ||
1224 | if (mode & FALLOC_FL_PUNCH_HOLE) { | 1224 | if (mode & FALLOC_FL_PUNCH_HOLE) { |
1225 | if (offset >= inode->i_size) | 1225 | if (offset >= inode->i_size) |
@@ -1243,7 +1243,7 @@ static long f2fs_fallocate(struct file *file, int mode, | |||
1243 | } | 1243 | } |
1244 | 1244 | ||
1245 | out: | 1245 | out: |
1246 | mutex_unlock(&inode->i_mutex); | 1246 | inode_unlock(inode); |
1247 | 1247 | ||
1248 | trace_f2fs_fallocate(inode, mode, offset, len, ret); | 1248 | trace_f2fs_fallocate(inode, mode, offset, len, ret); |
1249 | return ret; | 1249 | return ret; |
@@ -1307,13 +1307,13 @@ static int f2fs_ioc_setflags(struct file *filp, unsigned long arg) | |||
1307 | 1307 | ||
1308 | flags = f2fs_mask_flags(inode->i_mode, flags); | 1308 | flags = f2fs_mask_flags(inode->i_mode, flags); |
1309 | 1309 | ||
1310 | mutex_lock(&inode->i_mutex); | 1310 | inode_lock(inode); |
1311 | 1311 | ||
1312 | oldflags = fi->i_flags; | 1312 | oldflags = fi->i_flags; |
1313 | 1313 | ||
1314 | if ((flags ^ oldflags) & (FS_APPEND_FL | FS_IMMUTABLE_FL)) { | 1314 | if ((flags ^ oldflags) & (FS_APPEND_FL | FS_IMMUTABLE_FL)) { |
1315 | if (!capable(CAP_LINUX_IMMUTABLE)) { | 1315 | if (!capable(CAP_LINUX_IMMUTABLE)) { |
1316 | mutex_unlock(&inode->i_mutex); | 1316 | inode_unlock(inode); |
1317 | ret = -EPERM; | 1317 | ret = -EPERM; |
1318 | goto out; | 1318 | goto out; |
1319 | } | 1319 | } |
@@ -1322,7 +1322,7 @@ static int f2fs_ioc_setflags(struct file *filp, unsigned long arg) | |||
1322 | flags = flags & FS_FL_USER_MODIFIABLE; | 1322 | flags = flags & FS_FL_USER_MODIFIABLE; |
1323 | flags |= oldflags & ~FS_FL_USER_MODIFIABLE; | 1323 | flags |= oldflags & ~FS_FL_USER_MODIFIABLE; |
1324 | fi->i_flags = flags; | 1324 | fi->i_flags = flags; |
1325 | mutex_unlock(&inode->i_mutex); | 1325 | inode_unlock(inode); |
1326 | 1326 | ||
1327 | f2fs_set_inode_flags(inode); | 1327 | f2fs_set_inode_flags(inode); |
1328 | inode->i_ctime = CURRENT_TIME; | 1328 | inode->i_ctime = CURRENT_TIME; |
@@ -1667,7 +1667,7 @@ static int f2fs_defragment_range(struct f2fs_sb_info *sbi, | |||
1667 | 1667 | ||
1668 | f2fs_balance_fs(sbi, true); | 1668 | f2fs_balance_fs(sbi, true); |
1669 | 1669 | ||
1670 | mutex_lock(&inode->i_mutex); | 1670 | inode_lock(inode); |
1671 | 1671 | ||
1672 | /* writeback all dirty pages in the range */ | 1672 | /* writeback all dirty pages in the range */ |
1673 | err = filemap_write_and_wait_range(inode->i_mapping, range->start, | 1673 | err = filemap_write_and_wait_range(inode->i_mapping, range->start, |
@@ -1778,7 +1778,7 @@ do_map: | |||
1778 | clear_out: | 1778 | clear_out: |
1779 | clear_inode_flag(F2FS_I(inode), FI_DO_DEFRAG); | 1779 | clear_inode_flag(F2FS_I(inode), FI_DO_DEFRAG); |
1780 | out: | 1780 | out: |
1781 | mutex_unlock(&inode->i_mutex); | 1781 | inode_unlock(inode); |
1782 | if (!err) | 1782 | if (!err) |
1783 | range->len = (u64)total << PAGE_CACHE_SHIFT; | 1783 | range->len = (u64)total << PAGE_CACHE_SHIFT; |
1784 | return err; | 1784 | return err; |
diff --git a/fs/fat/dir.c b/fs/fat/dir.c index 7def96caec5f..d0b95c95079b 100644 --- a/fs/fat/dir.c +++ b/fs/fat/dir.c | |||
@@ -769,7 +769,7 @@ static int fat_ioctl_readdir(struct inode *inode, struct file *file, | |||
769 | 769 | ||
770 | buf.dirent = dirent; | 770 | buf.dirent = dirent; |
771 | buf.result = 0; | 771 | buf.result = 0; |
772 | mutex_lock(&inode->i_mutex); | 772 | inode_lock(inode); |
773 | buf.ctx.pos = file->f_pos; | 773 | buf.ctx.pos = file->f_pos; |
774 | ret = -ENOENT; | 774 | ret = -ENOENT; |
775 | if (!IS_DEADDIR(inode)) { | 775 | if (!IS_DEADDIR(inode)) { |
@@ -777,7 +777,7 @@ static int fat_ioctl_readdir(struct inode *inode, struct file *file, | |||
777 | short_only, both ? &buf : NULL); | 777 | short_only, both ? &buf : NULL); |
778 | file->f_pos = buf.ctx.pos; | 778 | file->f_pos = buf.ctx.pos; |
779 | } | 779 | } |
780 | mutex_unlock(&inode->i_mutex); | 780 | inode_unlock(inode); |
781 | if (ret >= 0) | 781 | if (ret >= 0) |
782 | ret = buf.result; | 782 | ret = buf.result; |
783 | return ret; | 783 | return ret; |
diff --git a/fs/fat/file.c b/fs/fat/file.c index 43d3475da83a..f70185668832 100644 --- a/fs/fat/file.c +++ b/fs/fat/file.c | |||
@@ -24,9 +24,9 @@ static int fat_ioctl_get_attributes(struct inode *inode, u32 __user *user_attr) | |||
24 | { | 24 | { |
25 | u32 attr; | 25 | u32 attr; |
26 | 26 | ||
27 | mutex_lock(&inode->i_mutex); | 27 | inode_lock(inode); |
28 | attr = fat_make_attrs(inode); | 28 | attr = fat_make_attrs(inode); |
29 | mutex_unlock(&inode->i_mutex); | 29 | inode_unlock(inode); |
30 | 30 | ||
31 | return put_user(attr, user_attr); | 31 | return put_user(attr, user_attr); |
32 | } | 32 | } |
@@ -47,7 +47,7 @@ static int fat_ioctl_set_attributes(struct file *file, u32 __user *user_attr) | |||
47 | err = mnt_want_write_file(file); | 47 | err = mnt_want_write_file(file); |
48 | if (err) | 48 | if (err) |
49 | goto out; | 49 | goto out; |
50 | mutex_lock(&inode->i_mutex); | 50 | inode_lock(inode); |
51 | 51 | ||
52 | /* | 52 | /* |
53 | * ATTR_VOLUME and ATTR_DIR cannot be changed; this also | 53 | * ATTR_VOLUME and ATTR_DIR cannot be changed; this also |
@@ -109,7 +109,7 @@ static int fat_ioctl_set_attributes(struct file *file, u32 __user *user_attr) | |||
109 | fat_save_attrs(inode, attr); | 109 | fat_save_attrs(inode, attr); |
110 | mark_inode_dirty(inode); | 110 | mark_inode_dirty(inode); |
111 | out_unlock_inode: | 111 | out_unlock_inode: |
112 | mutex_unlock(&inode->i_mutex); | 112 | inode_unlock(inode); |
113 | mnt_drop_write_file(file); | 113 | mnt_drop_write_file(file); |
114 | out: | 114 | out: |
115 | return err; | 115 | return err; |
@@ -246,7 +246,7 @@ static long fat_fallocate(struct file *file, int mode, | |||
246 | if (!S_ISREG(inode->i_mode)) | 246 | if (!S_ISREG(inode->i_mode)) |
247 | return -EOPNOTSUPP; | 247 | return -EOPNOTSUPP; |
248 | 248 | ||
249 | mutex_lock(&inode->i_mutex); | 249 | inode_lock(inode); |
250 | if (mode & FALLOC_FL_KEEP_SIZE) { | 250 | if (mode & FALLOC_FL_KEEP_SIZE) { |
251 | ondisksize = inode->i_blocks << 9; | 251 | ondisksize = inode->i_blocks << 9; |
252 | if ((offset + len) <= ondisksize) | 252 | if ((offset + len) <= ondisksize) |
@@ -272,7 +272,7 @@ static long fat_fallocate(struct file *file, int mode, | |||
272 | } | 272 | } |
273 | 273 | ||
274 | error: | 274 | error: |
275 | mutex_unlock(&inode->i_mutex); | 275 | inode_unlock(inode); |
276 | return err; | 276 | return err; |
277 | } | 277 | } |
278 | 278 | ||
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c index 712601f299b8..4b855b65d457 100644 --- a/fs/fuse/dir.c +++ b/fs/fuse/dir.c | |||
@@ -944,7 +944,7 @@ int fuse_reverse_inval_entry(struct super_block *sb, u64 parent_nodeid, | |||
944 | if (!parent) | 944 | if (!parent) |
945 | return -ENOENT; | 945 | return -ENOENT; |
946 | 946 | ||
947 | mutex_lock(&parent->i_mutex); | 947 | inode_lock(parent); |
948 | if (!S_ISDIR(parent->i_mode)) | 948 | if (!S_ISDIR(parent->i_mode)) |
949 | goto unlock; | 949 | goto unlock; |
950 | 950 | ||
@@ -962,7 +962,7 @@ int fuse_reverse_inval_entry(struct super_block *sb, u64 parent_nodeid, | |||
962 | fuse_invalidate_entry(entry); | 962 | fuse_invalidate_entry(entry); |
963 | 963 | ||
964 | if (child_nodeid != 0 && d_really_is_positive(entry)) { | 964 | if (child_nodeid != 0 && d_really_is_positive(entry)) { |
965 | mutex_lock(&d_inode(entry)->i_mutex); | 965 | inode_lock(d_inode(entry)); |
966 | if (get_node_id(d_inode(entry)) != child_nodeid) { | 966 | if (get_node_id(d_inode(entry)) != child_nodeid) { |
967 | err = -ENOENT; | 967 | err = -ENOENT; |
968 | goto badentry; | 968 | goto badentry; |
@@ -983,7 +983,7 @@ int fuse_reverse_inval_entry(struct super_block *sb, u64 parent_nodeid, | |||
983 | clear_nlink(d_inode(entry)); | 983 | clear_nlink(d_inode(entry)); |
984 | err = 0; | 984 | err = 0; |
985 | badentry: | 985 | badentry: |
986 | mutex_unlock(&d_inode(entry)->i_mutex); | 986 | inode_unlock(d_inode(entry)); |
987 | if (!err) | 987 | if (!err) |
988 | d_delete(entry); | 988 | d_delete(entry); |
989 | } else { | 989 | } else { |
@@ -992,7 +992,7 @@ int fuse_reverse_inval_entry(struct super_block *sb, u64 parent_nodeid, | |||
992 | dput(entry); | 992 | dput(entry); |
993 | 993 | ||
994 | unlock: | 994 | unlock: |
995 | mutex_unlock(&parent->i_mutex); | 995 | inode_unlock(parent); |
996 | iput(parent); | 996 | iput(parent); |
997 | return err; | 997 | return err; |
998 | } | 998 | } |
@@ -1504,7 +1504,7 @@ void fuse_set_nowrite(struct inode *inode) | |||
1504 | struct fuse_conn *fc = get_fuse_conn(inode); | 1504 | struct fuse_conn *fc = get_fuse_conn(inode); |
1505 | struct fuse_inode *fi = get_fuse_inode(inode); | 1505 | struct fuse_inode *fi = get_fuse_inode(inode); |
1506 | 1506 | ||
1507 | BUG_ON(!mutex_is_locked(&inode->i_mutex)); | 1507 | BUG_ON(!inode_is_locked(inode)); |
1508 | 1508 | ||
1509 | spin_lock(&fc->lock); | 1509 | spin_lock(&fc->lock); |
1510 | BUG_ON(fi->writectr < 0); | 1510 | BUG_ON(fi->writectr < 0); |
diff --git a/fs/fuse/file.c b/fs/fuse/file.c index aa03aab6a24f..b03d253ece15 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c | |||
@@ -207,7 +207,7 @@ int fuse_open_common(struct inode *inode, struct file *file, bool isdir) | |||
207 | return err; | 207 | return err; |
208 | 208 | ||
209 | if (lock_inode) | 209 | if (lock_inode) |
210 | mutex_lock(&inode->i_mutex); | 210 | inode_lock(inode); |
211 | 211 | ||
212 | err = fuse_do_open(fc, get_node_id(inode), file, isdir); | 212 | err = fuse_do_open(fc, get_node_id(inode), file, isdir); |
213 | 213 | ||
@@ -215,7 +215,7 @@ int fuse_open_common(struct inode *inode, struct file *file, bool isdir) | |||
215 | fuse_finish_open(inode, file); | 215 | fuse_finish_open(inode, file); |
216 | 216 | ||
217 | if (lock_inode) | 217 | if (lock_inode) |
218 | mutex_unlock(&inode->i_mutex); | 218 | inode_unlock(inode); |
219 | 219 | ||
220 | return err; | 220 | return err; |
221 | } | 221 | } |
@@ -413,9 +413,9 @@ static int fuse_flush(struct file *file, fl_owner_t id) | |||
413 | if (err) | 413 | if (err) |
414 | return err; | 414 | return err; |
415 | 415 | ||
416 | mutex_lock(&inode->i_mutex); | 416 | inode_lock(inode); |
417 | fuse_sync_writes(inode); | 417 | fuse_sync_writes(inode); |
418 | mutex_unlock(&inode->i_mutex); | 418 | inode_unlock(inode); |
419 | 419 | ||
420 | req = fuse_get_req_nofail_nopages(fc, file); | 420 | req = fuse_get_req_nofail_nopages(fc, file); |
421 | memset(&inarg, 0, sizeof(inarg)); | 421 | memset(&inarg, 0, sizeof(inarg)); |
@@ -450,7 +450,7 @@ int fuse_fsync_common(struct file *file, loff_t start, loff_t end, | |||
450 | if (is_bad_inode(inode)) | 450 | if (is_bad_inode(inode)) |
451 | return -EIO; | 451 | return -EIO; |
452 | 452 | ||
453 | mutex_lock(&inode->i_mutex); | 453 | inode_lock(inode); |
454 | 454 | ||
455 | /* | 455 | /* |
456 | * Start writeback against all dirty pages of the inode, then | 456 | * Start writeback against all dirty pages of the inode, then |
@@ -486,7 +486,7 @@ int fuse_fsync_common(struct file *file, loff_t start, loff_t end, | |||
486 | err = 0; | 486 | err = 0; |
487 | } | 487 | } |
488 | out: | 488 | out: |
489 | mutex_unlock(&inode->i_mutex); | 489 | inode_unlock(inode); |
490 | return err; | 490 | return err; |
491 | } | 491 | } |
492 | 492 | ||
@@ -1160,7 +1160,7 @@ static ssize_t fuse_file_write_iter(struct kiocb *iocb, struct iov_iter *from) | |||
1160 | return generic_file_write_iter(iocb, from); | 1160 | return generic_file_write_iter(iocb, from); |
1161 | } | 1161 | } |
1162 | 1162 | ||
1163 | mutex_lock(&inode->i_mutex); | 1163 | inode_lock(inode); |
1164 | 1164 | ||
1165 | /* We can write back this queue in page reclaim */ | 1165 | /* We can write back this queue in page reclaim */ |
1166 | current->backing_dev_info = inode_to_bdi(inode); | 1166 | current->backing_dev_info = inode_to_bdi(inode); |
@@ -1210,7 +1210,7 @@ static ssize_t fuse_file_write_iter(struct kiocb *iocb, struct iov_iter *from) | |||
1210 | } | 1210 | } |
1211 | out: | 1211 | out: |
1212 | current->backing_dev_info = NULL; | 1212 | current->backing_dev_info = NULL; |
1213 | mutex_unlock(&inode->i_mutex); | 1213 | inode_unlock(inode); |
1214 | 1214 | ||
1215 | return written ? written : err; | 1215 | return written ? written : err; |
1216 | } | 1216 | } |
@@ -1322,10 +1322,10 @@ ssize_t fuse_direct_io(struct fuse_io_priv *io, struct iov_iter *iter, | |||
1322 | 1322 | ||
1323 | if (!cuse && fuse_range_is_writeback(inode, idx_from, idx_to)) { | 1323 | if (!cuse && fuse_range_is_writeback(inode, idx_from, idx_to)) { |
1324 | if (!write) | 1324 | if (!write) |
1325 | mutex_lock(&inode->i_mutex); | 1325 | inode_lock(inode); |
1326 | fuse_sync_writes(inode); | 1326 | fuse_sync_writes(inode); |
1327 | if (!write) | 1327 | if (!write) |
1328 | mutex_unlock(&inode->i_mutex); | 1328 | inode_unlock(inode); |
1329 | } | 1329 | } |
1330 | 1330 | ||
1331 | while (count) { | 1331 | while (count) { |
@@ -1413,14 +1413,14 @@ static ssize_t fuse_direct_write_iter(struct kiocb *iocb, struct iov_iter *from) | |||
1413 | return -EIO; | 1413 | return -EIO; |
1414 | 1414 | ||
1415 | /* Don't allow parallel writes to the same file */ | 1415 | /* Don't allow parallel writes to the same file */ |
1416 | mutex_lock(&inode->i_mutex); | 1416 | inode_lock(inode); |
1417 | res = generic_write_checks(iocb, from); | 1417 | res = generic_write_checks(iocb, from); |
1418 | if (res > 0) | 1418 | if (res > 0) |
1419 | res = fuse_direct_io(&io, from, &iocb->ki_pos, FUSE_DIO_WRITE); | 1419 | res = fuse_direct_io(&io, from, &iocb->ki_pos, FUSE_DIO_WRITE); |
1420 | fuse_invalidate_attr(inode); | 1420 | fuse_invalidate_attr(inode); |
1421 | if (res > 0) | 1421 | if (res > 0) |
1422 | fuse_write_update_size(inode, iocb->ki_pos); | 1422 | fuse_write_update_size(inode, iocb->ki_pos); |
1423 | mutex_unlock(&inode->i_mutex); | 1423 | inode_unlock(inode); |
1424 | 1424 | ||
1425 | return res; | 1425 | return res; |
1426 | } | 1426 | } |
@@ -2287,17 +2287,17 @@ static loff_t fuse_file_llseek(struct file *file, loff_t offset, int whence) | |||
2287 | retval = generic_file_llseek(file, offset, whence); | 2287 | retval = generic_file_llseek(file, offset, whence); |
2288 | break; | 2288 | break; |
2289 | case SEEK_END: | 2289 | case SEEK_END: |
2290 | mutex_lock(&inode->i_mutex); | 2290 | inode_lock(inode); |
2291 | retval = fuse_update_attributes(inode, NULL, file, NULL); | 2291 | retval = fuse_update_attributes(inode, NULL, file, NULL); |
2292 | if (!retval) | 2292 | if (!retval) |
2293 | retval = generic_file_llseek(file, offset, whence); | 2293 | retval = generic_file_llseek(file, offset, whence); |
2294 | mutex_unlock(&inode->i_mutex); | 2294 | inode_unlock(inode); |
2295 | break; | 2295 | break; |
2296 | case SEEK_HOLE: | 2296 | case SEEK_HOLE: |
2297 | case SEEK_DATA: | 2297 | case SEEK_DATA: |
2298 | mutex_lock(&inode->i_mutex); | 2298 | inode_lock(inode); |
2299 | retval = fuse_lseek(file, offset, whence); | 2299 | retval = fuse_lseek(file, offset, whence); |
2300 | mutex_unlock(&inode->i_mutex); | 2300 | inode_unlock(inode); |
2301 | break; | 2301 | break; |
2302 | default: | 2302 | default: |
2303 | retval = -EINVAL; | 2303 | retval = -EINVAL; |
@@ -2944,7 +2944,7 @@ static long fuse_file_fallocate(struct file *file, int mode, loff_t offset, | |||
2944 | return -EOPNOTSUPP; | 2944 | return -EOPNOTSUPP; |
2945 | 2945 | ||
2946 | if (lock_inode) { | 2946 | if (lock_inode) { |
2947 | mutex_lock(&inode->i_mutex); | 2947 | inode_lock(inode); |
2948 | if (mode & FALLOC_FL_PUNCH_HOLE) { | 2948 | if (mode & FALLOC_FL_PUNCH_HOLE) { |
2949 | loff_t endbyte = offset + length - 1; | 2949 | loff_t endbyte = offset + length - 1; |
2950 | err = filemap_write_and_wait_range(inode->i_mapping, | 2950 | err = filemap_write_and_wait_range(inode->i_mapping, |
@@ -2990,7 +2990,7 @@ out: | |||
2990 | clear_bit(FUSE_I_SIZE_UNSTABLE, &fi->state); | 2990 | clear_bit(FUSE_I_SIZE_UNSTABLE, &fi->state); |
2991 | 2991 | ||
2992 | if (lock_inode) | 2992 | if (lock_inode) |
2993 | mutex_unlock(&inode->i_mutex); | 2993 | inode_unlock(inode); |
2994 | 2994 | ||
2995 | return err; | 2995 | return err; |
2996 | } | 2996 | } |
diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c index 7412863cda1e..c9384f932975 100644 --- a/fs/gfs2/file.c +++ b/fs/gfs2/file.c | |||
@@ -914,7 +914,7 @@ static long gfs2_fallocate(struct file *file, int mode, loff_t offset, loff_t le | |||
914 | if ((mode & ~FALLOC_FL_KEEP_SIZE) || gfs2_is_jdata(ip)) | 914 | if ((mode & ~FALLOC_FL_KEEP_SIZE) || gfs2_is_jdata(ip)) |
915 | return -EOPNOTSUPP; | 915 | return -EOPNOTSUPP; |
916 | 916 | ||
917 | mutex_lock(&inode->i_mutex); | 917 | inode_lock(inode); |
918 | 918 | ||
919 | gfs2_holder_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &gh); | 919 | gfs2_holder_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &gh); |
920 | ret = gfs2_glock_nq(&gh); | 920 | ret = gfs2_glock_nq(&gh); |
@@ -946,7 +946,7 @@ out_unlock: | |||
946 | gfs2_glock_dq(&gh); | 946 | gfs2_glock_dq(&gh); |
947 | out_uninit: | 947 | out_uninit: |
948 | gfs2_holder_uninit(&gh); | 948 | gfs2_holder_uninit(&gh); |
949 | mutex_unlock(&inode->i_mutex); | 949 | inode_unlock(inode); |
950 | return ret; | 950 | return ret; |
951 | } | 951 | } |
952 | 952 | ||
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c index 3e94400d587c..352f958769e1 100644 --- a/fs/gfs2/inode.c +++ b/fs/gfs2/inode.c | |||
@@ -2067,7 +2067,7 @@ static int gfs2_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, | |||
2067 | if (ret) | 2067 | if (ret) |
2068 | return ret; | 2068 | return ret; |
2069 | 2069 | ||
2070 | mutex_lock(&inode->i_mutex); | 2070 | inode_lock(inode); |
2071 | 2071 | ||
2072 | ret = gfs2_glock_nq_init(ip->i_gl, LM_ST_SHARED, 0, &gh); | 2072 | ret = gfs2_glock_nq_init(ip->i_gl, LM_ST_SHARED, 0, &gh); |
2073 | if (ret) | 2073 | if (ret) |
@@ -2094,7 +2094,7 @@ static int gfs2_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, | |||
2094 | 2094 | ||
2095 | gfs2_glock_dq_uninit(&gh); | 2095 | gfs2_glock_dq_uninit(&gh); |
2096 | out: | 2096 | out: |
2097 | mutex_unlock(&inode->i_mutex); | 2097 | inode_unlock(inode); |
2098 | return ret; | 2098 | return ret; |
2099 | } | 2099 | } |
2100 | 2100 | ||
diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c index be6d9c450b22..a39891344259 100644 --- a/fs/gfs2/quota.c +++ b/fs/gfs2/quota.c | |||
@@ -888,7 +888,7 @@ static int do_sync(unsigned int num_qd, struct gfs2_quota_data **qda) | |||
888 | return -ENOMEM; | 888 | return -ENOMEM; |
889 | 889 | ||
890 | sort(qda, num_qd, sizeof(struct gfs2_quota_data *), sort_qd, NULL); | 890 | sort(qda, num_qd, sizeof(struct gfs2_quota_data *), sort_qd, NULL); |
891 | mutex_lock(&ip->i_inode.i_mutex); | 891 | inode_lock(&ip->i_inode); |
892 | for (qx = 0; qx < num_qd; qx++) { | 892 | for (qx = 0; qx < num_qd; qx++) { |
893 | error = gfs2_glock_nq_init(qda[qx]->qd_gl, LM_ST_EXCLUSIVE, | 893 | error = gfs2_glock_nq_init(qda[qx]->qd_gl, LM_ST_EXCLUSIVE, |
894 | GL_NOCACHE, &ghs[qx]); | 894 | GL_NOCACHE, &ghs[qx]); |
@@ -953,7 +953,7 @@ out_alloc: | |||
953 | out: | 953 | out: |
954 | while (qx--) | 954 | while (qx--) |
955 | gfs2_glock_dq_uninit(&ghs[qx]); | 955 | gfs2_glock_dq_uninit(&ghs[qx]); |
956 | mutex_unlock(&ip->i_inode.i_mutex); | 956 | inode_unlock(&ip->i_inode); |
957 | kfree(ghs); | 957 | kfree(ghs); |
958 | gfs2_log_flush(ip->i_gl->gl_name.ln_sbd, ip->i_gl, NORMAL_FLUSH); | 958 | gfs2_log_flush(ip->i_gl->gl_name.ln_sbd, ip->i_gl, NORMAL_FLUSH); |
959 | return error; | 959 | return error; |
@@ -1674,7 +1674,7 @@ static int gfs2_set_dqblk(struct super_block *sb, struct kqid qid, | |||
1674 | if (error) | 1674 | if (error) |
1675 | goto out_put; | 1675 | goto out_put; |
1676 | 1676 | ||
1677 | mutex_lock(&ip->i_inode.i_mutex); | 1677 | inode_lock(&ip->i_inode); |
1678 | error = gfs2_glock_nq_init(qd->qd_gl, LM_ST_EXCLUSIVE, 0, &q_gh); | 1678 | error = gfs2_glock_nq_init(qd->qd_gl, LM_ST_EXCLUSIVE, 0, &q_gh); |
1679 | if (error) | 1679 | if (error) |
1680 | goto out_unlockput; | 1680 | goto out_unlockput; |
@@ -1739,7 +1739,7 @@ out_i: | |||
1739 | out_q: | 1739 | out_q: |
1740 | gfs2_glock_dq_uninit(&q_gh); | 1740 | gfs2_glock_dq_uninit(&q_gh); |
1741 | out_unlockput: | 1741 | out_unlockput: |
1742 | mutex_unlock(&ip->i_inode.i_mutex); | 1742 | inode_unlock(&ip->i_inode); |
1743 | out_put: | 1743 | out_put: |
1744 | qd_put(qd); | 1744 | qd_put(qd); |
1745 | return error; | 1745 | return error; |
diff --git a/fs/hfs/dir.c b/fs/hfs/dir.c index 70788e03820a..e9f2b855f831 100644 --- a/fs/hfs/dir.c +++ b/fs/hfs/dir.c | |||
@@ -173,9 +173,9 @@ static int hfs_dir_release(struct inode *inode, struct file *file) | |||
173 | { | 173 | { |
174 | struct hfs_readdir_data *rd = file->private_data; | 174 | struct hfs_readdir_data *rd = file->private_data; |
175 | if (rd) { | 175 | if (rd) { |
176 | mutex_lock(&inode->i_mutex); | 176 | inode_lock(inode); |
177 | list_del(&rd->list); | 177 | list_del(&rd->list); |
178 | mutex_unlock(&inode->i_mutex); | 178 | inode_unlock(inode); |
179 | kfree(rd); | 179 | kfree(rd); |
180 | } | 180 | } |
181 | return 0; | 181 | return 0; |
diff --git a/fs/hfs/inode.c b/fs/hfs/inode.c index b99ebddb10cb..6686bf39a5b5 100644 --- a/fs/hfs/inode.c +++ b/fs/hfs/inode.c | |||
@@ -570,13 +570,13 @@ static int hfs_file_release(struct inode *inode, struct file *file) | |||
570 | if (HFS_IS_RSRC(inode)) | 570 | if (HFS_IS_RSRC(inode)) |
571 | inode = HFS_I(inode)->rsrc_inode; | 571 | inode = HFS_I(inode)->rsrc_inode; |
572 | if (atomic_dec_and_test(&HFS_I(inode)->opencnt)) { | 572 | if (atomic_dec_and_test(&HFS_I(inode)->opencnt)) { |
573 | mutex_lock(&inode->i_mutex); | 573 | inode_lock(inode); |
574 | hfs_file_truncate(inode); | 574 | hfs_file_truncate(inode); |
575 | //if (inode->i_flags & S_DEAD) { | 575 | //if (inode->i_flags & S_DEAD) { |
576 | // hfs_delete_cat(inode->i_ino, HFSPLUS_SB(sb).hidden_dir, NULL); | 576 | // hfs_delete_cat(inode->i_ino, HFSPLUS_SB(sb).hidden_dir, NULL); |
577 | // hfs_delete_inode(inode); | 577 | // hfs_delete_inode(inode); |
578 | //} | 578 | //} |
579 | mutex_unlock(&inode->i_mutex); | 579 | inode_unlock(inode); |
580 | } | 580 | } |
581 | return 0; | 581 | return 0; |
582 | } | 582 | } |
@@ -656,7 +656,7 @@ static int hfs_file_fsync(struct file *filp, loff_t start, loff_t end, | |||
656 | ret = filemap_write_and_wait_range(inode->i_mapping, start, end); | 656 | ret = filemap_write_and_wait_range(inode->i_mapping, start, end); |
657 | if (ret) | 657 | if (ret) |
658 | return ret; | 658 | return ret; |
659 | mutex_lock(&inode->i_mutex); | 659 | inode_lock(inode); |
660 | 660 | ||
661 | /* sync the inode to buffers */ | 661 | /* sync the inode to buffers */ |
662 | ret = write_inode_now(inode, 0); | 662 | ret = write_inode_now(inode, 0); |
@@ -668,7 +668,7 @@ static int hfs_file_fsync(struct file *filp, loff_t start, loff_t end, | |||
668 | err = sync_blockdev(sb->s_bdev); | 668 | err = sync_blockdev(sb->s_bdev); |
669 | if (!ret) | 669 | if (!ret) |
670 | ret = err; | 670 | ret = err; |
671 | mutex_unlock(&inode->i_mutex); | 671 | inode_unlock(inode); |
672 | return ret; | 672 | return ret; |
673 | } | 673 | } |
674 | 674 | ||
diff --git a/fs/hfsplus/dir.c b/fs/hfsplus/dir.c index d0f39dcbb58e..a4e867e08947 100644 --- a/fs/hfsplus/dir.c +++ b/fs/hfsplus/dir.c | |||
@@ -284,9 +284,9 @@ static int hfsplus_dir_release(struct inode *inode, struct file *file) | |||
284 | { | 284 | { |
285 | struct hfsplus_readdir_data *rd = file->private_data; | 285 | struct hfsplus_readdir_data *rd = file->private_data; |
286 | if (rd) { | 286 | if (rd) { |
287 | mutex_lock(&inode->i_mutex); | 287 | inode_lock(inode); |
288 | list_del(&rd->list); | 288 | list_del(&rd->list); |
289 | mutex_unlock(&inode->i_mutex); | 289 | inode_unlock(inode); |
290 | kfree(rd); | 290 | kfree(rd); |
291 | } | 291 | } |
292 | return 0; | 292 | return 0; |
diff --git a/fs/hfsplus/inode.c b/fs/hfsplus/inode.c index 19b33f8151f1..1a6394cdb54e 100644 --- a/fs/hfsplus/inode.c +++ b/fs/hfsplus/inode.c | |||
@@ -229,14 +229,14 @@ static int hfsplus_file_release(struct inode *inode, struct file *file) | |||
229 | if (HFSPLUS_IS_RSRC(inode)) | 229 | if (HFSPLUS_IS_RSRC(inode)) |
230 | inode = HFSPLUS_I(inode)->rsrc_inode; | 230 | inode = HFSPLUS_I(inode)->rsrc_inode; |
231 | if (atomic_dec_and_test(&HFSPLUS_I(inode)->opencnt)) { | 231 | if (atomic_dec_and_test(&HFSPLUS_I(inode)->opencnt)) { |
232 | mutex_lock(&inode->i_mutex); | 232 | inode_lock(inode); |
233 | hfsplus_file_truncate(inode); | 233 | hfsplus_file_truncate(inode); |
234 | if (inode->i_flags & S_DEAD) { | 234 | if (inode->i_flags & S_DEAD) { |
235 | hfsplus_delete_cat(inode->i_ino, | 235 | hfsplus_delete_cat(inode->i_ino, |
236 | HFSPLUS_SB(sb)->hidden_dir, NULL); | 236 | HFSPLUS_SB(sb)->hidden_dir, NULL); |
237 | hfsplus_delete_inode(inode); | 237 | hfsplus_delete_inode(inode); |
238 | } | 238 | } |
239 | mutex_unlock(&inode->i_mutex); | 239 | inode_unlock(inode); |
240 | } | 240 | } |
241 | return 0; | 241 | return 0; |
242 | } | 242 | } |
@@ -286,7 +286,7 @@ int hfsplus_file_fsync(struct file *file, loff_t start, loff_t end, | |||
286 | error = filemap_write_and_wait_range(inode->i_mapping, start, end); | 286 | error = filemap_write_and_wait_range(inode->i_mapping, start, end); |
287 | if (error) | 287 | if (error) |
288 | return error; | 288 | return error; |
289 | mutex_lock(&inode->i_mutex); | 289 | inode_lock(inode); |
290 | 290 | ||
291 | /* | 291 | /* |
292 | * Sync inode metadata into the catalog and extent trees. | 292 | * Sync inode metadata into the catalog and extent trees. |
@@ -327,7 +327,7 @@ int hfsplus_file_fsync(struct file *file, loff_t start, loff_t end, | |||
327 | if (!test_bit(HFSPLUS_SB_NOBARRIER, &sbi->flags)) | 327 | if (!test_bit(HFSPLUS_SB_NOBARRIER, &sbi->flags)) |
328 | blkdev_issue_flush(inode->i_sb->s_bdev, GFP_KERNEL, NULL); | 328 | blkdev_issue_flush(inode->i_sb->s_bdev, GFP_KERNEL, NULL); |
329 | 329 | ||
330 | mutex_unlock(&inode->i_mutex); | 330 | inode_unlock(inode); |
331 | 331 | ||
332 | return error; | 332 | return error; |
333 | } | 333 | } |
diff --git a/fs/hfsplus/ioctl.c b/fs/hfsplus/ioctl.c index 0624ce4e0702..32a49e292b6a 100644 --- a/fs/hfsplus/ioctl.c +++ b/fs/hfsplus/ioctl.c | |||
@@ -93,7 +93,7 @@ static int hfsplus_ioctl_setflags(struct file *file, int __user *user_flags) | |||
93 | goto out_drop_write; | 93 | goto out_drop_write; |
94 | } | 94 | } |
95 | 95 | ||
96 | mutex_lock(&inode->i_mutex); | 96 | inode_lock(inode); |
97 | 97 | ||
98 | if ((flags & (FS_IMMUTABLE_FL|FS_APPEND_FL)) || | 98 | if ((flags & (FS_IMMUTABLE_FL|FS_APPEND_FL)) || |
99 | inode->i_flags & (S_IMMUTABLE|S_APPEND)) { | 99 | inode->i_flags & (S_IMMUTABLE|S_APPEND)) { |
@@ -126,7 +126,7 @@ static int hfsplus_ioctl_setflags(struct file *file, int __user *user_flags) | |||
126 | mark_inode_dirty(inode); | 126 | mark_inode_dirty(inode); |
127 | 127 | ||
128 | out_unlock_inode: | 128 | out_unlock_inode: |
129 | mutex_unlock(&inode->i_mutex); | 129 | inode_unlock(inode); |
130 | out_drop_write: | 130 | out_drop_write: |
131 | mnt_drop_write_file(file); | 131 | mnt_drop_write_file(file); |
132 | out: | 132 | out: |
diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c index cfaa18c7a337..d1abbee281d1 100644 --- a/fs/hostfs/hostfs_kern.c +++ b/fs/hostfs/hostfs_kern.c | |||
@@ -378,9 +378,9 @@ static int hostfs_fsync(struct file *file, loff_t start, loff_t end, | |||
378 | if (ret) | 378 | if (ret) |
379 | return ret; | 379 | return ret; |
380 | 380 | ||
381 | mutex_lock(&inode->i_mutex); | 381 | inode_lock(inode); |
382 | ret = fsync_file(HOSTFS_I(inode)->fd, datasync); | 382 | ret = fsync_file(HOSTFS_I(inode)->fd, datasync); |
383 | mutex_unlock(&inode->i_mutex); | 383 | inode_unlock(inode); |
384 | 384 | ||
385 | return ret; | 385 | return ret; |
386 | } | 386 | } |
diff --git a/fs/hpfs/dir.c b/fs/hpfs/dir.c index dc540bfcee1d..e57a53c13d86 100644 --- a/fs/hpfs/dir.c +++ b/fs/hpfs/dir.c | |||
@@ -33,7 +33,7 @@ static loff_t hpfs_dir_lseek(struct file *filp, loff_t off, int whence) | |||
33 | if (whence == SEEK_DATA || whence == SEEK_HOLE) | 33 | if (whence == SEEK_DATA || whence == SEEK_HOLE) |
34 | return -EINVAL; | 34 | return -EINVAL; |
35 | 35 | ||
36 | mutex_lock(&i->i_mutex); | 36 | inode_lock(i); |
37 | hpfs_lock(s); | 37 | hpfs_lock(s); |
38 | 38 | ||
39 | /*pr_info("dir lseek\n");*/ | 39 | /*pr_info("dir lseek\n");*/ |
@@ -48,12 +48,12 @@ static loff_t hpfs_dir_lseek(struct file *filp, loff_t off, int whence) | |||
48 | ok: | 48 | ok: |
49 | filp->f_pos = new_off; | 49 | filp->f_pos = new_off; |
50 | hpfs_unlock(s); | 50 | hpfs_unlock(s); |
51 | mutex_unlock(&i->i_mutex); | 51 | inode_unlock(i); |
52 | return new_off; | 52 | return new_off; |
53 | fail: | 53 | fail: |
54 | /*pr_warn("illegal lseek: %016llx\n", new_off);*/ | 54 | /*pr_warn("illegal lseek: %016llx\n", new_off);*/ |
55 | hpfs_unlock(s); | 55 | hpfs_unlock(s); |
56 | mutex_unlock(&i->i_mutex); | 56 | inode_unlock(i); |
57 | return -ESPIPE; | 57 | return -ESPIPE; |
58 | } | 58 | } |
59 | 59 | ||
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index 8bbf7f3e2a27..e1f465a389d5 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c | |||
@@ -141,7 +141,7 @@ static int hugetlbfs_file_mmap(struct file *file, struct vm_area_struct *vma) | |||
141 | 141 | ||
142 | vma_len = (loff_t)(vma->vm_end - vma->vm_start); | 142 | vma_len = (loff_t)(vma->vm_end - vma->vm_start); |
143 | 143 | ||
144 | mutex_lock(&inode->i_mutex); | 144 | inode_lock(inode); |
145 | file_accessed(file); | 145 | file_accessed(file); |
146 | 146 | ||
147 | ret = -ENOMEM; | 147 | ret = -ENOMEM; |
@@ -157,7 +157,7 @@ static int hugetlbfs_file_mmap(struct file *file, struct vm_area_struct *vma) | |||
157 | if (vma->vm_flags & VM_WRITE && inode->i_size < len) | 157 | if (vma->vm_flags & VM_WRITE && inode->i_size < len) |
158 | inode->i_size = len; | 158 | inode->i_size = len; |
159 | out: | 159 | out: |
160 | mutex_unlock(&inode->i_mutex); | 160 | inode_unlock(inode); |
161 | 161 | ||
162 | return ret; | 162 | return ret; |
163 | } | 163 | } |
@@ -530,7 +530,7 @@ static long hugetlbfs_punch_hole(struct inode *inode, loff_t offset, loff_t len) | |||
530 | if (hole_end > hole_start) { | 530 | if (hole_end > hole_start) { |
531 | struct address_space *mapping = inode->i_mapping; | 531 | struct address_space *mapping = inode->i_mapping; |
532 | 532 | ||
533 | mutex_lock(&inode->i_mutex); | 533 | inode_lock(inode); |
534 | i_mmap_lock_write(mapping); | 534 | i_mmap_lock_write(mapping); |
535 | if (!RB_EMPTY_ROOT(&mapping->i_mmap)) | 535 | if (!RB_EMPTY_ROOT(&mapping->i_mmap)) |
536 | hugetlb_vmdelete_list(&mapping->i_mmap, | 536 | hugetlb_vmdelete_list(&mapping->i_mmap, |
@@ -538,7 +538,7 @@ static long hugetlbfs_punch_hole(struct inode *inode, loff_t offset, loff_t len) | |||
538 | hole_end >> PAGE_SHIFT); | 538 | hole_end >> PAGE_SHIFT); |
539 | i_mmap_unlock_write(mapping); | 539 | i_mmap_unlock_write(mapping); |
540 | remove_inode_hugepages(inode, hole_start, hole_end); | 540 | remove_inode_hugepages(inode, hole_start, hole_end); |
541 | mutex_unlock(&inode->i_mutex); | 541 | inode_unlock(inode); |
542 | } | 542 | } |
543 | 543 | ||
544 | return 0; | 544 | return 0; |
@@ -572,7 +572,7 @@ static long hugetlbfs_fallocate(struct file *file, int mode, loff_t offset, | |||
572 | start = offset >> hpage_shift; | 572 | start = offset >> hpage_shift; |
573 | end = (offset + len + hpage_size - 1) >> hpage_shift; | 573 | end = (offset + len + hpage_size - 1) >> hpage_shift; |
574 | 574 | ||
575 | mutex_lock(&inode->i_mutex); | 575 | inode_lock(inode); |
576 | 576 | ||
577 | /* We need to check rlimit even when FALLOC_FL_KEEP_SIZE */ | 577 | /* We need to check rlimit even when FALLOC_FL_KEEP_SIZE */ |
578 | error = inode_newsize_ok(inode, offset + len); | 578 | error = inode_newsize_ok(inode, offset + len); |
@@ -659,7 +659,7 @@ static long hugetlbfs_fallocate(struct file *file, int mode, loff_t offset, | |||
659 | i_size_write(inode, offset + len); | 659 | i_size_write(inode, offset + len); |
660 | inode->i_ctime = CURRENT_TIME; | 660 | inode->i_ctime = CURRENT_TIME; |
661 | out: | 661 | out: |
662 | mutex_unlock(&inode->i_mutex); | 662 | inode_unlock(inode); |
663 | return error; | 663 | return error; |
664 | } | 664 | } |
665 | 665 | ||
diff --git a/fs/inode.c b/fs/inode.c index e491e54d2430..bb8685220292 100644 --- a/fs/inode.c +++ b/fs/inode.c | |||
@@ -966,9 +966,9 @@ void lock_two_nondirectories(struct inode *inode1, struct inode *inode2) | |||
966 | swap(inode1, inode2); | 966 | swap(inode1, inode2); |
967 | 967 | ||
968 | if (inode1 && !S_ISDIR(inode1->i_mode)) | 968 | if (inode1 && !S_ISDIR(inode1->i_mode)) |
969 | mutex_lock(&inode1->i_mutex); | 969 | inode_lock(inode1); |
970 | if (inode2 && !S_ISDIR(inode2->i_mode) && inode2 != inode1) | 970 | if (inode2 && !S_ISDIR(inode2->i_mode) && inode2 != inode1) |
971 | mutex_lock_nested(&inode2->i_mutex, I_MUTEX_NONDIR2); | 971 | inode_lock_nested(inode2, I_MUTEX_NONDIR2); |
972 | } | 972 | } |
973 | EXPORT_SYMBOL(lock_two_nondirectories); | 973 | EXPORT_SYMBOL(lock_two_nondirectories); |
974 | 974 | ||
@@ -980,9 +980,9 @@ EXPORT_SYMBOL(lock_two_nondirectories); | |||
980 | void unlock_two_nondirectories(struct inode *inode1, struct inode *inode2) | 980 | void unlock_two_nondirectories(struct inode *inode1, struct inode *inode2) |
981 | { | 981 | { |
982 | if (inode1 && !S_ISDIR(inode1->i_mode)) | 982 | if (inode1 && !S_ISDIR(inode1->i_mode)) |
983 | mutex_unlock(&inode1->i_mutex); | 983 | inode_unlock(inode1); |
984 | if (inode2 && !S_ISDIR(inode2->i_mode) && inode2 != inode1) | 984 | if (inode2 && !S_ISDIR(inode2->i_mode) && inode2 != inode1) |
985 | mutex_unlock(&inode2->i_mutex); | 985 | inode_unlock(inode2); |
986 | } | 986 | } |
987 | EXPORT_SYMBOL(unlock_two_nondirectories); | 987 | EXPORT_SYMBOL(unlock_two_nondirectories); |
988 | 988 | ||
diff --git a/fs/ioctl.c b/fs/ioctl.c index 29466c380958..116a333e9c77 100644 --- a/fs/ioctl.c +++ b/fs/ioctl.c | |||
@@ -434,9 +434,9 @@ int generic_block_fiemap(struct inode *inode, | |||
434 | u64 len, get_block_t *get_block) | 434 | u64 len, get_block_t *get_block) |
435 | { | 435 | { |
436 | int ret; | 436 | int ret; |
437 | mutex_lock(&inode->i_mutex); | 437 | inode_lock(inode); |
438 | ret = __generic_block_fiemap(inode, fieinfo, start, len, get_block); | 438 | ret = __generic_block_fiemap(inode, fieinfo, start, len, get_block); |
439 | mutex_unlock(&inode->i_mutex); | 439 | inode_unlock(inode); |
440 | return ret; | 440 | return ret; |
441 | } | 441 | } |
442 | EXPORT_SYMBOL(generic_block_fiemap); | 442 | EXPORT_SYMBOL(generic_block_fiemap); |
diff --git a/fs/jffs2/file.c b/fs/jffs2/file.c index f509f62e12f6..c5ac5944bc1b 100644 --- a/fs/jffs2/file.c +++ b/fs/jffs2/file.c | |||
@@ -39,10 +39,10 @@ int jffs2_fsync(struct file *filp, loff_t start, loff_t end, int datasync) | |||
39 | if (ret) | 39 | if (ret) |
40 | return ret; | 40 | return ret; |
41 | 41 | ||
42 | mutex_lock(&inode->i_mutex); | 42 | inode_lock(inode); |
43 | /* Trigger GC to flush any pending writes for this inode */ | 43 | /* Trigger GC to flush any pending writes for this inode */ |
44 | jffs2_flush_wbuf_gc(c, inode->i_ino); | 44 | jffs2_flush_wbuf_gc(c, inode->i_ino); |
45 | mutex_unlock(&inode->i_mutex); | 45 | inode_unlock(inode); |
46 | 46 | ||
47 | return 0; | 47 | return 0; |
48 | } | 48 | } |
diff --git a/fs/jfs/file.c b/fs/jfs/file.c index 0e026a7bdcd4..4ce7735dd042 100644 --- a/fs/jfs/file.c +++ b/fs/jfs/file.c | |||
@@ -38,17 +38,17 @@ int jfs_fsync(struct file *file, loff_t start, loff_t end, int datasync) | |||
38 | if (rc) | 38 | if (rc) |
39 | return rc; | 39 | return rc; |
40 | 40 | ||
41 | mutex_lock(&inode->i_mutex); | 41 | inode_lock(inode); |
42 | if (!(inode->i_state & I_DIRTY_ALL) || | 42 | if (!(inode->i_state & I_DIRTY_ALL) || |
43 | (datasync && !(inode->i_state & I_DIRTY_DATASYNC))) { | 43 | (datasync && !(inode->i_state & I_DIRTY_DATASYNC))) { |
44 | /* Make sure committed changes hit the disk */ | 44 | /* Make sure committed changes hit the disk */ |
45 | jfs_flush_journal(JFS_SBI(inode->i_sb)->log, 1); | 45 | jfs_flush_journal(JFS_SBI(inode->i_sb)->log, 1); |
46 | mutex_unlock(&inode->i_mutex); | 46 | inode_unlock(inode); |
47 | return rc; | 47 | return rc; |
48 | } | 48 | } |
49 | 49 | ||
50 | rc |= jfs_commit_inode(inode, 1); | 50 | rc |= jfs_commit_inode(inode, 1); |
51 | mutex_unlock(&inode->i_mutex); | 51 | inode_unlock(inode); |
52 | 52 | ||
53 | return rc ? -EIO : 0; | 53 | return rc ? -EIO : 0; |
54 | } | 54 | } |
diff --git a/fs/jfs/ioctl.c b/fs/jfs/ioctl.c index 8db8b7d61e40..8653cac7e12e 100644 --- a/fs/jfs/ioctl.c +++ b/fs/jfs/ioctl.c | |||
@@ -96,7 +96,7 @@ long jfs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | |||
96 | } | 96 | } |
97 | 97 | ||
98 | /* Lock against other parallel changes of flags */ | 98 | /* Lock against other parallel changes of flags */ |
99 | mutex_lock(&inode->i_mutex); | 99 | inode_lock(inode); |
100 | 100 | ||
101 | jfs_get_inode_flags(jfs_inode); | 101 | jfs_get_inode_flags(jfs_inode); |
102 | oldflags = jfs_inode->mode2; | 102 | oldflags = jfs_inode->mode2; |
@@ -109,7 +109,7 @@ long jfs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | |||
109 | ((flags ^ oldflags) & | 109 | ((flags ^ oldflags) & |
110 | (JFS_APPEND_FL | JFS_IMMUTABLE_FL))) { | 110 | (JFS_APPEND_FL | JFS_IMMUTABLE_FL))) { |
111 | if (!capable(CAP_LINUX_IMMUTABLE)) { | 111 | if (!capable(CAP_LINUX_IMMUTABLE)) { |
112 | mutex_unlock(&inode->i_mutex); | 112 | inode_unlock(inode); |
113 | err = -EPERM; | 113 | err = -EPERM; |
114 | goto setflags_out; | 114 | goto setflags_out; |
115 | } | 115 | } |
@@ -120,7 +120,7 @@ long jfs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | |||
120 | jfs_inode->mode2 = flags; | 120 | jfs_inode->mode2 = flags; |
121 | 121 | ||
122 | jfs_set_inode_flags(inode); | 122 | jfs_set_inode_flags(inode); |
123 | mutex_unlock(&inode->i_mutex); | 123 | inode_unlock(inode); |
124 | inode->i_ctime = CURRENT_TIME_SEC; | 124 | inode->i_ctime = CURRENT_TIME_SEC; |
125 | mark_inode_dirty(inode); | 125 | mark_inode_dirty(inode); |
126 | setflags_out: | 126 | setflags_out: |
diff --git a/fs/jfs/super.c b/fs/jfs/super.c index 900925b5eb8c..4f5d85ba8e23 100644 --- a/fs/jfs/super.c +++ b/fs/jfs/super.c | |||
@@ -792,7 +792,7 @@ static ssize_t jfs_quota_write(struct super_block *sb, int type, | |||
792 | struct buffer_head tmp_bh; | 792 | struct buffer_head tmp_bh; |
793 | struct buffer_head *bh; | 793 | struct buffer_head *bh; |
794 | 794 | ||
795 | mutex_lock(&inode->i_mutex); | 795 | inode_lock(inode); |
796 | while (towrite > 0) { | 796 | while (towrite > 0) { |
797 | tocopy = sb->s_blocksize - offset < towrite ? | 797 | tocopy = sb->s_blocksize - offset < towrite ? |
798 | sb->s_blocksize - offset : towrite; | 798 | sb->s_blocksize - offset : towrite; |
@@ -824,7 +824,7 @@ static ssize_t jfs_quota_write(struct super_block *sb, int type, | |||
824 | } | 824 | } |
825 | out: | 825 | out: |
826 | if (len == towrite) { | 826 | if (len == towrite) { |
827 | mutex_unlock(&inode->i_mutex); | 827 | inode_unlock(inode); |
828 | return err; | 828 | return err; |
829 | } | 829 | } |
830 | if (inode->i_size < off+len-towrite) | 830 | if (inode->i_size < off+len-towrite) |
@@ -832,7 +832,7 @@ out: | |||
832 | inode->i_version++; | 832 | inode->i_version++; |
833 | inode->i_mtime = inode->i_ctime = CURRENT_TIME; | 833 | inode->i_mtime = inode->i_ctime = CURRENT_TIME; |
834 | mark_inode_dirty(inode); | 834 | mark_inode_dirty(inode); |
835 | mutex_unlock(&inode->i_mutex); | 835 | inode_unlock(inode); |
836 | return len - towrite; | 836 | return len - towrite; |
837 | } | 837 | } |
838 | 838 | ||
diff --git a/fs/kernfs/dir.c b/fs/kernfs/dir.c index 821973853340..996b7742c90b 100644 --- a/fs/kernfs/dir.c +++ b/fs/kernfs/dir.c | |||
@@ -1511,9 +1511,9 @@ static loff_t kernfs_dir_fop_llseek(struct file *file, loff_t offset, | |||
1511 | struct inode *inode = file_inode(file); | 1511 | struct inode *inode = file_inode(file); |
1512 | loff_t ret; | 1512 | loff_t ret; |
1513 | 1513 | ||
1514 | mutex_lock(&inode->i_mutex); | 1514 | inode_lock(inode); |
1515 | ret = generic_file_llseek(file, offset, whence); | 1515 | ret = generic_file_llseek(file, offset, whence); |
1516 | mutex_unlock(&inode->i_mutex); | 1516 | inode_unlock(inode); |
1517 | 1517 | ||
1518 | return ret; | 1518 | return ret; |
1519 | } | 1519 | } |
diff --git a/fs/libfs.c b/fs/libfs.c index 01491299f348..0ca80b2af420 100644 --- a/fs/libfs.c +++ b/fs/libfs.c | |||
@@ -89,7 +89,7 @@ EXPORT_SYMBOL(dcache_dir_close); | |||
89 | loff_t dcache_dir_lseek(struct file *file, loff_t offset, int whence) | 89 | loff_t dcache_dir_lseek(struct file *file, loff_t offset, int whence) |
90 | { | 90 | { |
91 | struct dentry *dentry = file->f_path.dentry; | 91 | struct dentry *dentry = file->f_path.dentry; |
92 | mutex_lock(&d_inode(dentry)->i_mutex); | 92 | inode_lock(d_inode(dentry)); |
93 | switch (whence) { | 93 | switch (whence) { |
94 | case 1: | 94 | case 1: |
95 | offset += file->f_pos; | 95 | offset += file->f_pos; |
@@ -97,7 +97,7 @@ loff_t dcache_dir_lseek(struct file *file, loff_t offset, int whence) | |||
97 | if (offset >= 0) | 97 | if (offset >= 0) |
98 | break; | 98 | break; |
99 | default: | 99 | default: |
100 | mutex_unlock(&d_inode(dentry)->i_mutex); | 100 | inode_unlock(d_inode(dentry)); |
101 | return -EINVAL; | 101 | return -EINVAL; |
102 | } | 102 | } |
103 | if (offset != file->f_pos) { | 103 | if (offset != file->f_pos) { |
@@ -124,7 +124,7 @@ loff_t dcache_dir_lseek(struct file *file, loff_t offset, int whence) | |||
124 | spin_unlock(&dentry->d_lock); | 124 | spin_unlock(&dentry->d_lock); |
125 | } | 125 | } |
126 | } | 126 | } |
127 | mutex_unlock(&d_inode(dentry)->i_mutex); | 127 | inode_unlock(d_inode(dentry)); |
128 | return offset; | 128 | return offset; |
129 | } | 129 | } |
130 | EXPORT_SYMBOL(dcache_dir_lseek); | 130 | EXPORT_SYMBOL(dcache_dir_lseek); |
@@ -941,7 +941,7 @@ int __generic_file_fsync(struct file *file, loff_t start, loff_t end, | |||
941 | if (err) | 941 | if (err) |
942 | return err; | 942 | return err; |
943 | 943 | ||
944 | mutex_lock(&inode->i_mutex); | 944 | inode_lock(inode); |
945 | ret = sync_mapping_buffers(inode->i_mapping); | 945 | ret = sync_mapping_buffers(inode->i_mapping); |
946 | if (!(inode->i_state & I_DIRTY_ALL)) | 946 | if (!(inode->i_state & I_DIRTY_ALL)) |
947 | goto out; | 947 | goto out; |
@@ -953,7 +953,7 @@ int __generic_file_fsync(struct file *file, loff_t start, loff_t end, | |||
953 | ret = err; | 953 | ret = err; |
954 | 954 | ||
955 | out: | 955 | out: |
956 | mutex_unlock(&inode->i_mutex); | 956 | inode_unlock(inode); |
957 | return ret; | 957 | return ret; |
958 | } | 958 | } |
959 | EXPORT_SYMBOL(__generic_file_fsync); | 959 | EXPORT_SYMBOL(__generic_file_fsync); |
diff --git a/fs/locks.c b/fs/locks.c index af1ed74a657f..7c5f91be9b65 100644 --- a/fs/locks.c +++ b/fs/locks.c | |||
@@ -1650,12 +1650,12 @@ generic_add_lease(struct file *filp, long arg, struct file_lock **flp, void **pr | |||
1650 | * bother, maybe that's a sign this just isn't a good file to | 1650 | * bother, maybe that's a sign this just isn't a good file to |
1651 | * hand out a delegation on. | 1651 | * hand out a delegation on. |
1652 | */ | 1652 | */ |
1653 | if (is_deleg && !mutex_trylock(&inode->i_mutex)) | 1653 | if (is_deleg && !inode_trylock(inode)) |
1654 | return -EAGAIN; | 1654 | return -EAGAIN; |
1655 | 1655 | ||
1656 | if (is_deleg && arg == F_WRLCK) { | 1656 | if (is_deleg && arg == F_WRLCK) { |
1657 | /* Write delegations are not currently supported: */ | 1657 | /* Write delegations are not currently supported: */ |
1658 | mutex_unlock(&inode->i_mutex); | 1658 | inode_unlock(inode); |
1659 | WARN_ON_ONCE(1); | 1659 | WARN_ON_ONCE(1); |
1660 | return -EINVAL; | 1660 | return -EINVAL; |
1661 | } | 1661 | } |
@@ -1732,7 +1732,7 @@ out: | |||
1732 | spin_unlock(&ctx->flc_lock); | 1732 | spin_unlock(&ctx->flc_lock); |
1733 | locks_dispose_list(&dispose); | 1733 | locks_dispose_list(&dispose); |
1734 | if (is_deleg) | 1734 | if (is_deleg) |
1735 | mutex_unlock(&inode->i_mutex); | 1735 | inode_unlock(inode); |
1736 | if (!error && !my_fl) | 1736 | if (!error && !my_fl) |
1737 | *flp = NULL; | 1737 | *flp = NULL; |
1738 | return error; | 1738 | return error; |
diff --git a/fs/logfs/file.c b/fs/logfs/file.c index 1a6f0167b16a..61eaeb1b6cac 100644 --- a/fs/logfs/file.c +++ b/fs/logfs/file.c | |||
@@ -204,12 +204,12 @@ long logfs_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
204 | if (err) | 204 | if (err) |
205 | return err; | 205 | return err; |
206 | 206 | ||
207 | mutex_lock(&inode->i_mutex); | 207 | inode_lock(inode); |
208 | oldflags = li->li_flags; | 208 | oldflags = li->li_flags; |
209 | flags &= LOGFS_FL_USER_MODIFIABLE; | 209 | flags &= LOGFS_FL_USER_MODIFIABLE; |
210 | flags |= oldflags & ~LOGFS_FL_USER_MODIFIABLE; | 210 | flags |= oldflags & ~LOGFS_FL_USER_MODIFIABLE; |
211 | li->li_flags = flags; | 211 | li->li_flags = flags; |
212 | mutex_unlock(&inode->i_mutex); | 212 | inode_unlock(inode); |
213 | 213 | ||
214 | inode->i_ctime = CURRENT_TIME; | 214 | inode->i_ctime = CURRENT_TIME; |
215 | mark_inode_dirty_sync(inode); | 215 | mark_inode_dirty_sync(inode); |
@@ -230,11 +230,11 @@ int logfs_fsync(struct file *file, loff_t start, loff_t end, int datasync) | |||
230 | if (ret) | 230 | if (ret) |
231 | return ret; | 231 | return ret; |
232 | 232 | ||
233 | mutex_lock(&inode->i_mutex); | 233 | inode_lock(inode); |
234 | logfs_get_wblocks(sb, NULL, WF_LOCK); | 234 | logfs_get_wblocks(sb, NULL, WF_LOCK); |
235 | logfs_write_anchor(sb); | 235 | logfs_write_anchor(sb); |
236 | logfs_put_wblocks(sb, NULL, WF_LOCK); | 236 | logfs_put_wblocks(sb, NULL, WF_LOCK); |
237 | mutex_unlock(&inode->i_mutex); | 237 | inode_unlock(inode); |
238 | 238 | ||
239 | return 0; | 239 | return 0; |
240 | } | 240 | } |
diff --git a/fs/namei.c b/fs/namei.c index bceefd5588a2..f624d132e01e 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -1629,9 +1629,9 @@ static int lookup_slow(struct nameidata *nd, struct path *path) | |||
1629 | parent = nd->path.dentry; | 1629 | parent = nd->path.dentry; |
1630 | BUG_ON(nd->inode != parent->d_inode); | 1630 | BUG_ON(nd->inode != parent->d_inode); |
1631 | 1631 | ||
1632 | mutex_lock(&parent->d_inode->i_mutex); | 1632 | inode_lock(parent->d_inode); |
1633 | dentry = __lookup_hash(&nd->last, parent, nd->flags); | 1633 | dentry = __lookup_hash(&nd->last, parent, nd->flags); |
1634 | mutex_unlock(&parent->d_inode->i_mutex); | 1634 | inode_unlock(parent->d_inode); |
1635 | if (IS_ERR(dentry)) | 1635 | if (IS_ERR(dentry)) |
1636 | return PTR_ERR(dentry); | 1636 | return PTR_ERR(dentry); |
1637 | path->mnt = nd->path.mnt; | 1637 | path->mnt = nd->path.mnt; |
@@ -2229,10 +2229,10 @@ struct dentry *kern_path_locked(const char *name, struct path *path) | |||
2229 | putname(filename); | 2229 | putname(filename); |
2230 | return ERR_PTR(-EINVAL); | 2230 | return ERR_PTR(-EINVAL); |
2231 | } | 2231 | } |
2232 | mutex_lock_nested(&path->dentry->d_inode->i_mutex, I_MUTEX_PARENT); | 2232 | inode_lock_nested(path->dentry->d_inode, I_MUTEX_PARENT); |
2233 | d = __lookup_hash(&last, path->dentry, 0); | 2233 | d = __lookup_hash(&last, path->dentry, 0); |
2234 | if (IS_ERR(d)) { | 2234 | if (IS_ERR(d)) { |
2235 | mutex_unlock(&path->dentry->d_inode->i_mutex); | 2235 | inode_unlock(path->dentry->d_inode); |
2236 | path_put(path); | 2236 | path_put(path); |
2237 | } | 2237 | } |
2238 | putname(filename); | 2238 | putname(filename); |
@@ -2282,7 +2282,7 @@ struct dentry *lookup_one_len(const char *name, struct dentry *base, int len) | |||
2282 | unsigned int c; | 2282 | unsigned int c; |
2283 | int err; | 2283 | int err; |
2284 | 2284 | ||
2285 | WARN_ON_ONCE(!mutex_is_locked(&base->d_inode->i_mutex)); | 2285 | WARN_ON_ONCE(!inode_is_locked(base->d_inode)); |
2286 | 2286 | ||
2287 | this.name = name; | 2287 | this.name = name; |
2288 | this.len = len; | 2288 | this.len = len; |
@@ -2380,9 +2380,9 @@ struct dentry *lookup_one_len_unlocked(const char *name, | |||
2380 | if (ret) | 2380 | if (ret) |
2381 | return ret; | 2381 | return ret; |
2382 | 2382 | ||
2383 | mutex_lock(&base->d_inode->i_mutex); | 2383 | inode_lock(base->d_inode); |
2384 | ret = __lookup_hash(&this, base, 0); | 2384 | ret = __lookup_hash(&this, base, 0); |
2385 | mutex_unlock(&base->d_inode->i_mutex); | 2385 | inode_unlock(base->d_inode); |
2386 | return ret; | 2386 | return ret; |
2387 | } | 2387 | } |
2388 | EXPORT_SYMBOL(lookup_one_len_unlocked); | 2388 | EXPORT_SYMBOL(lookup_one_len_unlocked); |
@@ -2463,7 +2463,7 @@ mountpoint_last(struct nameidata *nd, struct path *path) | |||
2463 | goto done; | 2463 | goto done; |
2464 | } | 2464 | } |
2465 | 2465 | ||
2466 | mutex_lock(&dir->d_inode->i_mutex); | 2466 | inode_lock(dir->d_inode); |
2467 | dentry = d_lookup(dir, &nd->last); | 2467 | dentry = d_lookup(dir, &nd->last); |
2468 | if (!dentry) { | 2468 | if (!dentry) { |
2469 | /* | 2469 | /* |
@@ -2473,16 +2473,16 @@ mountpoint_last(struct nameidata *nd, struct path *path) | |||
2473 | */ | 2473 | */ |
2474 | dentry = d_alloc(dir, &nd->last); | 2474 | dentry = d_alloc(dir, &nd->last); |
2475 | if (!dentry) { | 2475 | if (!dentry) { |
2476 | mutex_unlock(&dir->d_inode->i_mutex); | 2476 | inode_unlock(dir->d_inode); |
2477 | return -ENOMEM; | 2477 | return -ENOMEM; |
2478 | } | 2478 | } |
2479 | dentry = lookup_real(dir->d_inode, dentry, nd->flags); | 2479 | dentry = lookup_real(dir->d_inode, dentry, nd->flags); |
2480 | if (IS_ERR(dentry)) { | 2480 | if (IS_ERR(dentry)) { |
2481 | mutex_unlock(&dir->d_inode->i_mutex); | 2481 | inode_unlock(dir->d_inode); |
2482 | return PTR_ERR(dentry); | 2482 | return PTR_ERR(dentry); |
2483 | } | 2483 | } |
2484 | } | 2484 | } |
2485 | mutex_unlock(&dir->d_inode->i_mutex); | 2485 | inode_unlock(dir->d_inode); |
2486 | 2486 | ||
2487 | done: | 2487 | done: |
2488 | if (d_is_negative(dentry)) { | 2488 | if (d_is_negative(dentry)) { |
@@ -2672,7 +2672,7 @@ struct dentry *lock_rename(struct dentry *p1, struct dentry *p2) | |||
2672 | struct dentry *p; | 2672 | struct dentry *p; |
2673 | 2673 | ||
2674 | if (p1 == p2) { | 2674 | if (p1 == p2) { |
2675 | mutex_lock_nested(&p1->d_inode->i_mutex, I_MUTEX_PARENT); | 2675 | inode_lock_nested(p1->d_inode, I_MUTEX_PARENT); |
2676 | return NULL; | 2676 | return NULL; |
2677 | } | 2677 | } |
2678 | 2678 | ||
@@ -2680,29 +2680,29 @@ struct dentry *lock_rename(struct dentry *p1, struct dentry *p2) | |||
2680 | 2680 | ||
2681 | p = d_ancestor(p2, p1); | 2681 | p = d_ancestor(p2, p1); |
2682 | if (p) { | 2682 | if (p) { |
2683 | mutex_lock_nested(&p2->d_inode->i_mutex, I_MUTEX_PARENT); | 2683 | inode_lock_nested(p2->d_inode, I_MUTEX_PARENT); |
2684 | mutex_lock_nested(&p1->d_inode->i_mutex, I_MUTEX_CHILD); | 2684 | inode_lock_nested(p1->d_inode, I_MUTEX_CHILD); |
2685 | return p; | 2685 | return p; |
2686 | } | 2686 | } |
2687 | 2687 | ||
2688 | p = d_ancestor(p1, p2); | 2688 | p = d_ancestor(p1, p2); |
2689 | if (p) { | 2689 | if (p) { |
2690 | mutex_lock_nested(&p1->d_inode->i_mutex, I_MUTEX_PARENT); | 2690 | inode_lock_nested(p1->d_inode, I_MUTEX_PARENT); |
2691 | mutex_lock_nested(&p2->d_inode->i_mutex, I_MUTEX_CHILD); | 2691 | inode_lock_nested(p2->d_inode, I_MUTEX_CHILD); |
2692 | return p; | 2692 | return p; |
2693 | } | 2693 | } |
2694 | 2694 | ||
2695 | mutex_lock_nested(&p1->d_inode->i_mutex, I_MUTEX_PARENT); | 2695 | inode_lock_nested(p1->d_inode, I_MUTEX_PARENT); |
2696 | mutex_lock_nested(&p2->d_inode->i_mutex, I_MUTEX_PARENT2); | 2696 | inode_lock_nested(p2->d_inode, I_MUTEX_PARENT2); |
2697 | return NULL; | 2697 | return NULL; |
2698 | } | 2698 | } |
2699 | EXPORT_SYMBOL(lock_rename); | 2699 | EXPORT_SYMBOL(lock_rename); |
2700 | 2700 | ||
2701 | void unlock_rename(struct dentry *p1, struct dentry *p2) | 2701 | void unlock_rename(struct dentry *p1, struct dentry *p2) |
2702 | { | 2702 | { |
2703 | mutex_unlock(&p1->d_inode->i_mutex); | 2703 | inode_unlock(p1->d_inode); |
2704 | if (p1 != p2) { | 2704 | if (p1 != p2) { |
2705 | mutex_unlock(&p2->d_inode->i_mutex); | 2705 | inode_unlock(p2->d_inode); |
2706 | mutex_unlock(&p1->d_inode->i_sb->s_vfs_rename_mutex); | 2706 | mutex_unlock(&p1->d_inode->i_sb->s_vfs_rename_mutex); |
2707 | } | 2707 | } |
2708 | } | 2708 | } |
@@ -3141,9 +3141,9 @@ retry_lookup: | |||
3141 | * dropping this one anyway. | 3141 | * dropping this one anyway. |
3142 | */ | 3142 | */ |
3143 | } | 3143 | } |
3144 | mutex_lock(&dir->d_inode->i_mutex); | 3144 | inode_lock(dir->d_inode); |
3145 | error = lookup_open(nd, &path, file, op, got_write, opened); | 3145 | error = lookup_open(nd, &path, file, op, got_write, opened); |
3146 | mutex_unlock(&dir->d_inode->i_mutex); | 3146 | inode_unlock(dir->d_inode); |
3147 | 3147 | ||
3148 | if (error <= 0) { | 3148 | if (error <= 0) { |
3149 | if (error) | 3149 | if (error) |
@@ -3489,7 +3489,7 @@ static struct dentry *filename_create(int dfd, struct filename *name, | |||
3489 | * Do the final lookup. | 3489 | * Do the final lookup. |
3490 | */ | 3490 | */ |
3491 | lookup_flags |= LOOKUP_CREATE | LOOKUP_EXCL; | 3491 | lookup_flags |= LOOKUP_CREATE | LOOKUP_EXCL; |
3492 | mutex_lock_nested(&path->dentry->d_inode->i_mutex, I_MUTEX_PARENT); | 3492 | inode_lock_nested(path->dentry->d_inode, I_MUTEX_PARENT); |
3493 | dentry = __lookup_hash(&last, path->dentry, lookup_flags); | 3493 | dentry = __lookup_hash(&last, path->dentry, lookup_flags); |
3494 | if (IS_ERR(dentry)) | 3494 | if (IS_ERR(dentry)) |
3495 | goto unlock; | 3495 | goto unlock; |
@@ -3518,7 +3518,7 @@ fail: | |||
3518 | dput(dentry); | 3518 | dput(dentry); |
3519 | dentry = ERR_PTR(error); | 3519 | dentry = ERR_PTR(error); |
3520 | unlock: | 3520 | unlock: |
3521 | mutex_unlock(&path->dentry->d_inode->i_mutex); | 3521 | inode_unlock(path->dentry->d_inode); |
3522 | if (!err2) | 3522 | if (!err2) |
3523 | mnt_drop_write(path->mnt); | 3523 | mnt_drop_write(path->mnt); |
3524 | out: | 3524 | out: |
@@ -3538,7 +3538,7 @@ EXPORT_SYMBOL(kern_path_create); | |||
3538 | void done_path_create(struct path *path, struct dentry *dentry) | 3538 | void done_path_create(struct path *path, struct dentry *dentry) |
3539 | { | 3539 | { |
3540 | dput(dentry); | 3540 | dput(dentry); |
3541 | mutex_unlock(&path->dentry->d_inode->i_mutex); | 3541 | inode_unlock(path->dentry->d_inode); |
3542 | mnt_drop_write(path->mnt); | 3542 | mnt_drop_write(path->mnt); |
3543 | path_put(path); | 3543 | path_put(path); |
3544 | } | 3544 | } |
@@ -3735,7 +3735,7 @@ int vfs_rmdir(struct inode *dir, struct dentry *dentry) | |||
3735 | return -EPERM; | 3735 | return -EPERM; |
3736 | 3736 | ||
3737 | dget(dentry); | 3737 | dget(dentry); |
3738 | mutex_lock(&dentry->d_inode->i_mutex); | 3738 | inode_lock(dentry->d_inode); |
3739 | 3739 | ||
3740 | error = -EBUSY; | 3740 | error = -EBUSY; |
3741 | if (is_local_mountpoint(dentry)) | 3741 | if (is_local_mountpoint(dentry)) |
@@ -3755,7 +3755,7 @@ int vfs_rmdir(struct inode *dir, struct dentry *dentry) | |||
3755 | detach_mounts(dentry); | 3755 | detach_mounts(dentry); |
3756 | 3756 | ||
3757 | out: | 3757 | out: |
3758 | mutex_unlock(&dentry->d_inode->i_mutex); | 3758 | inode_unlock(dentry->d_inode); |
3759 | dput(dentry); | 3759 | dput(dentry); |
3760 | if (!error) | 3760 | if (!error) |
3761 | d_delete(dentry); | 3761 | d_delete(dentry); |
@@ -3794,7 +3794,7 @@ retry: | |||
3794 | if (error) | 3794 | if (error) |
3795 | goto exit1; | 3795 | goto exit1; |
3796 | 3796 | ||
3797 | mutex_lock_nested(&path.dentry->d_inode->i_mutex, I_MUTEX_PARENT); | 3797 | inode_lock_nested(path.dentry->d_inode, I_MUTEX_PARENT); |
3798 | dentry = __lookup_hash(&last, path.dentry, lookup_flags); | 3798 | dentry = __lookup_hash(&last, path.dentry, lookup_flags); |
3799 | error = PTR_ERR(dentry); | 3799 | error = PTR_ERR(dentry); |
3800 | if (IS_ERR(dentry)) | 3800 | if (IS_ERR(dentry)) |
@@ -3810,7 +3810,7 @@ retry: | |||
3810 | exit3: | 3810 | exit3: |
3811 | dput(dentry); | 3811 | dput(dentry); |
3812 | exit2: | 3812 | exit2: |
3813 | mutex_unlock(&path.dentry->d_inode->i_mutex); | 3813 | inode_unlock(path.dentry->d_inode); |
3814 | mnt_drop_write(path.mnt); | 3814 | mnt_drop_write(path.mnt); |
3815 | exit1: | 3815 | exit1: |
3816 | path_put(&path); | 3816 | path_put(&path); |
@@ -3856,7 +3856,7 @@ int vfs_unlink(struct inode *dir, struct dentry *dentry, struct inode **delegate | |||
3856 | if (!dir->i_op->unlink) | 3856 | if (!dir->i_op->unlink) |
3857 | return -EPERM; | 3857 | return -EPERM; |
3858 | 3858 | ||
3859 | mutex_lock(&target->i_mutex); | 3859 | inode_lock(target); |
3860 | if (is_local_mountpoint(dentry)) | 3860 | if (is_local_mountpoint(dentry)) |
3861 | error = -EBUSY; | 3861 | error = -EBUSY; |
3862 | else { | 3862 | else { |
@@ -3873,7 +3873,7 @@ int vfs_unlink(struct inode *dir, struct dentry *dentry, struct inode **delegate | |||
3873 | } | 3873 | } |
3874 | } | 3874 | } |
3875 | out: | 3875 | out: |
3876 | mutex_unlock(&target->i_mutex); | 3876 | inode_unlock(target); |
3877 | 3877 | ||
3878 | /* We don't d_delete() NFS sillyrenamed files--they still exist. */ | 3878 | /* We don't d_delete() NFS sillyrenamed files--they still exist. */ |
3879 | if (!error && !(dentry->d_flags & DCACHE_NFSFS_RENAMED)) { | 3879 | if (!error && !(dentry->d_flags & DCACHE_NFSFS_RENAMED)) { |
@@ -3916,7 +3916,7 @@ retry: | |||
3916 | if (error) | 3916 | if (error) |
3917 | goto exit1; | 3917 | goto exit1; |
3918 | retry_deleg: | 3918 | retry_deleg: |
3919 | mutex_lock_nested(&path.dentry->d_inode->i_mutex, I_MUTEX_PARENT); | 3919 | inode_lock_nested(path.dentry->d_inode, I_MUTEX_PARENT); |
3920 | dentry = __lookup_hash(&last, path.dentry, lookup_flags); | 3920 | dentry = __lookup_hash(&last, path.dentry, lookup_flags); |
3921 | error = PTR_ERR(dentry); | 3921 | error = PTR_ERR(dentry); |
3922 | if (!IS_ERR(dentry)) { | 3922 | if (!IS_ERR(dentry)) { |
@@ -3934,7 +3934,7 @@ retry_deleg: | |||
3934 | exit2: | 3934 | exit2: |
3935 | dput(dentry); | 3935 | dput(dentry); |
3936 | } | 3936 | } |
3937 | mutex_unlock(&path.dentry->d_inode->i_mutex); | 3937 | inode_unlock(path.dentry->d_inode); |
3938 | if (inode) | 3938 | if (inode) |
3939 | iput(inode); /* truncate the inode here */ | 3939 | iput(inode); /* truncate the inode here */ |
3940 | inode = NULL; | 3940 | inode = NULL; |
@@ -4086,7 +4086,7 @@ int vfs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *new_de | |||
4086 | if (error) | 4086 | if (error) |
4087 | return error; | 4087 | return error; |
4088 | 4088 | ||
4089 | mutex_lock(&inode->i_mutex); | 4089 | inode_lock(inode); |
4090 | /* Make sure we don't allow creating hardlink to an unlinked file */ | 4090 | /* Make sure we don't allow creating hardlink to an unlinked file */ |
4091 | if (inode->i_nlink == 0 && !(inode->i_state & I_LINKABLE)) | 4091 | if (inode->i_nlink == 0 && !(inode->i_state & I_LINKABLE)) |
4092 | error = -ENOENT; | 4092 | error = -ENOENT; |
@@ -4103,7 +4103,7 @@ int vfs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *new_de | |||
4103 | inode->i_state &= ~I_LINKABLE; | 4103 | inode->i_state &= ~I_LINKABLE; |
4104 | spin_unlock(&inode->i_lock); | 4104 | spin_unlock(&inode->i_lock); |
4105 | } | 4105 | } |
4106 | mutex_unlock(&inode->i_mutex); | 4106 | inode_unlock(inode); |
4107 | if (!error) | 4107 | if (!error) |
4108 | fsnotify_link(dir, inode, new_dentry); | 4108 | fsnotify_link(dir, inode, new_dentry); |
4109 | return error; | 4109 | return error; |
@@ -4303,7 +4303,7 @@ int vfs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
4303 | if (!is_dir || (flags & RENAME_EXCHANGE)) | 4303 | if (!is_dir || (flags & RENAME_EXCHANGE)) |
4304 | lock_two_nondirectories(source, target); | 4304 | lock_two_nondirectories(source, target); |
4305 | else if (target) | 4305 | else if (target) |
4306 | mutex_lock(&target->i_mutex); | 4306 | inode_lock(target); |
4307 | 4307 | ||
4308 | error = -EBUSY; | 4308 | error = -EBUSY; |
4309 | if (is_local_mountpoint(old_dentry) || is_local_mountpoint(new_dentry)) | 4309 | if (is_local_mountpoint(old_dentry) || is_local_mountpoint(new_dentry)) |
@@ -4356,7 +4356,7 @@ out: | |||
4356 | if (!is_dir || (flags & RENAME_EXCHANGE)) | 4356 | if (!is_dir || (flags & RENAME_EXCHANGE)) |
4357 | unlock_two_nondirectories(source, target); | 4357 | unlock_two_nondirectories(source, target); |
4358 | else if (target) | 4358 | else if (target) |
4359 | mutex_unlock(&target->i_mutex); | 4359 | inode_unlock(target); |
4360 | dput(new_dentry); | 4360 | dput(new_dentry); |
4361 | if (!error) { | 4361 | if (!error) { |
4362 | fsnotify_move(old_dir, new_dir, old_name, is_dir, | 4362 | fsnotify_move(old_dir, new_dir, old_name, is_dir, |
diff --git a/fs/namespace.c b/fs/namespace.c index a830e1463704..4fb1691b4355 100644 --- a/fs/namespace.c +++ b/fs/namespace.c | |||
@@ -1961,9 +1961,9 @@ static struct mountpoint *lock_mount(struct path *path) | |||
1961 | struct vfsmount *mnt; | 1961 | struct vfsmount *mnt; |
1962 | struct dentry *dentry = path->dentry; | 1962 | struct dentry *dentry = path->dentry; |
1963 | retry: | 1963 | retry: |
1964 | mutex_lock(&dentry->d_inode->i_mutex); | 1964 | inode_lock(dentry->d_inode); |
1965 | if (unlikely(cant_mount(dentry))) { | 1965 | if (unlikely(cant_mount(dentry))) { |
1966 | mutex_unlock(&dentry->d_inode->i_mutex); | 1966 | inode_unlock(dentry->d_inode); |
1967 | return ERR_PTR(-ENOENT); | 1967 | return ERR_PTR(-ENOENT); |
1968 | } | 1968 | } |
1969 | namespace_lock(); | 1969 | namespace_lock(); |
@@ -1974,13 +1974,13 @@ retry: | |||
1974 | mp = new_mountpoint(dentry); | 1974 | mp = new_mountpoint(dentry); |
1975 | if (IS_ERR(mp)) { | 1975 | if (IS_ERR(mp)) { |
1976 | namespace_unlock(); | 1976 | namespace_unlock(); |
1977 | mutex_unlock(&dentry->d_inode->i_mutex); | 1977 | inode_unlock(dentry->d_inode); |
1978 | return mp; | 1978 | return mp; |
1979 | } | 1979 | } |
1980 | return mp; | 1980 | return mp; |
1981 | } | 1981 | } |
1982 | namespace_unlock(); | 1982 | namespace_unlock(); |
1983 | mutex_unlock(&path->dentry->d_inode->i_mutex); | 1983 | inode_unlock(path->dentry->d_inode); |
1984 | path_put(path); | 1984 | path_put(path); |
1985 | path->mnt = mnt; | 1985 | path->mnt = mnt; |
1986 | dentry = path->dentry = dget(mnt->mnt_root); | 1986 | dentry = path->dentry = dget(mnt->mnt_root); |
@@ -1992,7 +1992,7 @@ static void unlock_mount(struct mountpoint *where) | |||
1992 | struct dentry *dentry = where->m_dentry; | 1992 | struct dentry *dentry = where->m_dentry; |
1993 | put_mountpoint(where); | 1993 | put_mountpoint(where); |
1994 | namespace_unlock(); | 1994 | namespace_unlock(); |
1995 | mutex_unlock(&dentry->d_inode->i_mutex); | 1995 | inode_unlock(dentry->d_inode); |
1996 | } | 1996 | } |
1997 | 1997 | ||
1998 | static int graft_tree(struct mount *mnt, struct mount *p, struct mountpoint *mp) | 1998 | static int graft_tree(struct mount *mnt, struct mount *p, struct mountpoint *mp) |
diff --git a/fs/ncpfs/dir.c b/fs/ncpfs/dir.c index f0e3e9e747dd..26c2de2de13f 100644 --- a/fs/ncpfs/dir.c +++ b/fs/ncpfs/dir.c | |||
@@ -369,7 +369,7 @@ ncp_lookup_validate(struct dentry *dentry, unsigned int flags) | |||
369 | if (!res) { | 369 | if (!res) { |
370 | struct inode *inode = d_inode(dentry); | 370 | struct inode *inode = d_inode(dentry); |
371 | 371 | ||
372 | mutex_lock(&inode->i_mutex); | 372 | inode_lock(inode); |
373 | if (finfo.i.dirEntNum == NCP_FINFO(inode)->dirEntNum) { | 373 | if (finfo.i.dirEntNum == NCP_FINFO(inode)->dirEntNum) { |
374 | ncp_new_dentry(dentry); | 374 | ncp_new_dentry(dentry); |
375 | val=1; | 375 | val=1; |
@@ -377,7 +377,7 @@ ncp_lookup_validate(struct dentry *dentry, unsigned int flags) | |||
377 | ncp_dbg(2, "found, but dirEntNum changed\n"); | 377 | ncp_dbg(2, "found, but dirEntNum changed\n"); |
378 | 378 | ||
379 | ncp_update_inode2(inode, &finfo); | 379 | ncp_update_inode2(inode, &finfo); |
380 | mutex_unlock(&inode->i_mutex); | 380 | inode_unlock(inode); |
381 | } | 381 | } |
382 | 382 | ||
383 | finished: | 383 | finished: |
@@ -639,9 +639,9 @@ ncp_fill_cache(struct file *file, struct dir_context *ctx, | |||
639 | } else { | 639 | } else { |
640 | struct inode *inode = d_inode(newdent); | 640 | struct inode *inode = d_inode(newdent); |
641 | 641 | ||
642 | mutex_lock_nested(&inode->i_mutex, I_MUTEX_CHILD); | 642 | inode_lock_nested(inode, I_MUTEX_CHILD); |
643 | ncp_update_inode2(inode, entry); | 643 | ncp_update_inode2(inode, entry); |
644 | mutex_unlock(&inode->i_mutex); | 644 | inode_unlock(inode); |
645 | } | 645 | } |
646 | 646 | ||
647 | if (ctl.idx >= NCP_DIRCACHE_SIZE) { | 647 | if (ctl.idx >= NCP_DIRCACHE_SIZE) { |
diff --git a/fs/ncpfs/file.c b/fs/ncpfs/file.c index 011324ce9df2..dd38ca1f2ecb 100644 --- a/fs/ncpfs/file.c +++ b/fs/ncpfs/file.c | |||
@@ -224,10 +224,10 @@ ncp_file_write_iter(struct kiocb *iocb, struct iov_iter *from) | |||
224 | iocb->ki_pos = pos; | 224 | iocb->ki_pos = pos; |
225 | 225 | ||
226 | if (pos > i_size_read(inode)) { | 226 | if (pos > i_size_read(inode)) { |
227 | mutex_lock(&inode->i_mutex); | 227 | inode_lock(inode); |
228 | if (pos > i_size_read(inode)) | 228 | if (pos > i_size_read(inode)) |
229 | i_size_write(inode, pos); | 229 | i_size_write(inode, pos); |
230 | mutex_unlock(&inode->i_mutex); | 230 | inode_unlock(inode); |
231 | } | 231 | } |
232 | ncp_dbg(1, "exit %pD2\n", file); | 232 | ncp_dbg(1, "exit %pD2\n", file); |
233 | outrel: | 233 | outrel: |
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index c82a21228a34..9cce67043f92 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c | |||
@@ -940,7 +940,7 @@ static loff_t nfs_llseek_dir(struct file *filp, loff_t offset, int whence) | |||
940 | dfprintk(FILE, "NFS: llseek dir(%pD2, %lld, %d)\n", | 940 | dfprintk(FILE, "NFS: llseek dir(%pD2, %lld, %d)\n", |
941 | filp, offset, whence); | 941 | filp, offset, whence); |
942 | 942 | ||
943 | mutex_lock(&inode->i_mutex); | 943 | inode_lock(inode); |
944 | switch (whence) { | 944 | switch (whence) { |
945 | case 1: | 945 | case 1: |
946 | offset += filp->f_pos; | 946 | offset += filp->f_pos; |
@@ -957,7 +957,7 @@ static loff_t nfs_llseek_dir(struct file *filp, loff_t offset, int whence) | |||
957 | dir_ctx->duped = 0; | 957 | dir_ctx->duped = 0; |
958 | } | 958 | } |
959 | out: | 959 | out: |
960 | mutex_unlock(&inode->i_mutex); | 960 | inode_unlock(inode); |
961 | return offset; | 961 | return offset; |
962 | } | 962 | } |
963 | 963 | ||
@@ -972,9 +972,9 @@ static int nfs_fsync_dir(struct file *filp, loff_t start, loff_t end, | |||
972 | 972 | ||
973 | dfprintk(FILE, "NFS: fsync dir(%pD2) datasync %d\n", filp, datasync); | 973 | dfprintk(FILE, "NFS: fsync dir(%pD2) datasync %d\n", filp, datasync); |
974 | 974 | ||
975 | mutex_lock(&inode->i_mutex); | 975 | inode_lock(inode); |
976 | nfs_inc_stats(inode, NFSIOS_VFSFSYNC); | 976 | nfs_inc_stats(inode, NFSIOS_VFSFSYNC); |
977 | mutex_unlock(&inode->i_mutex); | 977 | inode_unlock(inode); |
978 | return 0; | 978 | return 0; |
979 | } | 979 | } |
980 | 980 | ||
diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c index 7ab7ec9f4eed..7a0cfd3266e5 100644 --- a/fs/nfs/direct.c +++ b/fs/nfs/direct.c | |||
@@ -580,7 +580,7 @@ ssize_t nfs_file_direct_read(struct kiocb *iocb, struct iov_iter *iter, | |||
580 | if (!count) | 580 | if (!count) |
581 | goto out; | 581 | goto out; |
582 | 582 | ||
583 | mutex_lock(&inode->i_mutex); | 583 | inode_lock(inode); |
584 | result = nfs_sync_mapping(mapping); | 584 | result = nfs_sync_mapping(mapping); |
585 | if (result) | 585 | if (result) |
586 | goto out_unlock; | 586 | goto out_unlock; |
@@ -608,7 +608,7 @@ ssize_t nfs_file_direct_read(struct kiocb *iocb, struct iov_iter *iter, | |||
608 | NFS_I(inode)->read_io += count; | 608 | NFS_I(inode)->read_io += count; |
609 | result = nfs_direct_read_schedule_iovec(dreq, iter, pos); | 609 | result = nfs_direct_read_schedule_iovec(dreq, iter, pos); |
610 | 610 | ||
611 | mutex_unlock(&inode->i_mutex); | 611 | inode_unlock(inode); |
612 | 612 | ||
613 | if (!result) { | 613 | if (!result) { |
614 | result = nfs_direct_wait(dreq); | 614 | result = nfs_direct_wait(dreq); |
@@ -622,7 +622,7 @@ ssize_t nfs_file_direct_read(struct kiocb *iocb, struct iov_iter *iter, | |||
622 | out_release: | 622 | out_release: |
623 | nfs_direct_req_release(dreq); | 623 | nfs_direct_req_release(dreq); |
624 | out_unlock: | 624 | out_unlock: |
625 | mutex_unlock(&inode->i_mutex); | 625 | inode_unlock(inode); |
626 | out: | 626 | out: |
627 | return result; | 627 | return result; |
628 | } | 628 | } |
@@ -1005,7 +1005,7 @@ ssize_t nfs_file_direct_write(struct kiocb *iocb, struct iov_iter *iter) | |||
1005 | pos = iocb->ki_pos; | 1005 | pos = iocb->ki_pos; |
1006 | end = (pos + iov_iter_count(iter) - 1) >> PAGE_CACHE_SHIFT; | 1006 | end = (pos + iov_iter_count(iter) - 1) >> PAGE_CACHE_SHIFT; |
1007 | 1007 | ||
1008 | mutex_lock(&inode->i_mutex); | 1008 | inode_lock(inode); |
1009 | 1009 | ||
1010 | result = nfs_sync_mapping(mapping); | 1010 | result = nfs_sync_mapping(mapping); |
1011 | if (result) | 1011 | if (result) |
@@ -1045,7 +1045,7 @@ ssize_t nfs_file_direct_write(struct kiocb *iocb, struct iov_iter *iter) | |||
1045 | pos >> PAGE_CACHE_SHIFT, end); | 1045 | pos >> PAGE_CACHE_SHIFT, end); |
1046 | } | 1046 | } |
1047 | 1047 | ||
1048 | mutex_unlock(&inode->i_mutex); | 1048 | inode_unlock(inode); |
1049 | 1049 | ||
1050 | if (!result) { | 1050 | if (!result) { |
1051 | result = nfs_direct_wait(dreq); | 1051 | result = nfs_direct_wait(dreq); |
@@ -1066,7 +1066,7 @@ ssize_t nfs_file_direct_write(struct kiocb *iocb, struct iov_iter *iter) | |||
1066 | out_release: | 1066 | out_release: |
1067 | nfs_direct_req_release(dreq); | 1067 | nfs_direct_req_release(dreq); |
1068 | out_unlock: | 1068 | out_unlock: |
1069 | mutex_unlock(&inode->i_mutex); | 1069 | inode_unlock(inode); |
1070 | return result; | 1070 | return result; |
1071 | } | 1071 | } |
1072 | 1072 | ||
diff --git a/fs/nfs/file.c b/fs/nfs/file.c index 4ef8f5addcad..748bb813b8ec 100644 --- a/fs/nfs/file.c +++ b/fs/nfs/file.c | |||
@@ -278,9 +278,9 @@ nfs_file_fsync(struct file *file, loff_t start, loff_t end, int datasync) | |||
278 | ret = filemap_write_and_wait_range(inode->i_mapping, start, end); | 278 | ret = filemap_write_and_wait_range(inode->i_mapping, start, end); |
279 | if (ret != 0) | 279 | if (ret != 0) |
280 | break; | 280 | break; |
281 | mutex_lock(&inode->i_mutex); | 281 | inode_lock(inode); |
282 | ret = nfs_file_fsync_commit(file, start, end, datasync); | 282 | ret = nfs_file_fsync_commit(file, start, end, datasync); |
283 | mutex_unlock(&inode->i_mutex); | 283 | inode_unlock(inode); |
284 | /* | 284 | /* |
285 | * If nfs_file_fsync_commit detected a server reboot, then | 285 | * If nfs_file_fsync_commit detected a server reboot, then |
286 | * resend all dirty pages that might have been covered by | 286 | * resend all dirty pages that might have been covered by |
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index 8e24d886d2c5..86faecf8f328 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c | |||
@@ -661,9 +661,9 @@ int nfs_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat) | |||
661 | trace_nfs_getattr_enter(inode); | 661 | trace_nfs_getattr_enter(inode); |
662 | /* Flush out writes to the server in order to update c/mtime. */ | 662 | /* Flush out writes to the server in order to update c/mtime. */ |
663 | if (S_ISREG(inode->i_mode)) { | 663 | if (S_ISREG(inode->i_mode)) { |
664 | mutex_lock(&inode->i_mutex); | 664 | inode_lock(inode); |
665 | err = nfs_sync_inode(inode); | 665 | err = nfs_sync_inode(inode); |
666 | mutex_unlock(&inode->i_mutex); | 666 | inode_unlock(inode); |
667 | if (err) | 667 | if (err) |
668 | goto out; | 668 | goto out; |
669 | } | 669 | } |
@@ -1178,9 +1178,9 @@ static int __nfs_revalidate_mapping(struct inode *inode, | |||
1178 | spin_unlock(&inode->i_lock); | 1178 | spin_unlock(&inode->i_lock); |
1179 | trace_nfs_invalidate_mapping_enter(inode); | 1179 | trace_nfs_invalidate_mapping_enter(inode); |
1180 | if (may_lock) { | 1180 | if (may_lock) { |
1181 | mutex_lock(&inode->i_mutex); | 1181 | inode_lock(inode); |
1182 | ret = nfs_invalidate_mapping(inode, mapping); | 1182 | ret = nfs_invalidate_mapping(inode, mapping); |
1183 | mutex_unlock(&inode->i_mutex); | 1183 | inode_unlock(inode); |
1184 | } else | 1184 | } else |
1185 | ret = nfs_invalidate_mapping(inode, mapping); | 1185 | ret = nfs_invalidate_mapping(inode, mapping); |
1186 | trace_nfs_invalidate_mapping_exit(inode, ret); | 1186 | trace_nfs_invalidate_mapping_exit(inode, ret); |
diff --git a/fs/nfs/nfs42proc.c b/fs/nfs/nfs42proc.c index 6e8174930a48..bd25dc7077f7 100644 --- a/fs/nfs/nfs42proc.c +++ b/fs/nfs/nfs42proc.c | |||
@@ -101,13 +101,13 @@ int nfs42_proc_allocate(struct file *filep, loff_t offset, loff_t len) | |||
101 | if (!nfs_server_capable(inode, NFS_CAP_ALLOCATE)) | 101 | if (!nfs_server_capable(inode, NFS_CAP_ALLOCATE)) |
102 | return -EOPNOTSUPP; | 102 | return -EOPNOTSUPP; |
103 | 103 | ||
104 | mutex_lock(&inode->i_mutex); | 104 | inode_lock(inode); |
105 | 105 | ||
106 | err = nfs42_proc_fallocate(&msg, filep, offset, len); | 106 | err = nfs42_proc_fallocate(&msg, filep, offset, len); |
107 | if (err == -EOPNOTSUPP) | 107 | if (err == -EOPNOTSUPP) |
108 | NFS_SERVER(inode)->caps &= ~NFS_CAP_ALLOCATE; | 108 | NFS_SERVER(inode)->caps &= ~NFS_CAP_ALLOCATE; |
109 | 109 | ||
110 | mutex_unlock(&inode->i_mutex); | 110 | inode_unlock(inode); |
111 | return err; | 111 | return err; |
112 | } | 112 | } |
113 | 113 | ||
@@ -123,7 +123,7 @@ int nfs42_proc_deallocate(struct file *filep, loff_t offset, loff_t len) | |||
123 | return -EOPNOTSUPP; | 123 | return -EOPNOTSUPP; |
124 | 124 | ||
125 | nfs_wb_all(inode); | 125 | nfs_wb_all(inode); |
126 | mutex_lock(&inode->i_mutex); | 126 | inode_lock(inode); |
127 | 127 | ||
128 | err = nfs42_proc_fallocate(&msg, filep, offset, len); | 128 | err = nfs42_proc_fallocate(&msg, filep, offset, len); |
129 | if (err == 0) | 129 | if (err == 0) |
@@ -131,7 +131,7 @@ int nfs42_proc_deallocate(struct file *filep, loff_t offset, loff_t len) | |||
131 | if (err == -EOPNOTSUPP) | 131 | if (err == -EOPNOTSUPP) |
132 | NFS_SERVER(inode)->caps &= ~NFS_CAP_DEALLOCATE; | 132 | NFS_SERVER(inode)->caps &= ~NFS_CAP_DEALLOCATE; |
133 | 133 | ||
134 | mutex_unlock(&inode->i_mutex); | 134 | inode_unlock(inode); |
135 | return err; | 135 | return err; |
136 | } | 136 | } |
137 | 137 | ||
diff --git a/fs/nfs/nfs4file.c b/fs/nfs/nfs4file.c index 26f9a23e2b25..57ca1c8039c1 100644 --- a/fs/nfs/nfs4file.c +++ b/fs/nfs/nfs4file.c | |||
@@ -141,11 +141,11 @@ nfs4_file_fsync(struct file *file, loff_t start, loff_t end, int datasync) | |||
141 | ret = filemap_write_and_wait_range(inode->i_mapping, start, end); | 141 | ret = filemap_write_and_wait_range(inode->i_mapping, start, end); |
142 | if (ret != 0) | 142 | if (ret != 0) |
143 | break; | 143 | break; |
144 | mutex_lock(&inode->i_mutex); | 144 | inode_lock(inode); |
145 | ret = nfs_file_fsync_commit(file, start, end, datasync); | 145 | ret = nfs_file_fsync_commit(file, start, end, datasync); |
146 | if (!ret) | 146 | if (!ret) |
147 | ret = pnfs_sync_inode(inode, !!datasync); | 147 | ret = pnfs_sync_inode(inode, !!datasync); |
148 | mutex_unlock(&inode->i_mutex); | 148 | inode_unlock(inode); |
149 | /* | 149 | /* |
150 | * If nfs_file_fsync_commit detected a server reboot, then | 150 | * If nfs_file_fsync_commit detected a server reboot, then |
151 | * resend all dirty pages that might have been covered by | 151 | * resend all dirty pages that might have been covered by |
@@ -219,13 +219,13 @@ static int nfs42_clone_file_range(struct file *src_file, loff_t src_off, | |||
219 | 219 | ||
220 | /* XXX: do we lock at all? what if server needs CB_RECALL_LAYOUT? */ | 220 | /* XXX: do we lock at all? what if server needs CB_RECALL_LAYOUT? */ |
221 | if (same_inode) { | 221 | if (same_inode) { |
222 | mutex_lock(&src_inode->i_mutex); | 222 | inode_lock(src_inode); |
223 | } else if (dst_inode < src_inode) { | 223 | } else if (dst_inode < src_inode) { |
224 | mutex_lock_nested(&dst_inode->i_mutex, I_MUTEX_PARENT); | 224 | inode_lock_nested(dst_inode, I_MUTEX_PARENT); |
225 | mutex_lock_nested(&src_inode->i_mutex, I_MUTEX_CHILD); | 225 | inode_lock_nested(src_inode, I_MUTEX_CHILD); |
226 | } else { | 226 | } else { |
227 | mutex_lock_nested(&src_inode->i_mutex, I_MUTEX_PARENT); | 227 | inode_lock_nested(src_inode, I_MUTEX_PARENT); |
228 | mutex_lock_nested(&dst_inode->i_mutex, I_MUTEX_CHILD); | 228 | inode_lock_nested(dst_inode, I_MUTEX_CHILD); |
229 | } | 229 | } |
230 | 230 | ||
231 | /* flush all pending writes on both src and dst so that server | 231 | /* flush all pending writes on both src and dst so that server |
@@ -246,13 +246,13 @@ static int nfs42_clone_file_range(struct file *src_file, loff_t src_off, | |||
246 | 246 | ||
247 | out_unlock: | 247 | out_unlock: |
248 | if (same_inode) { | 248 | if (same_inode) { |
249 | mutex_unlock(&src_inode->i_mutex); | 249 | inode_unlock(src_inode); |
250 | } else if (dst_inode < src_inode) { | 250 | } else if (dst_inode < src_inode) { |
251 | mutex_unlock(&src_inode->i_mutex); | 251 | inode_unlock(src_inode); |
252 | mutex_unlock(&dst_inode->i_mutex); | 252 | inode_unlock(dst_inode); |
253 | } else { | 253 | } else { |
254 | mutex_unlock(&dst_inode->i_mutex); | 254 | inode_unlock(dst_inode); |
255 | mutex_unlock(&src_inode->i_mutex); | 255 | inode_unlock(src_inode); |
256 | } | 256 | } |
257 | out: | 257 | out: |
258 | return ret; | 258 | return ret; |
diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c index 819ad812c71b..4cba7865f496 100644 --- a/fs/nfsd/nfs4proc.c +++ b/fs/nfsd/nfs4proc.c | |||
@@ -55,10 +55,10 @@ nfsd4_security_inode_setsecctx(struct svc_fh *resfh, struct xdr_netobj *label, u | |||
55 | struct inode *inode = d_inode(resfh->fh_dentry); | 55 | struct inode *inode = d_inode(resfh->fh_dentry); |
56 | int status; | 56 | int status; |
57 | 57 | ||
58 | mutex_lock(&inode->i_mutex); | 58 | inode_lock(inode); |
59 | status = security_inode_setsecctx(resfh->fh_dentry, | 59 | status = security_inode_setsecctx(resfh->fh_dentry, |
60 | label->data, label->len); | 60 | label->data, label->len); |
61 | mutex_unlock(&inode->i_mutex); | 61 | inode_unlock(inode); |
62 | 62 | ||
63 | if (status) | 63 | if (status) |
64 | /* | 64 | /* |
diff --git a/fs/nfsd/nfs4recover.c b/fs/nfsd/nfs4recover.c index 79f0307a5ec8..dc8ebecf5618 100644 --- a/fs/nfsd/nfs4recover.c +++ b/fs/nfsd/nfs4recover.c | |||
@@ -192,7 +192,7 @@ nfsd4_create_clid_dir(struct nfs4_client *clp) | |||
192 | 192 | ||
193 | dir = nn->rec_file->f_path.dentry; | 193 | dir = nn->rec_file->f_path.dentry; |
194 | /* lock the parent */ | 194 | /* lock the parent */ |
195 | mutex_lock(&d_inode(dir)->i_mutex); | 195 | inode_lock(d_inode(dir)); |
196 | 196 | ||
197 | dentry = lookup_one_len(dname, dir, HEXDIR_LEN-1); | 197 | dentry = lookup_one_len(dname, dir, HEXDIR_LEN-1); |
198 | if (IS_ERR(dentry)) { | 198 | if (IS_ERR(dentry)) { |
@@ -213,7 +213,7 @@ nfsd4_create_clid_dir(struct nfs4_client *clp) | |||
213 | out_put: | 213 | out_put: |
214 | dput(dentry); | 214 | dput(dentry); |
215 | out_unlock: | 215 | out_unlock: |
216 | mutex_unlock(&d_inode(dir)->i_mutex); | 216 | inode_unlock(d_inode(dir)); |
217 | if (status == 0) { | 217 | if (status == 0) { |
218 | if (nn->in_grace) { | 218 | if (nn->in_grace) { |
219 | crp = nfs4_client_to_reclaim(dname, nn); | 219 | crp = nfs4_client_to_reclaim(dname, nn); |
@@ -286,7 +286,7 @@ nfsd4_list_rec_dir(recdir_func *f, struct nfsd_net *nn) | |||
286 | } | 286 | } |
287 | 287 | ||
288 | status = iterate_dir(nn->rec_file, &ctx.ctx); | 288 | status = iterate_dir(nn->rec_file, &ctx.ctx); |
289 | mutex_lock_nested(&d_inode(dir)->i_mutex, I_MUTEX_PARENT); | 289 | inode_lock_nested(d_inode(dir), I_MUTEX_PARENT); |
290 | 290 | ||
291 | list_for_each_entry_safe(entry, tmp, &ctx.names, list) { | 291 | list_for_each_entry_safe(entry, tmp, &ctx.names, list) { |
292 | if (!status) { | 292 | if (!status) { |
@@ -302,7 +302,7 @@ nfsd4_list_rec_dir(recdir_func *f, struct nfsd_net *nn) | |||
302 | list_del(&entry->list); | 302 | list_del(&entry->list); |
303 | kfree(entry); | 303 | kfree(entry); |
304 | } | 304 | } |
305 | mutex_unlock(&d_inode(dir)->i_mutex); | 305 | inode_unlock(d_inode(dir)); |
306 | nfs4_reset_creds(original_cred); | 306 | nfs4_reset_creds(original_cred); |
307 | 307 | ||
308 | list_for_each_entry_safe(entry, tmp, &ctx.names, list) { | 308 | list_for_each_entry_safe(entry, tmp, &ctx.names, list) { |
@@ -322,7 +322,7 @@ nfsd4_unlink_clid_dir(char *name, int namlen, struct nfsd_net *nn) | |||
322 | dprintk("NFSD: nfsd4_unlink_clid_dir. name %.*s\n", namlen, name); | 322 | dprintk("NFSD: nfsd4_unlink_clid_dir. name %.*s\n", namlen, name); |
323 | 323 | ||
324 | dir = nn->rec_file->f_path.dentry; | 324 | dir = nn->rec_file->f_path.dentry; |
325 | mutex_lock_nested(&d_inode(dir)->i_mutex, I_MUTEX_PARENT); | 325 | inode_lock_nested(d_inode(dir), I_MUTEX_PARENT); |
326 | dentry = lookup_one_len(name, dir, namlen); | 326 | dentry = lookup_one_len(name, dir, namlen); |
327 | if (IS_ERR(dentry)) { | 327 | if (IS_ERR(dentry)) { |
328 | status = PTR_ERR(dentry); | 328 | status = PTR_ERR(dentry); |
@@ -335,7 +335,7 @@ nfsd4_unlink_clid_dir(char *name, int namlen, struct nfsd_net *nn) | |||
335 | out: | 335 | out: |
336 | dput(dentry); | 336 | dput(dentry); |
337 | out_unlock: | 337 | out_unlock: |
338 | mutex_unlock(&d_inode(dir)->i_mutex); | 338 | inode_unlock(d_inode(dir)); |
339 | return status; | 339 | return status; |
340 | } | 340 | } |
341 | 341 | ||
diff --git a/fs/nfsd/nfsfh.h b/fs/nfsd/nfsfh.h index 0770bcb543c8..f84fe6bf9aee 100644 --- a/fs/nfsd/nfsfh.h +++ b/fs/nfsd/nfsfh.h | |||
@@ -288,7 +288,7 @@ fh_lock_nested(struct svc_fh *fhp, unsigned int subclass) | |||
288 | } | 288 | } |
289 | 289 | ||
290 | inode = d_inode(dentry); | 290 | inode = d_inode(dentry); |
291 | mutex_lock_nested(&inode->i_mutex, subclass); | 291 | inode_lock_nested(inode, subclass); |
292 | fill_pre_wcc(fhp); | 292 | fill_pre_wcc(fhp); |
293 | fhp->fh_locked = true; | 293 | fhp->fh_locked = true; |
294 | } | 294 | } |
@@ -307,7 +307,7 @@ fh_unlock(struct svc_fh *fhp) | |||
307 | { | 307 | { |
308 | if (fhp->fh_locked) { | 308 | if (fhp->fh_locked) { |
309 | fill_post_wcc(fhp); | 309 | fill_post_wcc(fhp); |
310 | mutex_unlock(&d_inode(fhp->fh_dentry)->i_mutex); | 310 | inode_unlock(d_inode(fhp->fh_dentry)); |
311 | fhp->fh_locked = false; | 311 | fhp->fh_locked = false; |
312 | } | 312 | } |
313 | } | 313 | } |
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c index 6739077f17fe..5d2a57e4c03a 100644 --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c | |||
@@ -493,9 +493,9 @@ __be32 nfsd4_set_nfs4_label(struct svc_rqst *rqstp, struct svc_fh *fhp, | |||
493 | 493 | ||
494 | dentry = fhp->fh_dentry; | 494 | dentry = fhp->fh_dentry; |
495 | 495 | ||
496 | mutex_lock(&d_inode(dentry)->i_mutex); | 496 | inode_lock(d_inode(dentry)); |
497 | host_error = security_inode_setsecctx(dentry, label->data, label->len); | 497 | host_error = security_inode_setsecctx(dentry, label->data, label->len); |
498 | mutex_unlock(&d_inode(dentry)->i_mutex); | 498 | inode_unlock(d_inode(dentry)); |
499 | return nfserrno(host_error); | 499 | return nfserrno(host_error); |
500 | } | 500 | } |
501 | #else | 501 | #else |
diff --git a/fs/nilfs2/inode.c b/fs/nilfs2/inode.c index 10b22527a617..21a1e2e0d92f 100644 --- a/fs/nilfs2/inode.c +++ b/fs/nilfs2/inode.c | |||
@@ -1003,7 +1003,7 @@ int nilfs_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, | |||
1003 | if (ret) | 1003 | if (ret) |
1004 | return ret; | 1004 | return ret; |
1005 | 1005 | ||
1006 | mutex_lock(&inode->i_mutex); | 1006 | inode_lock(inode); |
1007 | 1007 | ||
1008 | isize = i_size_read(inode); | 1008 | isize = i_size_read(inode); |
1009 | 1009 | ||
@@ -1113,6 +1113,6 @@ int nilfs_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, | |||
1113 | if (ret == 1) | 1113 | if (ret == 1) |
1114 | ret = 0; | 1114 | ret = 0; |
1115 | 1115 | ||
1116 | mutex_unlock(&inode->i_mutex); | 1116 | inode_unlock(inode); |
1117 | return ret; | 1117 | return ret; |
1118 | } | 1118 | } |
diff --git a/fs/nilfs2/ioctl.c b/fs/nilfs2/ioctl.c index aba43811d6ef..e8fe24882b5b 100644 --- a/fs/nilfs2/ioctl.c +++ b/fs/nilfs2/ioctl.c | |||
@@ -158,7 +158,7 @@ static int nilfs_ioctl_setflags(struct inode *inode, struct file *filp, | |||
158 | 158 | ||
159 | flags = nilfs_mask_flags(inode->i_mode, flags); | 159 | flags = nilfs_mask_flags(inode->i_mode, flags); |
160 | 160 | ||
161 | mutex_lock(&inode->i_mutex); | 161 | inode_lock(inode); |
162 | 162 | ||
163 | oldflags = NILFS_I(inode)->i_flags; | 163 | oldflags = NILFS_I(inode)->i_flags; |
164 | 164 | ||
@@ -186,7 +186,7 @@ static int nilfs_ioctl_setflags(struct inode *inode, struct file *filp, | |||
186 | nilfs_mark_inode_dirty(inode); | 186 | nilfs_mark_inode_dirty(inode); |
187 | ret = nilfs_transaction_commit(inode->i_sb); | 187 | ret = nilfs_transaction_commit(inode->i_sb); |
188 | out: | 188 | out: |
189 | mutex_unlock(&inode->i_mutex); | 189 | inode_unlock(inode); |
190 | mnt_drop_write_file(filp); | 190 | mnt_drop_write_file(filp); |
191 | return ret; | 191 | return ret; |
192 | } | 192 | } |
diff --git a/fs/ntfs/dir.c b/fs/ntfs/dir.c index 9e38dafa3bc7..b2eff5816adc 100644 --- a/fs/ntfs/dir.c +++ b/fs/ntfs/dir.c | |||
@@ -1509,7 +1509,7 @@ static int ntfs_dir_fsync(struct file *filp, loff_t start, loff_t end, | |||
1509 | err = filemap_write_and_wait_range(vi->i_mapping, start, end); | 1509 | err = filemap_write_and_wait_range(vi->i_mapping, start, end); |
1510 | if (err) | 1510 | if (err) |
1511 | return err; | 1511 | return err; |
1512 | mutex_lock(&vi->i_mutex); | 1512 | inode_lock(vi); |
1513 | 1513 | ||
1514 | BUG_ON(!S_ISDIR(vi->i_mode)); | 1514 | BUG_ON(!S_ISDIR(vi->i_mode)); |
1515 | /* If the bitmap attribute inode is in memory sync it, too. */ | 1515 | /* If the bitmap attribute inode is in memory sync it, too. */ |
@@ -1532,7 +1532,7 @@ static int ntfs_dir_fsync(struct file *filp, loff_t start, loff_t end, | |||
1532 | else | 1532 | else |
1533 | ntfs_warning(vi->i_sb, "Failed to f%ssync inode 0x%lx. Error " | 1533 | ntfs_warning(vi->i_sb, "Failed to f%ssync inode 0x%lx. Error " |
1534 | "%u.", datasync ? "data" : "", vi->i_ino, -ret); | 1534 | "%u.", datasync ? "data" : "", vi->i_ino, -ret); |
1535 | mutex_unlock(&vi->i_mutex); | 1535 | inode_unlock(vi); |
1536 | return ret; | 1536 | return ret; |
1537 | } | 1537 | } |
1538 | 1538 | ||
diff --git a/fs/ntfs/file.c b/fs/ntfs/file.c index 9d383e5eff0e..bed4d427dfae 100644 --- a/fs/ntfs/file.c +++ b/fs/ntfs/file.c | |||
@@ -1944,14 +1944,14 @@ static ssize_t ntfs_file_write_iter(struct kiocb *iocb, struct iov_iter *from) | |||
1944 | ssize_t written = 0; | 1944 | ssize_t written = 0; |
1945 | ssize_t err; | 1945 | ssize_t err; |
1946 | 1946 | ||
1947 | mutex_lock(&vi->i_mutex); | 1947 | inode_lock(vi); |
1948 | /* We can write back this queue in page reclaim. */ | 1948 | /* We can write back this queue in page reclaim. */ |
1949 | current->backing_dev_info = inode_to_bdi(vi); | 1949 | current->backing_dev_info = inode_to_bdi(vi); |
1950 | err = ntfs_prepare_file_for_write(iocb, from); | 1950 | err = ntfs_prepare_file_for_write(iocb, from); |
1951 | if (iov_iter_count(from) && !err) | 1951 | if (iov_iter_count(from) && !err) |
1952 | written = ntfs_perform_write(file, from, iocb->ki_pos); | 1952 | written = ntfs_perform_write(file, from, iocb->ki_pos); |
1953 | current->backing_dev_info = NULL; | 1953 | current->backing_dev_info = NULL; |
1954 | mutex_unlock(&vi->i_mutex); | 1954 | inode_unlock(vi); |
1955 | if (likely(written > 0)) { | 1955 | if (likely(written > 0)) { |
1956 | err = generic_write_sync(file, iocb->ki_pos, written); | 1956 | err = generic_write_sync(file, iocb->ki_pos, written); |
1957 | if (err < 0) | 1957 | if (err < 0) |
@@ -1996,7 +1996,7 @@ static int ntfs_file_fsync(struct file *filp, loff_t start, loff_t end, | |||
1996 | err = filemap_write_and_wait_range(vi->i_mapping, start, end); | 1996 | err = filemap_write_and_wait_range(vi->i_mapping, start, end); |
1997 | if (err) | 1997 | if (err) |
1998 | return err; | 1998 | return err; |
1999 | mutex_lock(&vi->i_mutex); | 1999 | inode_lock(vi); |
2000 | 2000 | ||
2001 | BUG_ON(S_ISDIR(vi->i_mode)); | 2001 | BUG_ON(S_ISDIR(vi->i_mode)); |
2002 | if (!datasync || !NInoNonResident(NTFS_I(vi))) | 2002 | if (!datasync || !NInoNonResident(NTFS_I(vi))) |
@@ -2015,7 +2015,7 @@ static int ntfs_file_fsync(struct file *filp, loff_t start, loff_t end, | |||
2015 | else | 2015 | else |
2016 | ntfs_warning(vi->i_sb, "Failed to f%ssync inode 0x%lx. Error " | 2016 | ntfs_warning(vi->i_sb, "Failed to f%ssync inode 0x%lx. Error " |
2017 | "%u.", datasync ? "data" : "", vi->i_ino, -ret); | 2017 | "%u.", datasync ? "data" : "", vi->i_ino, -ret); |
2018 | mutex_unlock(&vi->i_mutex); | 2018 | inode_unlock(vi); |
2019 | return ret; | 2019 | return ret; |
2020 | } | 2020 | } |
2021 | 2021 | ||
diff --git a/fs/ntfs/quota.c b/fs/ntfs/quota.c index d80e3315cab0..9793e68ba1dd 100644 --- a/fs/ntfs/quota.c +++ b/fs/ntfs/quota.c | |||
@@ -48,7 +48,7 @@ bool ntfs_mark_quotas_out_of_date(ntfs_volume *vol) | |||
48 | ntfs_error(vol->sb, "Quota inodes are not open."); | 48 | ntfs_error(vol->sb, "Quota inodes are not open."); |
49 | return false; | 49 | return false; |
50 | } | 50 | } |
51 | mutex_lock(&vol->quota_q_ino->i_mutex); | 51 | inode_lock(vol->quota_q_ino); |
52 | ictx = ntfs_index_ctx_get(NTFS_I(vol->quota_q_ino)); | 52 | ictx = ntfs_index_ctx_get(NTFS_I(vol->quota_q_ino)); |
53 | if (!ictx) { | 53 | if (!ictx) { |
54 | ntfs_error(vol->sb, "Failed to get index context."); | 54 | ntfs_error(vol->sb, "Failed to get index context."); |
@@ -98,7 +98,7 @@ bool ntfs_mark_quotas_out_of_date(ntfs_volume *vol) | |||
98 | ntfs_index_entry_mark_dirty(ictx); | 98 | ntfs_index_entry_mark_dirty(ictx); |
99 | set_done: | 99 | set_done: |
100 | ntfs_index_ctx_put(ictx); | 100 | ntfs_index_ctx_put(ictx); |
101 | mutex_unlock(&vol->quota_q_ino->i_mutex); | 101 | inode_unlock(vol->quota_q_ino); |
102 | /* | 102 | /* |
103 | * We set the flag so we do not try to mark the quotas out of date | 103 | * We set the flag so we do not try to mark the quotas out of date |
104 | * again on remount. | 104 | * again on remount. |
@@ -110,7 +110,7 @@ done: | |||
110 | err_out: | 110 | err_out: |
111 | if (ictx) | 111 | if (ictx) |
112 | ntfs_index_ctx_put(ictx); | 112 | ntfs_index_ctx_put(ictx); |
113 | mutex_unlock(&vol->quota_q_ino->i_mutex); | 113 | inode_unlock(vol->quota_q_ino); |
114 | return false; | 114 | return false; |
115 | } | 115 | } |
116 | 116 | ||
diff --git a/fs/ntfs/super.c b/fs/ntfs/super.c index 2f77f8dfb861..1b38abdaa3ed 100644 --- a/fs/ntfs/super.c +++ b/fs/ntfs/super.c | |||
@@ -1284,10 +1284,10 @@ static int check_windows_hibernation_status(ntfs_volume *vol) | |||
1284 | * Find the inode number for the hibernation file by looking up the | 1284 | * Find the inode number for the hibernation file by looking up the |
1285 | * filename hiberfil.sys in the root directory. | 1285 | * filename hiberfil.sys in the root directory. |
1286 | */ | 1286 | */ |
1287 | mutex_lock(&vol->root_ino->i_mutex); | 1287 | inode_lock(vol->root_ino); |
1288 | mref = ntfs_lookup_inode_by_name(NTFS_I(vol->root_ino), hiberfil, 12, | 1288 | mref = ntfs_lookup_inode_by_name(NTFS_I(vol->root_ino), hiberfil, 12, |
1289 | &name); | 1289 | &name); |
1290 | mutex_unlock(&vol->root_ino->i_mutex); | 1290 | inode_unlock(vol->root_ino); |
1291 | if (IS_ERR_MREF(mref)) { | 1291 | if (IS_ERR_MREF(mref)) { |
1292 | ret = MREF_ERR(mref); | 1292 | ret = MREF_ERR(mref); |
1293 | /* If the file does not exist, Windows is not hibernated. */ | 1293 | /* If the file does not exist, Windows is not hibernated. */ |
@@ -1377,10 +1377,10 @@ static bool load_and_init_quota(ntfs_volume *vol) | |||
1377 | * Find the inode number for the quota file by looking up the filename | 1377 | * Find the inode number for the quota file by looking up the filename |
1378 | * $Quota in the extended system files directory $Extend. | 1378 | * $Quota in the extended system files directory $Extend. |
1379 | */ | 1379 | */ |
1380 | mutex_lock(&vol->extend_ino->i_mutex); | 1380 | inode_lock(vol->extend_ino); |
1381 | mref = ntfs_lookup_inode_by_name(NTFS_I(vol->extend_ino), Quota, 6, | 1381 | mref = ntfs_lookup_inode_by_name(NTFS_I(vol->extend_ino), Quota, 6, |
1382 | &name); | 1382 | &name); |
1383 | mutex_unlock(&vol->extend_ino->i_mutex); | 1383 | inode_unlock(vol->extend_ino); |
1384 | if (IS_ERR_MREF(mref)) { | 1384 | if (IS_ERR_MREF(mref)) { |
1385 | /* | 1385 | /* |
1386 | * If the file does not exist, quotas are disabled and have | 1386 | * If the file does not exist, quotas are disabled and have |
@@ -1460,10 +1460,10 @@ static bool load_and_init_usnjrnl(ntfs_volume *vol) | |||
1460 | * Find the inode number for the transaction log file by looking up the | 1460 | * Find the inode number for the transaction log file by looking up the |
1461 | * filename $UsnJrnl in the extended system files directory $Extend. | 1461 | * filename $UsnJrnl in the extended system files directory $Extend. |
1462 | */ | 1462 | */ |
1463 | mutex_lock(&vol->extend_ino->i_mutex); | 1463 | inode_lock(vol->extend_ino); |
1464 | mref = ntfs_lookup_inode_by_name(NTFS_I(vol->extend_ino), UsnJrnl, 8, | 1464 | mref = ntfs_lookup_inode_by_name(NTFS_I(vol->extend_ino), UsnJrnl, 8, |
1465 | &name); | 1465 | &name); |
1466 | mutex_unlock(&vol->extend_ino->i_mutex); | 1466 | inode_unlock(vol->extend_ino); |
1467 | if (IS_ERR_MREF(mref)) { | 1467 | if (IS_ERR_MREF(mref)) { |
1468 | /* | 1468 | /* |
1469 | * If the file does not exist, transaction logging is disabled, | 1469 | * If the file does not exist, transaction logging is disabled, |
diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c index a3ded88718c9..d002579c6f2b 100644 --- a/fs/ocfs2/alloc.c +++ b/fs/ocfs2/alloc.c | |||
@@ -5719,7 +5719,7 @@ int ocfs2_remove_btree_range(struct inode *inode, | |||
5719 | goto bail; | 5719 | goto bail; |
5720 | } | 5720 | } |
5721 | 5721 | ||
5722 | mutex_lock(&tl_inode->i_mutex); | 5722 | inode_lock(tl_inode); |
5723 | 5723 | ||
5724 | if (ocfs2_truncate_log_needs_flush(osb)) { | 5724 | if (ocfs2_truncate_log_needs_flush(osb)) { |
5725 | ret = __ocfs2_flush_truncate_log(osb); | 5725 | ret = __ocfs2_flush_truncate_log(osb); |
@@ -5776,7 +5776,7 @@ int ocfs2_remove_btree_range(struct inode *inode, | |||
5776 | out_commit: | 5776 | out_commit: |
5777 | ocfs2_commit_trans(osb, handle); | 5777 | ocfs2_commit_trans(osb, handle); |
5778 | out: | 5778 | out: |
5779 | mutex_unlock(&tl_inode->i_mutex); | 5779 | inode_unlock(tl_inode); |
5780 | bail: | 5780 | bail: |
5781 | if (meta_ac) | 5781 | if (meta_ac) |
5782 | ocfs2_free_alloc_context(meta_ac); | 5782 | ocfs2_free_alloc_context(meta_ac); |
@@ -5832,7 +5832,7 @@ int ocfs2_truncate_log_append(struct ocfs2_super *osb, | |||
5832 | struct ocfs2_dinode *di; | 5832 | struct ocfs2_dinode *di; |
5833 | struct ocfs2_truncate_log *tl; | 5833 | struct ocfs2_truncate_log *tl; |
5834 | 5834 | ||
5835 | BUG_ON(mutex_trylock(&tl_inode->i_mutex)); | 5835 | BUG_ON(inode_trylock(tl_inode)); |
5836 | 5836 | ||
5837 | start_cluster = ocfs2_blocks_to_clusters(osb->sb, start_blk); | 5837 | start_cluster = ocfs2_blocks_to_clusters(osb->sb, start_blk); |
5838 | 5838 | ||
@@ -5980,7 +5980,7 @@ int __ocfs2_flush_truncate_log(struct ocfs2_super *osb) | |||
5980 | struct ocfs2_dinode *di; | 5980 | struct ocfs2_dinode *di; |
5981 | struct ocfs2_truncate_log *tl; | 5981 | struct ocfs2_truncate_log *tl; |
5982 | 5982 | ||
5983 | BUG_ON(mutex_trylock(&tl_inode->i_mutex)); | 5983 | BUG_ON(inode_trylock(tl_inode)); |
5984 | 5984 | ||
5985 | di = (struct ocfs2_dinode *) tl_bh->b_data; | 5985 | di = (struct ocfs2_dinode *) tl_bh->b_data; |
5986 | 5986 | ||
@@ -6008,7 +6008,7 @@ int __ocfs2_flush_truncate_log(struct ocfs2_super *osb) | |||
6008 | goto out; | 6008 | goto out; |
6009 | } | 6009 | } |
6010 | 6010 | ||
6011 | mutex_lock(&data_alloc_inode->i_mutex); | 6011 | inode_lock(data_alloc_inode); |
6012 | 6012 | ||
6013 | status = ocfs2_inode_lock(data_alloc_inode, &data_alloc_bh, 1); | 6013 | status = ocfs2_inode_lock(data_alloc_inode, &data_alloc_bh, 1); |
6014 | if (status < 0) { | 6014 | if (status < 0) { |
@@ -6035,7 +6035,7 @@ out_unlock: | |||
6035 | ocfs2_inode_unlock(data_alloc_inode, 1); | 6035 | ocfs2_inode_unlock(data_alloc_inode, 1); |
6036 | 6036 | ||
6037 | out_mutex: | 6037 | out_mutex: |
6038 | mutex_unlock(&data_alloc_inode->i_mutex); | 6038 | inode_unlock(data_alloc_inode); |
6039 | iput(data_alloc_inode); | 6039 | iput(data_alloc_inode); |
6040 | 6040 | ||
6041 | out: | 6041 | out: |
@@ -6047,9 +6047,9 @@ int ocfs2_flush_truncate_log(struct ocfs2_super *osb) | |||
6047 | int status; | 6047 | int status; |
6048 | struct inode *tl_inode = osb->osb_tl_inode; | 6048 | struct inode *tl_inode = osb->osb_tl_inode; |
6049 | 6049 | ||
6050 | mutex_lock(&tl_inode->i_mutex); | 6050 | inode_lock(tl_inode); |
6051 | status = __ocfs2_flush_truncate_log(osb); | 6051 | status = __ocfs2_flush_truncate_log(osb); |
6052 | mutex_unlock(&tl_inode->i_mutex); | 6052 | inode_unlock(tl_inode); |
6053 | 6053 | ||
6054 | return status; | 6054 | return status; |
6055 | } | 6055 | } |
@@ -6208,7 +6208,7 @@ int ocfs2_complete_truncate_log_recovery(struct ocfs2_super *osb, | |||
6208 | (unsigned long long)le64_to_cpu(tl_copy->i_blkno), | 6208 | (unsigned long long)le64_to_cpu(tl_copy->i_blkno), |
6209 | num_recs); | 6209 | num_recs); |
6210 | 6210 | ||
6211 | mutex_lock(&tl_inode->i_mutex); | 6211 | inode_lock(tl_inode); |
6212 | for(i = 0; i < num_recs; i++) { | 6212 | for(i = 0; i < num_recs; i++) { |
6213 | if (ocfs2_truncate_log_needs_flush(osb)) { | 6213 | if (ocfs2_truncate_log_needs_flush(osb)) { |
6214 | status = __ocfs2_flush_truncate_log(osb); | 6214 | status = __ocfs2_flush_truncate_log(osb); |
@@ -6239,7 +6239,7 @@ int ocfs2_complete_truncate_log_recovery(struct ocfs2_super *osb, | |||
6239 | } | 6239 | } |
6240 | 6240 | ||
6241 | bail_up: | 6241 | bail_up: |
6242 | mutex_unlock(&tl_inode->i_mutex); | 6242 | inode_unlock(tl_inode); |
6243 | 6243 | ||
6244 | return status; | 6244 | return status; |
6245 | } | 6245 | } |
@@ -6346,7 +6346,7 @@ static int ocfs2_free_cached_blocks(struct ocfs2_super *osb, | |||
6346 | goto out; | 6346 | goto out; |
6347 | } | 6347 | } |
6348 | 6348 | ||
6349 | mutex_lock(&inode->i_mutex); | 6349 | inode_lock(inode); |
6350 | 6350 | ||
6351 | ret = ocfs2_inode_lock(inode, &di_bh, 1); | 6351 | ret = ocfs2_inode_lock(inode, &di_bh, 1); |
6352 | if (ret) { | 6352 | if (ret) { |
@@ -6395,7 +6395,7 @@ out_unlock: | |||
6395 | ocfs2_inode_unlock(inode, 1); | 6395 | ocfs2_inode_unlock(inode, 1); |
6396 | brelse(di_bh); | 6396 | brelse(di_bh); |
6397 | out_mutex: | 6397 | out_mutex: |
6398 | mutex_unlock(&inode->i_mutex); | 6398 | inode_unlock(inode); |
6399 | iput(inode); | 6399 | iput(inode); |
6400 | out: | 6400 | out: |
6401 | while(head) { | 6401 | while(head) { |
@@ -6439,7 +6439,7 @@ static int ocfs2_free_cached_clusters(struct ocfs2_super *osb, | |||
6439 | handle_t *handle; | 6439 | handle_t *handle; |
6440 | int ret = 0; | 6440 | int ret = 0; |
6441 | 6441 | ||
6442 | mutex_lock(&tl_inode->i_mutex); | 6442 | inode_lock(tl_inode); |
6443 | 6443 | ||
6444 | while (head) { | 6444 | while (head) { |
6445 | if (ocfs2_truncate_log_needs_flush(osb)) { | 6445 | if (ocfs2_truncate_log_needs_flush(osb)) { |
@@ -6471,7 +6471,7 @@ static int ocfs2_free_cached_clusters(struct ocfs2_super *osb, | |||
6471 | } | 6471 | } |
6472 | } | 6472 | } |
6473 | 6473 | ||
6474 | mutex_unlock(&tl_inode->i_mutex); | 6474 | inode_unlock(tl_inode); |
6475 | 6475 | ||
6476 | while (head) { | 6476 | while (head) { |
6477 | /* Premature exit may have left some dangling items. */ | 6477 | /* Premature exit may have left some dangling items. */ |
@@ -7355,7 +7355,7 @@ int ocfs2_trim_fs(struct super_block *sb, struct fstrim_range *range) | |||
7355 | goto out; | 7355 | goto out; |
7356 | } | 7356 | } |
7357 | 7357 | ||
7358 | mutex_lock(&main_bm_inode->i_mutex); | 7358 | inode_lock(main_bm_inode); |
7359 | 7359 | ||
7360 | ret = ocfs2_inode_lock(main_bm_inode, &main_bm_bh, 0); | 7360 | ret = ocfs2_inode_lock(main_bm_inode, &main_bm_bh, 0); |
7361 | if (ret < 0) { | 7361 | if (ret < 0) { |
@@ -7422,7 +7422,7 @@ out_unlock: | |||
7422 | ocfs2_inode_unlock(main_bm_inode, 0); | 7422 | ocfs2_inode_unlock(main_bm_inode, 0); |
7423 | brelse(main_bm_bh); | 7423 | brelse(main_bm_bh); |
7424 | out_mutex: | 7424 | out_mutex: |
7425 | mutex_unlock(&main_bm_inode->i_mutex); | 7425 | inode_unlock(main_bm_inode); |
7426 | iput(main_bm_inode); | 7426 | iput(main_bm_inode); |
7427 | out: | 7427 | out: |
7428 | return ret; | 7428 | return ret; |
diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c index 7f604727f487..794fd1587f34 100644 --- a/fs/ocfs2/aops.c +++ b/fs/ocfs2/aops.c | |||
@@ -2046,9 +2046,9 @@ static int ocfs2_try_to_free_truncate_log(struct ocfs2_super *osb, | |||
2046 | int ret = 0; | 2046 | int ret = 0; |
2047 | unsigned int truncated_clusters; | 2047 | unsigned int truncated_clusters; |
2048 | 2048 | ||
2049 | mutex_lock(&osb->osb_tl_inode->i_mutex); | 2049 | inode_lock(osb->osb_tl_inode); |
2050 | truncated_clusters = osb->truncated_clusters; | 2050 | truncated_clusters = osb->truncated_clusters; |
2051 | mutex_unlock(&osb->osb_tl_inode->i_mutex); | 2051 | inode_unlock(osb->osb_tl_inode); |
2052 | 2052 | ||
2053 | /* | 2053 | /* |
2054 | * Check whether we can succeed in allocating if we free | 2054 | * Check whether we can succeed in allocating if we free |
diff --git a/fs/ocfs2/dir.c b/fs/ocfs2/dir.c index ffecf89c8c1c..e1adf285fc31 100644 --- a/fs/ocfs2/dir.c +++ b/fs/ocfs2/dir.c | |||
@@ -4361,7 +4361,7 @@ static int ocfs2_dx_dir_remove_index(struct inode *dir, | |||
4361 | mlog_errno(ret); | 4361 | mlog_errno(ret); |
4362 | goto out; | 4362 | goto out; |
4363 | } | 4363 | } |
4364 | mutex_lock(&dx_alloc_inode->i_mutex); | 4364 | inode_lock(dx_alloc_inode); |
4365 | 4365 | ||
4366 | ret = ocfs2_inode_lock(dx_alloc_inode, &dx_alloc_bh, 1); | 4366 | ret = ocfs2_inode_lock(dx_alloc_inode, &dx_alloc_bh, 1); |
4367 | if (ret) { | 4367 | if (ret) { |
@@ -4410,7 +4410,7 @@ out_unlock: | |||
4410 | ocfs2_inode_unlock(dx_alloc_inode, 1); | 4410 | ocfs2_inode_unlock(dx_alloc_inode, 1); |
4411 | 4411 | ||
4412 | out_mutex: | 4412 | out_mutex: |
4413 | mutex_unlock(&dx_alloc_inode->i_mutex); | 4413 | inode_unlock(dx_alloc_inode); |
4414 | brelse(dx_alloc_bh); | 4414 | brelse(dx_alloc_bh); |
4415 | out: | 4415 | out: |
4416 | iput(dx_alloc_inode); | 4416 | iput(dx_alloc_inode); |
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c index d63127932509..7cb38fdca229 100644 --- a/fs/ocfs2/file.c +++ b/fs/ocfs2/file.c | |||
@@ -1872,7 +1872,7 @@ static int __ocfs2_change_file_space(struct file *file, struct inode *inode, | |||
1872 | if (ocfs2_is_hard_readonly(osb) || ocfs2_is_soft_readonly(osb)) | 1872 | if (ocfs2_is_hard_readonly(osb) || ocfs2_is_soft_readonly(osb)) |
1873 | return -EROFS; | 1873 | return -EROFS; |
1874 | 1874 | ||
1875 | mutex_lock(&inode->i_mutex); | 1875 | inode_lock(inode); |
1876 | 1876 | ||
1877 | /* | 1877 | /* |
1878 | * This prevents concurrent writes on other nodes | 1878 | * This prevents concurrent writes on other nodes |
@@ -1991,7 +1991,7 @@ out_rw_unlock: | |||
1991 | ocfs2_rw_unlock(inode, 1); | 1991 | ocfs2_rw_unlock(inode, 1); |
1992 | 1992 | ||
1993 | out: | 1993 | out: |
1994 | mutex_unlock(&inode->i_mutex); | 1994 | inode_unlock(inode); |
1995 | return ret; | 1995 | return ret; |
1996 | } | 1996 | } |
1997 | 1997 | ||
@@ -2299,7 +2299,7 @@ static ssize_t ocfs2_file_write_iter(struct kiocb *iocb, | |||
2299 | appending = iocb->ki_flags & IOCB_APPEND ? 1 : 0; | 2299 | appending = iocb->ki_flags & IOCB_APPEND ? 1 : 0; |
2300 | direct_io = iocb->ki_flags & IOCB_DIRECT ? 1 : 0; | 2300 | direct_io = iocb->ki_flags & IOCB_DIRECT ? 1 : 0; |
2301 | 2301 | ||
2302 | mutex_lock(&inode->i_mutex); | 2302 | inode_lock(inode); |
2303 | 2303 | ||
2304 | relock: | 2304 | relock: |
2305 | /* | 2305 | /* |
@@ -2435,7 +2435,7 @@ out: | |||
2435 | ocfs2_rw_unlock(inode, rw_level); | 2435 | ocfs2_rw_unlock(inode, rw_level); |
2436 | 2436 | ||
2437 | out_mutex: | 2437 | out_mutex: |
2438 | mutex_unlock(&inode->i_mutex); | 2438 | inode_unlock(inode); |
2439 | 2439 | ||
2440 | if (written) | 2440 | if (written) |
2441 | ret = written; | 2441 | ret = written; |
@@ -2547,7 +2547,7 @@ static loff_t ocfs2_file_llseek(struct file *file, loff_t offset, int whence) | |||
2547 | struct inode *inode = file->f_mapping->host; | 2547 | struct inode *inode = file->f_mapping->host; |
2548 | int ret = 0; | 2548 | int ret = 0; |
2549 | 2549 | ||
2550 | mutex_lock(&inode->i_mutex); | 2550 | inode_lock(inode); |
2551 | 2551 | ||
2552 | switch (whence) { | 2552 | switch (whence) { |
2553 | case SEEK_SET: | 2553 | case SEEK_SET: |
@@ -2585,7 +2585,7 @@ static loff_t ocfs2_file_llseek(struct file *file, loff_t offset, int whence) | |||
2585 | offset = vfs_setpos(file, offset, inode->i_sb->s_maxbytes); | 2585 | offset = vfs_setpos(file, offset, inode->i_sb->s_maxbytes); |
2586 | 2586 | ||
2587 | out: | 2587 | out: |
2588 | mutex_unlock(&inode->i_mutex); | 2588 | inode_unlock(inode); |
2589 | if (ret) | 2589 | if (ret) |
2590 | return ret; | 2590 | return ret; |
2591 | return offset; | 2591 | return offset; |
diff --git a/fs/ocfs2/inode.c b/fs/ocfs2/inode.c index 97a563bab9a8..36294446d960 100644 --- a/fs/ocfs2/inode.c +++ b/fs/ocfs2/inode.c | |||
@@ -630,10 +630,10 @@ static int ocfs2_remove_inode(struct inode *inode, | |||
630 | goto bail; | 630 | goto bail; |
631 | } | 631 | } |
632 | 632 | ||
633 | mutex_lock(&inode_alloc_inode->i_mutex); | 633 | inode_lock(inode_alloc_inode); |
634 | status = ocfs2_inode_lock(inode_alloc_inode, &inode_alloc_bh, 1); | 634 | status = ocfs2_inode_lock(inode_alloc_inode, &inode_alloc_bh, 1); |
635 | if (status < 0) { | 635 | if (status < 0) { |
636 | mutex_unlock(&inode_alloc_inode->i_mutex); | 636 | inode_unlock(inode_alloc_inode); |
637 | 637 | ||
638 | mlog_errno(status); | 638 | mlog_errno(status); |
639 | goto bail; | 639 | goto bail; |
@@ -680,7 +680,7 @@ bail_commit: | |||
680 | ocfs2_commit_trans(osb, handle); | 680 | ocfs2_commit_trans(osb, handle); |
681 | bail_unlock: | 681 | bail_unlock: |
682 | ocfs2_inode_unlock(inode_alloc_inode, 1); | 682 | ocfs2_inode_unlock(inode_alloc_inode, 1); |
683 | mutex_unlock(&inode_alloc_inode->i_mutex); | 683 | inode_unlock(inode_alloc_inode); |
684 | brelse(inode_alloc_bh); | 684 | brelse(inode_alloc_bh); |
685 | bail: | 685 | bail: |
686 | iput(inode_alloc_inode); | 686 | iput(inode_alloc_inode); |
@@ -751,10 +751,10 @@ static int ocfs2_wipe_inode(struct inode *inode, | |||
751 | /* Lock the orphan dir. The lock will be held for the entire | 751 | /* Lock the orphan dir. The lock will be held for the entire |
752 | * delete_inode operation. We do this now to avoid races with | 752 | * delete_inode operation. We do this now to avoid races with |
753 | * recovery completion on other nodes. */ | 753 | * recovery completion on other nodes. */ |
754 | mutex_lock(&orphan_dir_inode->i_mutex); | 754 | inode_lock(orphan_dir_inode); |
755 | status = ocfs2_inode_lock(orphan_dir_inode, &orphan_dir_bh, 1); | 755 | status = ocfs2_inode_lock(orphan_dir_inode, &orphan_dir_bh, 1); |
756 | if (status < 0) { | 756 | if (status < 0) { |
757 | mutex_unlock(&orphan_dir_inode->i_mutex); | 757 | inode_unlock(orphan_dir_inode); |
758 | 758 | ||
759 | mlog_errno(status); | 759 | mlog_errno(status); |
760 | goto bail; | 760 | goto bail; |
@@ -803,7 +803,7 @@ bail_unlock_dir: | |||
803 | return status; | 803 | return status; |
804 | 804 | ||
805 | ocfs2_inode_unlock(orphan_dir_inode, 1); | 805 | ocfs2_inode_unlock(orphan_dir_inode, 1); |
806 | mutex_unlock(&orphan_dir_inode->i_mutex); | 806 | inode_unlock(orphan_dir_inode); |
807 | brelse(orphan_dir_bh); | 807 | brelse(orphan_dir_bh); |
808 | bail: | 808 | bail: |
809 | iput(orphan_dir_inode); | 809 | iput(orphan_dir_inode); |
diff --git a/fs/ocfs2/ioctl.c b/fs/ocfs2/ioctl.c index 16b0bb482ea7..4506ec5ec2ea 100644 --- a/fs/ocfs2/ioctl.c +++ b/fs/ocfs2/ioctl.c | |||
@@ -86,7 +86,7 @@ static int ocfs2_set_inode_attr(struct inode *inode, unsigned flags, | |||
86 | unsigned oldflags; | 86 | unsigned oldflags; |
87 | int status; | 87 | int status; |
88 | 88 | ||
89 | mutex_lock(&inode->i_mutex); | 89 | inode_lock(inode); |
90 | 90 | ||
91 | status = ocfs2_inode_lock(inode, &bh, 1); | 91 | status = ocfs2_inode_lock(inode, &bh, 1); |
92 | if (status < 0) { | 92 | if (status < 0) { |
@@ -135,7 +135,7 @@ static int ocfs2_set_inode_attr(struct inode *inode, unsigned flags, | |||
135 | bail_unlock: | 135 | bail_unlock: |
136 | ocfs2_inode_unlock(inode, 1); | 136 | ocfs2_inode_unlock(inode, 1); |
137 | bail: | 137 | bail: |
138 | mutex_unlock(&inode->i_mutex); | 138 | inode_unlock(inode); |
139 | 139 | ||
140 | brelse(bh); | 140 | brelse(bh); |
141 | 141 | ||
@@ -287,7 +287,7 @@ static int ocfs2_info_scan_inode_alloc(struct ocfs2_super *osb, | |||
287 | struct ocfs2_dinode *dinode_alloc = NULL; | 287 | struct ocfs2_dinode *dinode_alloc = NULL; |
288 | 288 | ||
289 | if (inode_alloc) | 289 | if (inode_alloc) |
290 | mutex_lock(&inode_alloc->i_mutex); | 290 | inode_lock(inode_alloc); |
291 | 291 | ||
292 | if (o2info_coherent(&fi->ifi_req)) { | 292 | if (o2info_coherent(&fi->ifi_req)) { |
293 | status = ocfs2_inode_lock(inode_alloc, &bh, 0); | 293 | status = ocfs2_inode_lock(inode_alloc, &bh, 0); |
@@ -317,7 +317,7 @@ bail: | |||
317 | ocfs2_inode_unlock(inode_alloc, 0); | 317 | ocfs2_inode_unlock(inode_alloc, 0); |
318 | 318 | ||
319 | if (inode_alloc) | 319 | if (inode_alloc) |
320 | mutex_unlock(&inode_alloc->i_mutex); | 320 | inode_unlock(inode_alloc); |
321 | 321 | ||
322 | brelse(bh); | 322 | brelse(bh); |
323 | 323 | ||
@@ -547,7 +547,7 @@ static int ocfs2_info_freefrag_scan_bitmap(struct ocfs2_super *osb, | |||
547 | struct ocfs2_dinode *gb_dinode = NULL; | 547 | struct ocfs2_dinode *gb_dinode = NULL; |
548 | 548 | ||
549 | if (gb_inode) | 549 | if (gb_inode) |
550 | mutex_lock(&gb_inode->i_mutex); | 550 | inode_lock(gb_inode); |
551 | 551 | ||
552 | if (o2info_coherent(&ffg->iff_req)) { | 552 | if (o2info_coherent(&ffg->iff_req)) { |
553 | status = ocfs2_inode_lock(gb_inode, &bh, 0); | 553 | status = ocfs2_inode_lock(gb_inode, &bh, 0); |
@@ -604,7 +604,7 @@ bail: | |||
604 | ocfs2_inode_unlock(gb_inode, 0); | 604 | ocfs2_inode_unlock(gb_inode, 0); |
605 | 605 | ||
606 | if (gb_inode) | 606 | if (gb_inode) |
607 | mutex_unlock(&gb_inode->i_mutex); | 607 | inode_unlock(gb_inode); |
608 | 608 | ||
609 | iput(gb_inode); | 609 | iput(gb_inode); |
610 | brelse(bh); | 610 | brelse(bh); |
diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c index 3772a2dbb980..61b833b721d8 100644 --- a/fs/ocfs2/journal.c +++ b/fs/ocfs2/journal.c | |||
@@ -2088,7 +2088,7 @@ static int ocfs2_queue_orphans(struct ocfs2_super *osb, | |||
2088 | return status; | 2088 | return status; |
2089 | } | 2089 | } |
2090 | 2090 | ||
2091 | mutex_lock(&orphan_dir_inode->i_mutex); | 2091 | inode_lock(orphan_dir_inode); |
2092 | status = ocfs2_inode_lock(orphan_dir_inode, NULL, 0); | 2092 | status = ocfs2_inode_lock(orphan_dir_inode, NULL, 0); |
2093 | if (status < 0) { | 2093 | if (status < 0) { |
2094 | mlog_errno(status); | 2094 | mlog_errno(status); |
@@ -2106,7 +2106,7 @@ static int ocfs2_queue_orphans(struct ocfs2_super *osb, | |||
2106 | out_cluster: | 2106 | out_cluster: |
2107 | ocfs2_inode_unlock(orphan_dir_inode, 0); | 2107 | ocfs2_inode_unlock(orphan_dir_inode, 0); |
2108 | out: | 2108 | out: |
2109 | mutex_unlock(&orphan_dir_inode->i_mutex); | 2109 | inode_unlock(orphan_dir_inode); |
2110 | iput(orphan_dir_inode); | 2110 | iput(orphan_dir_inode); |
2111 | return status; | 2111 | return status; |
2112 | } | 2112 | } |
@@ -2196,7 +2196,7 @@ static int ocfs2_recover_orphans(struct ocfs2_super *osb, | |||
2196 | oi->ip_next_orphan = NULL; | 2196 | oi->ip_next_orphan = NULL; |
2197 | 2197 | ||
2198 | if (oi->ip_flags & OCFS2_INODE_DIO_ORPHAN_ENTRY) { | 2198 | if (oi->ip_flags & OCFS2_INODE_DIO_ORPHAN_ENTRY) { |
2199 | mutex_lock(&inode->i_mutex); | 2199 | inode_lock(inode); |
2200 | ret = ocfs2_rw_lock(inode, 1); | 2200 | ret = ocfs2_rw_lock(inode, 1); |
2201 | if (ret < 0) { | 2201 | if (ret < 0) { |
2202 | mlog_errno(ret); | 2202 | mlog_errno(ret); |
@@ -2235,7 +2235,7 @@ unlock_inode: | |||
2235 | unlock_rw: | 2235 | unlock_rw: |
2236 | ocfs2_rw_unlock(inode, 1); | 2236 | ocfs2_rw_unlock(inode, 1); |
2237 | unlock_mutex: | 2237 | unlock_mutex: |
2238 | mutex_unlock(&inode->i_mutex); | 2238 | inode_unlock(inode); |
2239 | 2239 | ||
2240 | /* clear dio flag in ocfs2_inode_info */ | 2240 | /* clear dio flag in ocfs2_inode_info */ |
2241 | oi->ip_flags &= ~OCFS2_INODE_DIO_ORPHAN_ENTRY; | 2241 | oi->ip_flags &= ~OCFS2_INODE_DIO_ORPHAN_ENTRY; |
diff --git a/fs/ocfs2/localalloc.c b/fs/ocfs2/localalloc.c index e9c99e35f5ea..7d62c43a2c3e 100644 --- a/fs/ocfs2/localalloc.c +++ b/fs/ocfs2/localalloc.c | |||
@@ -414,7 +414,7 @@ void ocfs2_shutdown_local_alloc(struct ocfs2_super *osb) | |||
414 | goto out; | 414 | goto out; |
415 | } | 415 | } |
416 | 416 | ||
417 | mutex_lock(&main_bm_inode->i_mutex); | 417 | inode_lock(main_bm_inode); |
418 | 418 | ||
419 | status = ocfs2_inode_lock(main_bm_inode, &main_bm_bh, 1); | 419 | status = ocfs2_inode_lock(main_bm_inode, &main_bm_bh, 1); |
420 | if (status < 0) { | 420 | if (status < 0) { |
@@ -468,7 +468,7 @@ out_unlock: | |||
468 | ocfs2_inode_unlock(main_bm_inode, 1); | 468 | ocfs2_inode_unlock(main_bm_inode, 1); |
469 | 469 | ||
470 | out_mutex: | 470 | out_mutex: |
471 | mutex_unlock(&main_bm_inode->i_mutex); | 471 | inode_unlock(main_bm_inode); |
472 | iput(main_bm_inode); | 472 | iput(main_bm_inode); |
473 | 473 | ||
474 | out: | 474 | out: |
@@ -506,7 +506,7 @@ int ocfs2_begin_local_alloc_recovery(struct ocfs2_super *osb, | |||
506 | goto bail; | 506 | goto bail; |
507 | } | 507 | } |
508 | 508 | ||
509 | mutex_lock(&inode->i_mutex); | 509 | inode_lock(inode); |
510 | 510 | ||
511 | status = ocfs2_read_inode_block_full(inode, &alloc_bh, | 511 | status = ocfs2_read_inode_block_full(inode, &alloc_bh, |
512 | OCFS2_BH_IGNORE_CACHE); | 512 | OCFS2_BH_IGNORE_CACHE); |
@@ -539,7 +539,7 @@ bail: | |||
539 | brelse(alloc_bh); | 539 | brelse(alloc_bh); |
540 | 540 | ||
541 | if (inode) { | 541 | if (inode) { |
542 | mutex_unlock(&inode->i_mutex); | 542 | inode_unlock(inode); |
543 | iput(inode); | 543 | iput(inode); |
544 | } | 544 | } |
545 | 545 | ||
@@ -571,7 +571,7 @@ int ocfs2_complete_local_alloc_recovery(struct ocfs2_super *osb, | |||
571 | goto out; | 571 | goto out; |
572 | } | 572 | } |
573 | 573 | ||
574 | mutex_lock(&main_bm_inode->i_mutex); | 574 | inode_lock(main_bm_inode); |
575 | 575 | ||
576 | status = ocfs2_inode_lock(main_bm_inode, &main_bm_bh, 1); | 576 | status = ocfs2_inode_lock(main_bm_inode, &main_bm_bh, 1); |
577 | if (status < 0) { | 577 | if (status < 0) { |
@@ -601,7 +601,7 @@ out_unlock: | |||
601 | ocfs2_inode_unlock(main_bm_inode, 1); | 601 | ocfs2_inode_unlock(main_bm_inode, 1); |
602 | 602 | ||
603 | out_mutex: | 603 | out_mutex: |
604 | mutex_unlock(&main_bm_inode->i_mutex); | 604 | inode_unlock(main_bm_inode); |
605 | 605 | ||
606 | brelse(main_bm_bh); | 606 | brelse(main_bm_bh); |
607 | 607 | ||
@@ -643,7 +643,7 @@ int ocfs2_reserve_local_alloc_bits(struct ocfs2_super *osb, | |||
643 | goto bail; | 643 | goto bail; |
644 | } | 644 | } |
645 | 645 | ||
646 | mutex_lock(&local_alloc_inode->i_mutex); | 646 | inode_lock(local_alloc_inode); |
647 | 647 | ||
648 | /* | 648 | /* |
649 | * We must double check state and allocator bits because | 649 | * We must double check state and allocator bits because |
@@ -709,7 +709,7 @@ int ocfs2_reserve_local_alloc_bits(struct ocfs2_super *osb, | |||
709 | status = 0; | 709 | status = 0; |
710 | bail: | 710 | bail: |
711 | if (status < 0 && local_alloc_inode) { | 711 | if (status < 0 && local_alloc_inode) { |
712 | mutex_unlock(&local_alloc_inode->i_mutex); | 712 | inode_unlock(local_alloc_inode); |
713 | iput(local_alloc_inode); | 713 | iput(local_alloc_inode); |
714 | } | 714 | } |
715 | 715 | ||
diff --git a/fs/ocfs2/move_extents.c b/fs/ocfs2/move_extents.c index 124471d26a73..e3d05d9901a3 100644 --- a/fs/ocfs2/move_extents.c +++ b/fs/ocfs2/move_extents.c | |||
@@ -276,7 +276,7 @@ static int ocfs2_defrag_extent(struct ocfs2_move_extents_context *context, | |||
276 | * context->data_ac->ac_resv = &OCFS2_I(inode)->ip_la_data_resv; | 276 | * context->data_ac->ac_resv = &OCFS2_I(inode)->ip_la_data_resv; |
277 | */ | 277 | */ |
278 | 278 | ||
279 | mutex_lock(&tl_inode->i_mutex); | 279 | inode_lock(tl_inode); |
280 | 280 | ||
281 | if (ocfs2_truncate_log_needs_flush(osb)) { | 281 | if (ocfs2_truncate_log_needs_flush(osb)) { |
282 | ret = __ocfs2_flush_truncate_log(osb); | 282 | ret = __ocfs2_flush_truncate_log(osb); |
@@ -338,7 +338,7 @@ out_commit: | |||
338 | ocfs2_commit_trans(osb, handle); | 338 | ocfs2_commit_trans(osb, handle); |
339 | 339 | ||
340 | out_unlock_mutex: | 340 | out_unlock_mutex: |
341 | mutex_unlock(&tl_inode->i_mutex); | 341 | inode_unlock(tl_inode); |
342 | 342 | ||
343 | if (context->data_ac) { | 343 | if (context->data_ac) { |
344 | ocfs2_free_alloc_context(context->data_ac); | 344 | ocfs2_free_alloc_context(context->data_ac); |
@@ -632,7 +632,7 @@ static int ocfs2_move_extent(struct ocfs2_move_extents_context *context, | |||
632 | goto out; | 632 | goto out; |
633 | } | 633 | } |
634 | 634 | ||
635 | mutex_lock(&gb_inode->i_mutex); | 635 | inode_lock(gb_inode); |
636 | 636 | ||
637 | ret = ocfs2_inode_lock(gb_inode, &gb_bh, 1); | 637 | ret = ocfs2_inode_lock(gb_inode, &gb_bh, 1); |
638 | if (ret) { | 638 | if (ret) { |
@@ -640,7 +640,7 @@ static int ocfs2_move_extent(struct ocfs2_move_extents_context *context, | |||
640 | goto out_unlock_gb_mutex; | 640 | goto out_unlock_gb_mutex; |
641 | } | 641 | } |
642 | 642 | ||
643 | mutex_lock(&tl_inode->i_mutex); | 643 | inode_lock(tl_inode); |
644 | 644 | ||
645 | handle = ocfs2_start_trans(osb, credits); | 645 | handle = ocfs2_start_trans(osb, credits); |
646 | if (IS_ERR(handle)) { | 646 | if (IS_ERR(handle)) { |
@@ -708,11 +708,11 @@ out_commit: | |||
708 | brelse(gd_bh); | 708 | brelse(gd_bh); |
709 | 709 | ||
710 | out_unlock_tl_inode: | 710 | out_unlock_tl_inode: |
711 | mutex_unlock(&tl_inode->i_mutex); | 711 | inode_unlock(tl_inode); |
712 | 712 | ||
713 | ocfs2_inode_unlock(gb_inode, 1); | 713 | ocfs2_inode_unlock(gb_inode, 1); |
714 | out_unlock_gb_mutex: | 714 | out_unlock_gb_mutex: |
715 | mutex_unlock(&gb_inode->i_mutex); | 715 | inode_unlock(gb_inode); |
716 | brelse(gb_bh); | 716 | brelse(gb_bh); |
717 | iput(gb_inode); | 717 | iput(gb_inode); |
718 | 718 | ||
@@ -905,7 +905,7 @@ static int ocfs2_move_extents(struct ocfs2_move_extents_context *context) | |||
905 | if (ocfs2_is_hard_readonly(osb) || ocfs2_is_soft_readonly(osb)) | 905 | if (ocfs2_is_hard_readonly(osb) || ocfs2_is_soft_readonly(osb)) |
906 | return -EROFS; | 906 | return -EROFS; |
907 | 907 | ||
908 | mutex_lock(&inode->i_mutex); | 908 | inode_lock(inode); |
909 | 909 | ||
910 | /* | 910 | /* |
911 | * This prevents concurrent writes from other nodes | 911 | * This prevents concurrent writes from other nodes |
@@ -969,7 +969,7 @@ out_inode_unlock: | |||
969 | out_rw_unlock: | 969 | out_rw_unlock: |
970 | ocfs2_rw_unlock(inode, 1); | 970 | ocfs2_rw_unlock(inode, 1); |
971 | out: | 971 | out: |
972 | mutex_unlock(&inode->i_mutex); | 972 | inode_unlock(inode); |
973 | 973 | ||
974 | return status; | 974 | return status; |
975 | } | 975 | } |
diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c index ab42c38031b1..6b3e87189a64 100644 --- a/fs/ocfs2/namei.c +++ b/fs/ocfs2/namei.c | |||
@@ -1045,7 +1045,7 @@ leave: | |||
1045 | if (orphan_dir) { | 1045 | if (orphan_dir) { |
1046 | /* This was locked for us in ocfs2_prepare_orphan_dir() */ | 1046 | /* This was locked for us in ocfs2_prepare_orphan_dir() */ |
1047 | ocfs2_inode_unlock(orphan_dir, 1); | 1047 | ocfs2_inode_unlock(orphan_dir, 1); |
1048 | mutex_unlock(&orphan_dir->i_mutex); | 1048 | inode_unlock(orphan_dir); |
1049 | iput(orphan_dir); | 1049 | iput(orphan_dir); |
1050 | } | 1050 | } |
1051 | 1051 | ||
@@ -1664,7 +1664,7 @@ bail: | |||
1664 | if (orphan_dir) { | 1664 | if (orphan_dir) { |
1665 | /* This was locked for us in ocfs2_prepare_orphan_dir() */ | 1665 | /* This was locked for us in ocfs2_prepare_orphan_dir() */ |
1666 | ocfs2_inode_unlock(orphan_dir, 1); | 1666 | ocfs2_inode_unlock(orphan_dir, 1); |
1667 | mutex_unlock(&orphan_dir->i_mutex); | 1667 | inode_unlock(orphan_dir); |
1668 | iput(orphan_dir); | 1668 | iput(orphan_dir); |
1669 | } | 1669 | } |
1670 | 1670 | ||
@@ -2121,11 +2121,11 @@ static int ocfs2_lookup_lock_orphan_dir(struct ocfs2_super *osb, | |||
2121 | return ret; | 2121 | return ret; |
2122 | } | 2122 | } |
2123 | 2123 | ||
2124 | mutex_lock(&orphan_dir_inode->i_mutex); | 2124 | inode_lock(orphan_dir_inode); |
2125 | 2125 | ||
2126 | ret = ocfs2_inode_lock(orphan_dir_inode, &orphan_dir_bh, 1); | 2126 | ret = ocfs2_inode_lock(orphan_dir_inode, &orphan_dir_bh, 1); |
2127 | if (ret < 0) { | 2127 | if (ret < 0) { |
2128 | mutex_unlock(&orphan_dir_inode->i_mutex); | 2128 | inode_unlock(orphan_dir_inode); |
2129 | iput(orphan_dir_inode); | 2129 | iput(orphan_dir_inode); |
2130 | 2130 | ||
2131 | mlog_errno(ret); | 2131 | mlog_errno(ret); |
@@ -2226,7 +2226,7 @@ out: | |||
2226 | 2226 | ||
2227 | if (ret) { | 2227 | if (ret) { |
2228 | ocfs2_inode_unlock(orphan_dir_inode, 1); | 2228 | ocfs2_inode_unlock(orphan_dir_inode, 1); |
2229 | mutex_unlock(&orphan_dir_inode->i_mutex); | 2229 | inode_unlock(orphan_dir_inode); |
2230 | iput(orphan_dir_inode); | 2230 | iput(orphan_dir_inode); |
2231 | } | 2231 | } |
2232 | 2232 | ||
@@ -2495,7 +2495,7 @@ out: | |||
2495 | ocfs2_free_alloc_context(inode_ac); | 2495 | ocfs2_free_alloc_context(inode_ac); |
2496 | 2496 | ||
2497 | /* Unroll orphan dir locking */ | 2497 | /* Unroll orphan dir locking */ |
2498 | mutex_unlock(&orphan_dir->i_mutex); | 2498 | inode_unlock(orphan_dir); |
2499 | ocfs2_inode_unlock(orphan_dir, 1); | 2499 | ocfs2_inode_unlock(orphan_dir, 1); |
2500 | iput(orphan_dir); | 2500 | iput(orphan_dir); |
2501 | } | 2501 | } |
@@ -2602,7 +2602,7 @@ leave: | |||
2602 | if (orphan_dir) { | 2602 | if (orphan_dir) { |
2603 | /* This was locked for us in ocfs2_prepare_orphan_dir() */ | 2603 | /* This was locked for us in ocfs2_prepare_orphan_dir() */ |
2604 | ocfs2_inode_unlock(orphan_dir, 1); | 2604 | ocfs2_inode_unlock(orphan_dir, 1); |
2605 | mutex_unlock(&orphan_dir->i_mutex); | 2605 | inode_unlock(orphan_dir); |
2606 | iput(orphan_dir); | 2606 | iput(orphan_dir); |
2607 | } | 2607 | } |
2608 | 2608 | ||
@@ -2689,7 +2689,7 @@ int ocfs2_add_inode_to_orphan(struct ocfs2_super *osb, | |||
2689 | 2689 | ||
2690 | bail_unlock_orphan: | 2690 | bail_unlock_orphan: |
2691 | ocfs2_inode_unlock(orphan_dir_inode, 1); | 2691 | ocfs2_inode_unlock(orphan_dir_inode, 1); |
2692 | mutex_unlock(&orphan_dir_inode->i_mutex); | 2692 | inode_unlock(orphan_dir_inode); |
2693 | iput(orphan_dir_inode); | 2693 | iput(orphan_dir_inode); |
2694 | 2694 | ||
2695 | ocfs2_free_dir_lookup_result(&orphan_insert); | 2695 | ocfs2_free_dir_lookup_result(&orphan_insert); |
@@ -2721,10 +2721,10 @@ int ocfs2_del_inode_from_orphan(struct ocfs2_super *osb, | |||
2721 | goto bail; | 2721 | goto bail; |
2722 | } | 2722 | } |
2723 | 2723 | ||
2724 | mutex_lock(&orphan_dir_inode->i_mutex); | 2724 | inode_lock(orphan_dir_inode); |
2725 | status = ocfs2_inode_lock(orphan_dir_inode, &orphan_dir_bh, 1); | 2725 | status = ocfs2_inode_lock(orphan_dir_inode, &orphan_dir_bh, 1); |
2726 | if (status < 0) { | 2726 | if (status < 0) { |
2727 | mutex_unlock(&orphan_dir_inode->i_mutex); | 2727 | inode_unlock(orphan_dir_inode); |
2728 | iput(orphan_dir_inode); | 2728 | iput(orphan_dir_inode); |
2729 | mlog_errno(status); | 2729 | mlog_errno(status); |
2730 | goto bail; | 2730 | goto bail; |
@@ -2770,7 +2770,7 @@ bail_commit: | |||
2770 | 2770 | ||
2771 | bail_unlock_orphan: | 2771 | bail_unlock_orphan: |
2772 | ocfs2_inode_unlock(orphan_dir_inode, 1); | 2772 | ocfs2_inode_unlock(orphan_dir_inode, 1); |
2773 | mutex_unlock(&orphan_dir_inode->i_mutex); | 2773 | inode_unlock(orphan_dir_inode); |
2774 | brelse(orphan_dir_bh); | 2774 | brelse(orphan_dir_bh); |
2775 | iput(orphan_dir_inode); | 2775 | iput(orphan_dir_inode); |
2776 | 2776 | ||
@@ -2834,12 +2834,12 @@ int ocfs2_mv_orphaned_inode_to_new(struct inode *dir, | |||
2834 | goto leave; | 2834 | goto leave; |
2835 | } | 2835 | } |
2836 | 2836 | ||
2837 | mutex_lock(&orphan_dir_inode->i_mutex); | 2837 | inode_lock(orphan_dir_inode); |
2838 | 2838 | ||
2839 | status = ocfs2_inode_lock(orphan_dir_inode, &orphan_dir_bh, 1); | 2839 | status = ocfs2_inode_lock(orphan_dir_inode, &orphan_dir_bh, 1); |
2840 | if (status < 0) { | 2840 | if (status < 0) { |
2841 | mlog_errno(status); | 2841 | mlog_errno(status); |
2842 | mutex_unlock(&orphan_dir_inode->i_mutex); | 2842 | inode_unlock(orphan_dir_inode); |
2843 | iput(orphan_dir_inode); | 2843 | iput(orphan_dir_inode); |
2844 | goto leave; | 2844 | goto leave; |
2845 | } | 2845 | } |
@@ -2901,7 +2901,7 @@ out_commit: | |||
2901 | ocfs2_commit_trans(osb, handle); | 2901 | ocfs2_commit_trans(osb, handle); |
2902 | orphan_unlock: | 2902 | orphan_unlock: |
2903 | ocfs2_inode_unlock(orphan_dir_inode, 1); | 2903 | ocfs2_inode_unlock(orphan_dir_inode, 1); |
2904 | mutex_unlock(&orphan_dir_inode->i_mutex); | 2904 | inode_unlock(orphan_dir_inode); |
2905 | iput(orphan_dir_inode); | 2905 | iput(orphan_dir_inode); |
2906 | leave: | 2906 | leave: |
2907 | 2907 | ||
diff --git a/fs/ocfs2/quota_global.c b/fs/ocfs2/quota_global.c index fde9ef18cff3..9c9dd30bc945 100644 --- a/fs/ocfs2/quota_global.c +++ b/fs/ocfs2/quota_global.c | |||
@@ -308,7 +308,7 @@ int ocfs2_lock_global_qf(struct ocfs2_mem_dqinfo *oinfo, int ex) | |||
308 | WARN_ON(bh != oinfo->dqi_gqi_bh); | 308 | WARN_ON(bh != oinfo->dqi_gqi_bh); |
309 | spin_unlock(&dq_data_lock); | 309 | spin_unlock(&dq_data_lock); |
310 | if (ex) { | 310 | if (ex) { |
311 | mutex_lock(&oinfo->dqi_gqinode->i_mutex); | 311 | inode_lock(oinfo->dqi_gqinode); |
312 | down_write(&OCFS2_I(oinfo->dqi_gqinode)->ip_alloc_sem); | 312 | down_write(&OCFS2_I(oinfo->dqi_gqinode)->ip_alloc_sem); |
313 | } else { | 313 | } else { |
314 | down_read(&OCFS2_I(oinfo->dqi_gqinode)->ip_alloc_sem); | 314 | down_read(&OCFS2_I(oinfo->dqi_gqinode)->ip_alloc_sem); |
@@ -320,7 +320,7 @@ void ocfs2_unlock_global_qf(struct ocfs2_mem_dqinfo *oinfo, int ex) | |||
320 | { | 320 | { |
321 | if (ex) { | 321 | if (ex) { |
322 | up_write(&OCFS2_I(oinfo->dqi_gqinode)->ip_alloc_sem); | 322 | up_write(&OCFS2_I(oinfo->dqi_gqinode)->ip_alloc_sem); |
323 | mutex_unlock(&oinfo->dqi_gqinode->i_mutex); | 323 | inode_unlock(oinfo->dqi_gqinode); |
324 | } else { | 324 | } else { |
325 | up_read(&OCFS2_I(oinfo->dqi_gqinode)->ip_alloc_sem); | 325 | up_read(&OCFS2_I(oinfo->dqi_gqinode)->ip_alloc_sem); |
326 | } | 326 | } |
diff --git a/fs/ocfs2/refcounttree.c b/fs/ocfs2/refcounttree.c index 252119860e6c..3eff031aaf26 100644 --- a/fs/ocfs2/refcounttree.c +++ b/fs/ocfs2/refcounttree.c | |||
@@ -807,7 +807,7 @@ int ocfs2_remove_refcount_tree(struct inode *inode, struct buffer_head *di_bh) | |||
807 | mlog_errno(ret); | 807 | mlog_errno(ret); |
808 | goto out; | 808 | goto out; |
809 | } | 809 | } |
810 | mutex_lock(&alloc_inode->i_mutex); | 810 | inode_lock(alloc_inode); |
811 | 811 | ||
812 | ret = ocfs2_inode_lock(alloc_inode, &alloc_bh, 1); | 812 | ret = ocfs2_inode_lock(alloc_inode, &alloc_bh, 1); |
813 | if (ret) { | 813 | if (ret) { |
@@ -867,7 +867,7 @@ out_unlock: | |||
867 | } | 867 | } |
868 | out_mutex: | 868 | out_mutex: |
869 | if (alloc_inode) { | 869 | if (alloc_inode) { |
870 | mutex_unlock(&alloc_inode->i_mutex); | 870 | inode_unlock(alloc_inode); |
871 | iput(alloc_inode); | 871 | iput(alloc_inode); |
872 | } | 872 | } |
873 | out: | 873 | out: |
@@ -4197,7 +4197,7 @@ static int __ocfs2_reflink(struct dentry *old_dentry, | |||
4197 | goto out; | 4197 | goto out; |
4198 | } | 4198 | } |
4199 | 4199 | ||
4200 | mutex_lock_nested(&new_inode->i_mutex, I_MUTEX_CHILD); | 4200 | inode_lock_nested(new_inode, I_MUTEX_CHILD); |
4201 | ret = ocfs2_inode_lock_nested(new_inode, &new_bh, 1, | 4201 | ret = ocfs2_inode_lock_nested(new_inode, &new_bh, 1, |
4202 | OI_LS_REFLINK_TARGET); | 4202 | OI_LS_REFLINK_TARGET); |
4203 | if (ret) { | 4203 | if (ret) { |
@@ -4231,7 +4231,7 @@ inode_unlock: | |||
4231 | ocfs2_inode_unlock(new_inode, 1); | 4231 | ocfs2_inode_unlock(new_inode, 1); |
4232 | brelse(new_bh); | 4232 | brelse(new_bh); |
4233 | out_unlock: | 4233 | out_unlock: |
4234 | mutex_unlock(&new_inode->i_mutex); | 4234 | inode_unlock(new_inode); |
4235 | out: | 4235 | out: |
4236 | if (!ret) { | 4236 | if (!ret) { |
4237 | ret = filemap_fdatawait(inode->i_mapping); | 4237 | ret = filemap_fdatawait(inode->i_mapping); |
@@ -4402,11 +4402,11 @@ static int ocfs2_vfs_reflink(struct dentry *old_dentry, struct inode *dir, | |||
4402 | return error; | 4402 | return error; |
4403 | } | 4403 | } |
4404 | 4404 | ||
4405 | mutex_lock(&inode->i_mutex); | 4405 | inode_lock(inode); |
4406 | error = dquot_initialize(dir); | 4406 | error = dquot_initialize(dir); |
4407 | if (!error) | 4407 | if (!error) |
4408 | error = ocfs2_reflink(old_dentry, dir, new_dentry, preserve); | 4408 | error = ocfs2_reflink(old_dentry, dir, new_dentry, preserve); |
4409 | mutex_unlock(&inode->i_mutex); | 4409 | inode_unlock(inode); |
4410 | if (!error) | 4410 | if (!error) |
4411 | fsnotify_create(dir, new_dentry); | 4411 | fsnotify_create(dir, new_dentry); |
4412 | return error; | 4412 | return error; |
diff --git a/fs/ocfs2/resize.c b/fs/ocfs2/resize.c index 79b8021302b3..576b9a04873f 100644 --- a/fs/ocfs2/resize.c +++ b/fs/ocfs2/resize.c | |||
@@ -301,7 +301,7 @@ int ocfs2_group_extend(struct inode * inode, int new_clusters) | |||
301 | goto out; | 301 | goto out; |
302 | } | 302 | } |
303 | 303 | ||
304 | mutex_lock(&main_bm_inode->i_mutex); | 304 | inode_lock(main_bm_inode); |
305 | 305 | ||
306 | ret = ocfs2_inode_lock(main_bm_inode, &main_bm_bh, 1); | 306 | ret = ocfs2_inode_lock(main_bm_inode, &main_bm_bh, 1); |
307 | if (ret < 0) { | 307 | if (ret < 0) { |
@@ -375,7 +375,7 @@ out_unlock: | |||
375 | ocfs2_inode_unlock(main_bm_inode, 1); | 375 | ocfs2_inode_unlock(main_bm_inode, 1); |
376 | 376 | ||
377 | out_mutex: | 377 | out_mutex: |
378 | mutex_unlock(&main_bm_inode->i_mutex); | 378 | inode_unlock(main_bm_inode); |
379 | iput(main_bm_inode); | 379 | iput(main_bm_inode); |
380 | 380 | ||
381 | out: | 381 | out: |
@@ -486,7 +486,7 @@ int ocfs2_group_add(struct inode *inode, struct ocfs2_new_group_input *input) | |||
486 | goto out; | 486 | goto out; |
487 | } | 487 | } |
488 | 488 | ||
489 | mutex_lock(&main_bm_inode->i_mutex); | 489 | inode_lock(main_bm_inode); |
490 | 490 | ||
491 | ret = ocfs2_inode_lock(main_bm_inode, &main_bm_bh, 1); | 491 | ret = ocfs2_inode_lock(main_bm_inode, &main_bm_bh, 1); |
492 | if (ret < 0) { | 492 | if (ret < 0) { |
@@ -590,7 +590,7 @@ out_unlock: | |||
590 | ocfs2_inode_unlock(main_bm_inode, 1); | 590 | ocfs2_inode_unlock(main_bm_inode, 1); |
591 | 591 | ||
592 | out_mutex: | 592 | out_mutex: |
593 | mutex_unlock(&main_bm_inode->i_mutex); | 593 | inode_unlock(main_bm_inode); |
594 | iput(main_bm_inode); | 594 | iput(main_bm_inode); |
595 | 595 | ||
596 | out: | 596 | out: |
diff --git a/fs/ocfs2/suballoc.c b/fs/ocfs2/suballoc.c index fc6d25f6d444..2f19aeec5482 100644 --- a/fs/ocfs2/suballoc.c +++ b/fs/ocfs2/suballoc.c | |||
@@ -141,7 +141,7 @@ void ocfs2_free_ac_resource(struct ocfs2_alloc_context *ac) | |||
141 | if (ac->ac_which != OCFS2_AC_USE_LOCAL) | 141 | if (ac->ac_which != OCFS2_AC_USE_LOCAL) |
142 | ocfs2_inode_unlock(inode, 1); | 142 | ocfs2_inode_unlock(inode, 1); |
143 | 143 | ||
144 | mutex_unlock(&inode->i_mutex); | 144 | inode_unlock(inode); |
145 | 145 | ||
146 | iput(inode); | 146 | iput(inode); |
147 | ac->ac_inode = NULL; | 147 | ac->ac_inode = NULL; |
@@ -797,11 +797,11 @@ static int ocfs2_reserve_suballoc_bits(struct ocfs2_super *osb, | |||
797 | return -EINVAL; | 797 | return -EINVAL; |
798 | } | 798 | } |
799 | 799 | ||
800 | mutex_lock(&alloc_inode->i_mutex); | 800 | inode_lock(alloc_inode); |
801 | 801 | ||
802 | status = ocfs2_inode_lock(alloc_inode, &bh, 1); | 802 | status = ocfs2_inode_lock(alloc_inode, &bh, 1); |
803 | if (status < 0) { | 803 | if (status < 0) { |
804 | mutex_unlock(&alloc_inode->i_mutex); | 804 | inode_unlock(alloc_inode); |
805 | iput(alloc_inode); | 805 | iput(alloc_inode); |
806 | 806 | ||
807 | mlog_errno(status); | 807 | mlog_errno(status); |
@@ -2875,10 +2875,10 @@ int ocfs2_test_inode_bit(struct ocfs2_super *osb, u64 blkno, int *res) | |||
2875 | goto bail; | 2875 | goto bail; |
2876 | } | 2876 | } |
2877 | 2877 | ||
2878 | mutex_lock(&inode_alloc_inode->i_mutex); | 2878 | inode_lock(inode_alloc_inode); |
2879 | status = ocfs2_inode_lock(inode_alloc_inode, &alloc_bh, 0); | 2879 | status = ocfs2_inode_lock(inode_alloc_inode, &alloc_bh, 0); |
2880 | if (status < 0) { | 2880 | if (status < 0) { |
2881 | mutex_unlock(&inode_alloc_inode->i_mutex); | 2881 | inode_unlock(inode_alloc_inode); |
2882 | iput(inode_alloc_inode); | 2882 | iput(inode_alloc_inode); |
2883 | mlog(ML_ERROR, "lock on alloc inode on slot %u failed %d\n", | 2883 | mlog(ML_ERROR, "lock on alloc inode on slot %u failed %d\n", |
2884 | (u32)suballoc_slot, status); | 2884 | (u32)suballoc_slot, status); |
@@ -2891,7 +2891,7 @@ int ocfs2_test_inode_bit(struct ocfs2_super *osb, u64 blkno, int *res) | |||
2891 | mlog(ML_ERROR, "test suballoc bit failed %d\n", status); | 2891 | mlog(ML_ERROR, "test suballoc bit failed %d\n", status); |
2892 | 2892 | ||
2893 | ocfs2_inode_unlock(inode_alloc_inode, 0); | 2893 | ocfs2_inode_unlock(inode_alloc_inode, 0); |
2894 | mutex_unlock(&inode_alloc_inode->i_mutex); | 2894 | inode_unlock(inode_alloc_inode); |
2895 | 2895 | ||
2896 | iput(inode_alloc_inode); | 2896 | iput(inode_alloc_inode); |
2897 | brelse(alloc_bh); | 2897 | brelse(alloc_bh); |
diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c index f0e241ffd94f..7d3d979f57d9 100644 --- a/fs/ocfs2/xattr.c +++ b/fs/ocfs2/xattr.c | |||
@@ -2524,7 +2524,7 @@ static int ocfs2_xattr_free_block(struct inode *inode, | |||
2524 | mlog_errno(ret); | 2524 | mlog_errno(ret); |
2525 | goto out; | 2525 | goto out; |
2526 | } | 2526 | } |
2527 | mutex_lock(&xb_alloc_inode->i_mutex); | 2527 | inode_lock(xb_alloc_inode); |
2528 | 2528 | ||
2529 | ret = ocfs2_inode_lock(xb_alloc_inode, &xb_alloc_bh, 1); | 2529 | ret = ocfs2_inode_lock(xb_alloc_inode, &xb_alloc_bh, 1); |
2530 | if (ret < 0) { | 2530 | if (ret < 0) { |
@@ -2549,7 +2549,7 @@ out_unlock: | |||
2549 | ocfs2_inode_unlock(xb_alloc_inode, 1); | 2549 | ocfs2_inode_unlock(xb_alloc_inode, 1); |
2550 | brelse(xb_alloc_bh); | 2550 | brelse(xb_alloc_bh); |
2551 | out_mutex: | 2551 | out_mutex: |
2552 | mutex_unlock(&xb_alloc_inode->i_mutex); | 2552 | inode_unlock(xb_alloc_inode); |
2553 | iput(xb_alloc_inode); | 2553 | iput(xb_alloc_inode); |
2554 | out: | 2554 | out: |
2555 | brelse(blk_bh); | 2555 | brelse(blk_bh); |
@@ -3619,17 +3619,17 @@ int ocfs2_xattr_set(struct inode *inode, | |||
3619 | } | 3619 | } |
3620 | } | 3620 | } |
3621 | 3621 | ||
3622 | mutex_lock(&tl_inode->i_mutex); | 3622 | inode_lock(tl_inode); |
3623 | 3623 | ||
3624 | if (ocfs2_truncate_log_needs_flush(osb)) { | 3624 | if (ocfs2_truncate_log_needs_flush(osb)) { |
3625 | ret = __ocfs2_flush_truncate_log(osb); | 3625 | ret = __ocfs2_flush_truncate_log(osb); |
3626 | if (ret < 0) { | 3626 | if (ret < 0) { |
3627 | mutex_unlock(&tl_inode->i_mutex); | 3627 | inode_unlock(tl_inode); |
3628 | mlog_errno(ret); | 3628 | mlog_errno(ret); |
3629 | goto cleanup; | 3629 | goto cleanup; |
3630 | } | 3630 | } |
3631 | } | 3631 | } |
3632 | mutex_unlock(&tl_inode->i_mutex); | 3632 | inode_unlock(tl_inode); |
3633 | 3633 | ||
3634 | ret = ocfs2_init_xattr_set_ctxt(inode, di, &xi, &xis, | 3634 | ret = ocfs2_init_xattr_set_ctxt(inode, di, &xi, &xis, |
3635 | &xbs, &ctxt, ref_meta, &credits); | 3635 | &xbs, &ctxt, ref_meta, &credits); |
@@ -5460,7 +5460,7 @@ static int ocfs2_rm_xattr_cluster(struct inode *inode, | |||
5460 | return ret; | 5460 | return ret; |
5461 | } | 5461 | } |
5462 | 5462 | ||
5463 | mutex_lock(&tl_inode->i_mutex); | 5463 | inode_lock(tl_inode); |
5464 | 5464 | ||
5465 | if (ocfs2_truncate_log_needs_flush(osb)) { | 5465 | if (ocfs2_truncate_log_needs_flush(osb)) { |
5466 | ret = __ocfs2_flush_truncate_log(osb); | 5466 | ret = __ocfs2_flush_truncate_log(osb); |
@@ -5504,7 +5504,7 @@ out_commit: | |||
5504 | out: | 5504 | out: |
5505 | ocfs2_schedule_truncate_log_flush(osb, 1); | 5505 | ocfs2_schedule_truncate_log_flush(osb, 1); |
5506 | 5506 | ||
5507 | mutex_unlock(&tl_inode->i_mutex); | 5507 | inode_unlock(tl_inode); |
5508 | 5508 | ||
5509 | if (meta_ac) | 5509 | if (meta_ac) |
5510 | ocfs2_free_alloc_context(meta_ac); | 5510 | ocfs2_free_alloc_context(meta_ac); |
@@ -58,10 +58,10 @@ int do_truncate(struct dentry *dentry, loff_t length, unsigned int time_attrs, | |||
58 | if (ret) | 58 | if (ret) |
59 | newattrs.ia_valid |= ret | ATTR_FORCE; | 59 | newattrs.ia_valid |= ret | ATTR_FORCE; |
60 | 60 | ||
61 | mutex_lock(&dentry->d_inode->i_mutex); | 61 | inode_lock(dentry->d_inode); |
62 | /* Note any delegations or leases have already been broken: */ | 62 | /* Note any delegations or leases have already been broken: */ |
63 | ret = notify_change(dentry, &newattrs, NULL); | 63 | ret = notify_change(dentry, &newattrs, NULL); |
64 | mutex_unlock(&dentry->d_inode->i_mutex); | 64 | inode_unlock(dentry->d_inode); |
65 | return ret; | 65 | return ret; |
66 | } | 66 | } |
67 | 67 | ||
@@ -510,7 +510,7 @@ static int chmod_common(struct path *path, umode_t mode) | |||
510 | if (error) | 510 | if (error) |
511 | return error; | 511 | return error; |
512 | retry_deleg: | 512 | retry_deleg: |
513 | mutex_lock(&inode->i_mutex); | 513 | inode_lock(inode); |
514 | error = security_path_chmod(path, mode); | 514 | error = security_path_chmod(path, mode); |
515 | if (error) | 515 | if (error) |
516 | goto out_unlock; | 516 | goto out_unlock; |
@@ -518,7 +518,7 @@ retry_deleg: | |||
518 | newattrs.ia_valid = ATTR_MODE | ATTR_CTIME; | 518 | newattrs.ia_valid = ATTR_MODE | ATTR_CTIME; |
519 | error = notify_change(path->dentry, &newattrs, &delegated_inode); | 519 | error = notify_change(path->dentry, &newattrs, &delegated_inode); |
520 | out_unlock: | 520 | out_unlock: |
521 | mutex_unlock(&inode->i_mutex); | 521 | inode_unlock(inode); |
522 | if (delegated_inode) { | 522 | if (delegated_inode) { |
523 | error = break_deleg_wait(&delegated_inode); | 523 | error = break_deleg_wait(&delegated_inode); |
524 | if (!error) | 524 | if (!error) |
@@ -593,11 +593,11 @@ retry_deleg: | |||
593 | if (!S_ISDIR(inode->i_mode)) | 593 | if (!S_ISDIR(inode->i_mode)) |
594 | newattrs.ia_valid |= | 594 | newattrs.ia_valid |= |
595 | ATTR_KILL_SUID | ATTR_KILL_SGID | ATTR_KILL_PRIV; | 595 | ATTR_KILL_SUID | ATTR_KILL_SGID | ATTR_KILL_PRIV; |
596 | mutex_lock(&inode->i_mutex); | 596 | inode_lock(inode); |
597 | error = security_path_chown(path, uid, gid); | 597 | error = security_path_chown(path, uid, gid); |
598 | if (!error) | 598 | if (!error) |
599 | error = notify_change(path->dentry, &newattrs, &delegated_inode); | 599 | error = notify_change(path->dentry, &newattrs, &delegated_inode); |
600 | mutex_unlock(&inode->i_mutex); | 600 | inode_unlock(inode); |
601 | if (delegated_inode) { | 601 | if (delegated_inode) { |
602 | error = break_deleg_wait(&delegated_inode); | 602 | error = break_deleg_wait(&delegated_inode); |
603 | if (!error) | 603 | if (!error) |
diff --git a/fs/overlayfs/copy_up.c b/fs/overlayfs/copy_up.c index eff6319d5037..d894e7cd9a86 100644 --- a/fs/overlayfs/copy_up.c +++ b/fs/overlayfs/copy_up.c | |||
@@ -248,9 +248,9 @@ static int ovl_copy_up_locked(struct dentry *workdir, struct dentry *upperdir, | |||
248 | if (err) | 248 | if (err) |
249 | goto out_cleanup; | 249 | goto out_cleanup; |
250 | 250 | ||
251 | mutex_lock(&newdentry->d_inode->i_mutex); | 251 | inode_lock(newdentry->d_inode); |
252 | err = ovl_set_attr(newdentry, stat); | 252 | err = ovl_set_attr(newdentry, stat); |
253 | mutex_unlock(&newdentry->d_inode->i_mutex); | 253 | inode_unlock(newdentry->d_inode); |
254 | if (err) | 254 | if (err) |
255 | goto out_cleanup; | 255 | goto out_cleanup; |
256 | 256 | ||
diff --git a/fs/overlayfs/dir.c b/fs/overlayfs/dir.c index 692ceda3bc21..ed95272d57a6 100644 --- a/fs/overlayfs/dir.c +++ b/fs/overlayfs/dir.c | |||
@@ -167,7 +167,7 @@ static int ovl_create_upper(struct dentry *dentry, struct inode *inode, | |||
167 | struct dentry *newdentry; | 167 | struct dentry *newdentry; |
168 | int err; | 168 | int err; |
169 | 169 | ||
170 | mutex_lock_nested(&udir->i_mutex, I_MUTEX_PARENT); | 170 | inode_lock_nested(udir, I_MUTEX_PARENT); |
171 | newdentry = lookup_one_len(dentry->d_name.name, upperdir, | 171 | newdentry = lookup_one_len(dentry->d_name.name, upperdir, |
172 | dentry->d_name.len); | 172 | dentry->d_name.len); |
173 | err = PTR_ERR(newdentry); | 173 | err = PTR_ERR(newdentry); |
@@ -185,7 +185,7 @@ static int ovl_create_upper(struct dentry *dentry, struct inode *inode, | |||
185 | out_dput: | 185 | out_dput: |
186 | dput(newdentry); | 186 | dput(newdentry); |
187 | out_unlock: | 187 | out_unlock: |
188 | mutex_unlock(&udir->i_mutex); | 188 | inode_unlock(udir); |
189 | return err; | 189 | return err; |
190 | } | 190 | } |
191 | 191 | ||
@@ -258,9 +258,9 @@ static struct dentry *ovl_clear_empty(struct dentry *dentry, | |||
258 | if (err) | 258 | if (err) |
259 | goto out_cleanup; | 259 | goto out_cleanup; |
260 | 260 | ||
261 | mutex_lock(&opaquedir->d_inode->i_mutex); | 261 | inode_lock(opaquedir->d_inode); |
262 | err = ovl_set_attr(opaquedir, &stat); | 262 | err = ovl_set_attr(opaquedir, &stat); |
263 | mutex_unlock(&opaquedir->d_inode->i_mutex); | 263 | inode_unlock(opaquedir->d_inode); |
264 | if (err) | 264 | if (err) |
265 | goto out_cleanup; | 265 | goto out_cleanup; |
266 | 266 | ||
@@ -599,7 +599,7 @@ static int ovl_remove_upper(struct dentry *dentry, bool is_dir) | |||
599 | struct dentry *upper = ovl_dentry_upper(dentry); | 599 | struct dentry *upper = ovl_dentry_upper(dentry); |
600 | int err; | 600 | int err; |
601 | 601 | ||
602 | mutex_lock_nested(&dir->i_mutex, I_MUTEX_PARENT); | 602 | inode_lock_nested(dir, I_MUTEX_PARENT); |
603 | err = -ESTALE; | 603 | err = -ESTALE; |
604 | if (upper->d_parent == upperdir) { | 604 | if (upper->d_parent == upperdir) { |
605 | /* Don't let d_delete() think it can reset d_inode */ | 605 | /* Don't let d_delete() think it can reset d_inode */ |
@@ -619,7 +619,7 @@ static int ovl_remove_upper(struct dentry *dentry, bool is_dir) | |||
619 | * now. | 619 | * now. |
620 | */ | 620 | */ |
621 | d_drop(dentry); | 621 | d_drop(dentry); |
622 | mutex_unlock(&dir->i_mutex); | 622 | inode_unlock(dir); |
623 | 623 | ||
624 | return err; | 624 | return err; |
625 | } | 625 | } |
diff --git a/fs/overlayfs/inode.c b/fs/overlayfs/inode.c index bf996e574f3d..49e204560655 100644 --- a/fs/overlayfs/inode.c +++ b/fs/overlayfs/inode.c | |||
@@ -63,9 +63,9 @@ int ovl_setattr(struct dentry *dentry, struct iattr *attr) | |||
63 | if (!err) { | 63 | if (!err) { |
64 | upperdentry = ovl_dentry_upper(dentry); | 64 | upperdentry = ovl_dentry_upper(dentry); |
65 | 65 | ||
66 | mutex_lock(&upperdentry->d_inode->i_mutex); | 66 | inode_lock(upperdentry->d_inode); |
67 | err = notify_change(upperdentry, attr, NULL); | 67 | err = notify_change(upperdentry, attr, NULL); |
68 | mutex_unlock(&upperdentry->d_inode->i_mutex); | 68 | inode_unlock(upperdentry->d_inode); |
69 | } | 69 | } |
70 | ovl_drop_write(dentry); | 70 | ovl_drop_write(dentry); |
71 | out: | 71 | out: |
diff --git a/fs/overlayfs/readdir.c b/fs/overlayfs/readdir.c index adcb1398c481..fdaf28f75e12 100644 --- a/fs/overlayfs/readdir.c +++ b/fs/overlayfs/readdir.c | |||
@@ -228,7 +228,7 @@ static int ovl_check_whiteouts(struct dentry *dir, struct ovl_readdir_data *rdd) | |||
228 | dput(dentry); | 228 | dput(dentry); |
229 | } | 229 | } |
230 | } | 230 | } |
231 | mutex_unlock(&dir->d_inode->i_mutex); | 231 | inode_unlock(dir->d_inode); |
232 | } | 232 | } |
233 | revert_creds(old_cred); | 233 | revert_creds(old_cred); |
234 | put_cred(override_cred); | 234 | put_cred(override_cred); |
@@ -399,7 +399,7 @@ static loff_t ovl_dir_llseek(struct file *file, loff_t offset, int origin) | |||
399 | loff_t res; | 399 | loff_t res; |
400 | struct ovl_dir_file *od = file->private_data; | 400 | struct ovl_dir_file *od = file->private_data; |
401 | 401 | ||
402 | mutex_lock(&file_inode(file)->i_mutex); | 402 | inode_lock(file_inode(file)); |
403 | if (!file->f_pos) | 403 | if (!file->f_pos) |
404 | ovl_dir_reset(file); | 404 | ovl_dir_reset(file); |
405 | 405 | ||
@@ -429,7 +429,7 @@ static loff_t ovl_dir_llseek(struct file *file, loff_t offset, int origin) | |||
429 | res = offset; | 429 | res = offset; |
430 | } | 430 | } |
431 | out_unlock: | 431 | out_unlock: |
432 | mutex_unlock(&file_inode(file)->i_mutex); | 432 | inode_unlock(file_inode(file)); |
433 | 433 | ||
434 | return res; | 434 | return res; |
435 | } | 435 | } |
@@ -454,10 +454,10 @@ static int ovl_dir_fsync(struct file *file, loff_t start, loff_t end, | |||
454 | ovl_path_upper(dentry, &upperpath); | 454 | ovl_path_upper(dentry, &upperpath); |
455 | realfile = ovl_path_open(&upperpath, O_RDONLY); | 455 | realfile = ovl_path_open(&upperpath, O_RDONLY); |
456 | smp_mb__before_spinlock(); | 456 | smp_mb__before_spinlock(); |
457 | mutex_lock(&inode->i_mutex); | 457 | inode_lock(inode); |
458 | if (!od->upperfile) { | 458 | if (!od->upperfile) { |
459 | if (IS_ERR(realfile)) { | 459 | if (IS_ERR(realfile)) { |
460 | mutex_unlock(&inode->i_mutex); | 460 | inode_unlock(inode); |
461 | return PTR_ERR(realfile); | 461 | return PTR_ERR(realfile); |
462 | } | 462 | } |
463 | od->upperfile = realfile; | 463 | od->upperfile = realfile; |
@@ -467,7 +467,7 @@ static int ovl_dir_fsync(struct file *file, loff_t start, loff_t end, | |||
467 | fput(realfile); | 467 | fput(realfile); |
468 | realfile = od->upperfile; | 468 | realfile = od->upperfile; |
469 | } | 469 | } |
470 | mutex_unlock(&inode->i_mutex); | 470 | inode_unlock(inode); |
471 | } | 471 | } |
472 | } | 472 | } |
473 | 473 | ||
@@ -479,9 +479,9 @@ static int ovl_dir_release(struct inode *inode, struct file *file) | |||
479 | struct ovl_dir_file *od = file->private_data; | 479 | struct ovl_dir_file *od = file->private_data; |
480 | 480 | ||
481 | if (od->cache) { | 481 | if (od->cache) { |
482 | mutex_lock(&inode->i_mutex); | 482 | inode_lock(inode); |
483 | ovl_cache_put(od, file->f_path.dentry); | 483 | ovl_cache_put(od, file->f_path.dentry); |
484 | mutex_unlock(&inode->i_mutex); | 484 | inode_unlock(inode); |
485 | } | 485 | } |
486 | fput(od->realfile); | 486 | fput(od->realfile); |
487 | if (od->upperfile) | 487 | if (od->upperfile) |
@@ -557,7 +557,7 @@ void ovl_cleanup_whiteouts(struct dentry *upper, struct list_head *list) | |||
557 | { | 557 | { |
558 | struct ovl_cache_entry *p; | 558 | struct ovl_cache_entry *p; |
559 | 559 | ||
560 | mutex_lock_nested(&upper->d_inode->i_mutex, I_MUTEX_CHILD); | 560 | inode_lock_nested(upper->d_inode, I_MUTEX_CHILD); |
561 | list_for_each_entry(p, list, l_node) { | 561 | list_for_each_entry(p, list, l_node) { |
562 | struct dentry *dentry; | 562 | struct dentry *dentry; |
563 | 563 | ||
@@ -575,5 +575,5 @@ void ovl_cleanup_whiteouts(struct dentry *upper, struct list_head *list) | |||
575 | ovl_cleanup(upper->d_inode, dentry); | 575 | ovl_cleanup(upper->d_inode, dentry); |
576 | dput(dentry); | 576 | dput(dentry); |
577 | } | 577 | } |
578 | mutex_unlock(&upper->d_inode->i_mutex); | 578 | inode_unlock(upper->d_inode); |
579 | } | 579 | } |
diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c index d250604f985a..8d826bd56b26 100644 --- a/fs/overlayfs/super.c +++ b/fs/overlayfs/super.c | |||
@@ -229,7 +229,7 @@ void ovl_dentry_update(struct dentry *dentry, struct dentry *upperdentry) | |||
229 | { | 229 | { |
230 | struct ovl_entry *oe = dentry->d_fsdata; | 230 | struct ovl_entry *oe = dentry->d_fsdata; |
231 | 231 | ||
232 | WARN_ON(!mutex_is_locked(&upperdentry->d_parent->d_inode->i_mutex)); | 232 | WARN_ON(!inode_is_locked(upperdentry->d_parent->d_inode)); |
233 | WARN_ON(oe->__upperdentry); | 233 | WARN_ON(oe->__upperdentry); |
234 | BUG_ON(!upperdentry->d_inode); | 234 | BUG_ON(!upperdentry->d_inode); |
235 | /* | 235 | /* |
@@ -244,7 +244,7 @@ void ovl_dentry_version_inc(struct dentry *dentry) | |||
244 | { | 244 | { |
245 | struct ovl_entry *oe = dentry->d_fsdata; | 245 | struct ovl_entry *oe = dentry->d_fsdata; |
246 | 246 | ||
247 | WARN_ON(!mutex_is_locked(&dentry->d_inode->i_mutex)); | 247 | WARN_ON(!inode_is_locked(dentry->d_inode)); |
248 | oe->version++; | 248 | oe->version++; |
249 | } | 249 | } |
250 | 250 | ||
@@ -252,7 +252,7 @@ u64 ovl_dentry_version_get(struct dentry *dentry) | |||
252 | { | 252 | { |
253 | struct ovl_entry *oe = dentry->d_fsdata; | 253 | struct ovl_entry *oe = dentry->d_fsdata; |
254 | 254 | ||
255 | WARN_ON(!mutex_is_locked(&dentry->d_inode->i_mutex)); | 255 | WARN_ON(!inode_is_locked(dentry->d_inode)); |
256 | return oe->version; | 256 | return oe->version; |
257 | } | 257 | } |
258 | 258 | ||
@@ -375,9 +375,9 @@ static inline struct dentry *ovl_lookup_real(struct dentry *dir, | |||
375 | { | 375 | { |
376 | struct dentry *dentry; | 376 | struct dentry *dentry; |
377 | 377 | ||
378 | mutex_lock(&dir->d_inode->i_mutex); | 378 | inode_lock(dir->d_inode); |
379 | dentry = lookup_one_len(name->name, dir, name->len); | 379 | dentry = lookup_one_len(name->name, dir, name->len); |
380 | mutex_unlock(&dir->d_inode->i_mutex); | 380 | inode_unlock(dir->d_inode); |
381 | 381 | ||
382 | if (IS_ERR(dentry)) { | 382 | if (IS_ERR(dentry)) { |
383 | if (PTR_ERR(dentry) == -ENOENT) | 383 | if (PTR_ERR(dentry) == -ENOENT) |
@@ -744,7 +744,7 @@ static struct dentry *ovl_workdir_create(struct vfsmount *mnt, | |||
744 | if (err) | 744 | if (err) |
745 | return ERR_PTR(err); | 745 | return ERR_PTR(err); |
746 | 746 | ||
747 | mutex_lock_nested(&dir->i_mutex, I_MUTEX_PARENT); | 747 | inode_lock_nested(dir, I_MUTEX_PARENT); |
748 | retry: | 748 | retry: |
749 | work = lookup_one_len(OVL_WORKDIR_NAME, dentry, | 749 | work = lookup_one_len(OVL_WORKDIR_NAME, dentry, |
750 | strlen(OVL_WORKDIR_NAME)); | 750 | strlen(OVL_WORKDIR_NAME)); |
@@ -770,7 +770,7 @@ retry: | |||
770 | goto out_dput; | 770 | goto out_dput; |
771 | } | 771 | } |
772 | out_unlock: | 772 | out_unlock: |
773 | mutex_unlock(&dir->i_mutex); | 773 | inode_unlock(dir); |
774 | mnt_drop_write(mnt); | 774 | mnt_drop_write(mnt); |
775 | 775 | ||
776 | return work; | 776 | return work; |
diff --git a/fs/proc/kcore.c b/fs/proc/kcore.c index 92e6726f6e37..a939f5ed7f89 100644 --- a/fs/proc/kcore.c +++ b/fs/proc/kcore.c | |||
@@ -552,9 +552,9 @@ static int open_kcore(struct inode *inode, struct file *filp) | |||
552 | if (kcore_need_update) | 552 | if (kcore_need_update) |
553 | kcore_update_ram(); | 553 | kcore_update_ram(); |
554 | if (i_size_read(inode) != proc_root_kcore->size) { | 554 | if (i_size_read(inode) != proc_root_kcore->size) { |
555 | mutex_lock(&inode->i_mutex); | 555 | inode_lock(inode); |
556 | i_size_write(inode, proc_root_kcore->size); | 556 | i_size_write(inode, proc_root_kcore->size); |
557 | mutex_unlock(&inode->i_mutex); | 557 | inode_unlock(inode); |
558 | } | 558 | } |
559 | return 0; | 559 | return 0; |
560 | } | 560 | } |
diff --git a/fs/proc/self.c b/fs/proc/self.c index 67e8db442cf0..b6a8d3529fea 100644 --- a/fs/proc/self.c +++ b/fs/proc/self.c | |||
@@ -50,7 +50,7 @@ int proc_setup_self(struct super_block *s) | |||
50 | struct pid_namespace *ns = s->s_fs_info; | 50 | struct pid_namespace *ns = s->s_fs_info; |
51 | struct dentry *self; | 51 | struct dentry *self; |
52 | 52 | ||
53 | mutex_lock(&root_inode->i_mutex); | 53 | inode_lock(root_inode); |
54 | self = d_alloc_name(s->s_root, "self"); | 54 | self = d_alloc_name(s->s_root, "self"); |
55 | if (self) { | 55 | if (self) { |
56 | struct inode *inode = new_inode_pseudo(s); | 56 | struct inode *inode = new_inode_pseudo(s); |
@@ -69,7 +69,7 @@ int proc_setup_self(struct super_block *s) | |||
69 | } else { | 69 | } else { |
70 | self = ERR_PTR(-ENOMEM); | 70 | self = ERR_PTR(-ENOMEM); |
71 | } | 71 | } |
72 | mutex_unlock(&root_inode->i_mutex); | 72 | inode_unlock(root_inode); |
73 | if (IS_ERR(self)) { | 73 | if (IS_ERR(self)) { |
74 | pr_err("proc_fill_super: can't allocate /proc/self\n"); | 74 | pr_err("proc_fill_super: can't allocate /proc/self\n"); |
75 | return PTR_ERR(self); | 75 | return PTR_ERR(self); |
diff --git a/fs/proc/thread_self.c b/fs/proc/thread_self.c index 9eacd59e0360..e58a31e8fb2a 100644 --- a/fs/proc/thread_self.c +++ b/fs/proc/thread_self.c | |||
@@ -52,7 +52,7 @@ int proc_setup_thread_self(struct super_block *s) | |||
52 | struct pid_namespace *ns = s->s_fs_info; | 52 | struct pid_namespace *ns = s->s_fs_info; |
53 | struct dentry *thread_self; | 53 | struct dentry *thread_self; |
54 | 54 | ||
55 | mutex_lock(&root_inode->i_mutex); | 55 | inode_lock(root_inode); |
56 | thread_self = d_alloc_name(s->s_root, "thread-self"); | 56 | thread_self = d_alloc_name(s->s_root, "thread-self"); |
57 | if (thread_self) { | 57 | if (thread_self) { |
58 | struct inode *inode = new_inode_pseudo(s); | 58 | struct inode *inode = new_inode_pseudo(s); |
@@ -71,7 +71,7 @@ int proc_setup_thread_self(struct super_block *s) | |||
71 | } else { | 71 | } else { |
72 | thread_self = ERR_PTR(-ENOMEM); | 72 | thread_self = ERR_PTR(-ENOMEM); |
73 | } | 73 | } |
74 | mutex_unlock(&root_inode->i_mutex); | 74 | inode_unlock(root_inode); |
75 | if (IS_ERR(thread_self)) { | 75 | if (IS_ERR(thread_self)) { |
76 | pr_err("proc_fill_super: can't allocate /proc/thread_self\n"); | 76 | pr_err("proc_fill_super: can't allocate /proc/thread_self\n"); |
77 | return PTR_ERR(thread_self); | 77 | return PTR_ERR(thread_self); |
diff --git a/fs/pstore/inode.c b/fs/pstore/inode.c index d8c439d813ce..dc645b66cd79 100644 --- a/fs/pstore/inode.c +++ b/fs/pstore/inode.c | |||
@@ -377,7 +377,7 @@ int pstore_mkfile(enum pstore_type_id type, char *psname, u64 id, int count, | |||
377 | break; | 377 | break; |
378 | } | 378 | } |
379 | 379 | ||
380 | mutex_lock(&d_inode(root)->i_mutex); | 380 | inode_lock(d_inode(root)); |
381 | 381 | ||
382 | dentry = d_alloc_name(root, name); | 382 | dentry = d_alloc_name(root, name); |
383 | if (!dentry) | 383 | if (!dentry) |
@@ -397,12 +397,12 @@ int pstore_mkfile(enum pstore_type_id type, char *psname, u64 id, int count, | |||
397 | list_add(&private->list, &allpstore); | 397 | list_add(&private->list, &allpstore); |
398 | spin_unlock_irqrestore(&allpstore_lock, flags); | 398 | spin_unlock_irqrestore(&allpstore_lock, flags); |
399 | 399 | ||
400 | mutex_unlock(&d_inode(root)->i_mutex); | 400 | inode_unlock(d_inode(root)); |
401 | 401 | ||
402 | return 0; | 402 | return 0; |
403 | 403 | ||
404 | fail_lockedalloc: | 404 | fail_lockedalloc: |
405 | mutex_unlock(&d_inode(root)->i_mutex); | 405 | inode_unlock(d_inode(root)); |
406 | kfree(private); | 406 | kfree(private); |
407 | fail_alloc: | 407 | fail_alloc: |
408 | iput(inode); | 408 | iput(inode); |
diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c index fbd70af98820..3c3b81bb6dfe 100644 --- a/fs/quota/dquot.c +++ b/fs/quota/dquot.c | |||
@@ -682,9 +682,9 @@ int dquot_quota_sync(struct super_block *sb, int type) | |||
682 | continue; | 682 | continue; |
683 | if (!sb_has_quota_active(sb, cnt)) | 683 | if (!sb_has_quota_active(sb, cnt)) |
684 | continue; | 684 | continue; |
685 | mutex_lock(&dqopt->files[cnt]->i_mutex); | 685 | inode_lock(dqopt->files[cnt]); |
686 | truncate_inode_pages(&dqopt->files[cnt]->i_data, 0); | 686 | truncate_inode_pages(&dqopt->files[cnt]->i_data, 0); |
687 | mutex_unlock(&dqopt->files[cnt]->i_mutex); | 687 | inode_unlock(dqopt->files[cnt]); |
688 | } | 688 | } |
689 | mutex_unlock(&dqopt->dqonoff_mutex); | 689 | mutex_unlock(&dqopt->dqonoff_mutex); |
690 | 690 | ||
@@ -2162,12 +2162,12 @@ int dquot_disable(struct super_block *sb, int type, unsigned int flags) | |||
2162 | /* If quota was reenabled in the meantime, we have | 2162 | /* If quota was reenabled in the meantime, we have |
2163 | * nothing to do */ | 2163 | * nothing to do */ |
2164 | if (!sb_has_quota_loaded(sb, cnt)) { | 2164 | if (!sb_has_quota_loaded(sb, cnt)) { |
2165 | mutex_lock(&toputinode[cnt]->i_mutex); | 2165 | inode_lock(toputinode[cnt]); |
2166 | toputinode[cnt]->i_flags &= ~(S_IMMUTABLE | | 2166 | toputinode[cnt]->i_flags &= ~(S_IMMUTABLE | |
2167 | S_NOATIME | S_NOQUOTA); | 2167 | S_NOATIME | S_NOQUOTA); |
2168 | truncate_inode_pages(&toputinode[cnt]->i_data, | 2168 | truncate_inode_pages(&toputinode[cnt]->i_data, |
2169 | 0); | 2169 | 0); |
2170 | mutex_unlock(&toputinode[cnt]->i_mutex); | 2170 | inode_unlock(toputinode[cnt]); |
2171 | mark_inode_dirty_sync(toputinode[cnt]); | 2171 | mark_inode_dirty_sync(toputinode[cnt]); |
2172 | } | 2172 | } |
2173 | mutex_unlock(&dqopt->dqonoff_mutex); | 2173 | mutex_unlock(&dqopt->dqonoff_mutex); |
@@ -2258,11 +2258,11 @@ static int vfs_load_quota_inode(struct inode *inode, int type, int format_id, | |||
2258 | /* We don't want quota and atime on quota files (deadlocks | 2258 | /* We don't want quota and atime on quota files (deadlocks |
2259 | * possible) Also nobody should write to the file - we use | 2259 | * possible) Also nobody should write to the file - we use |
2260 | * special IO operations which ignore the immutable bit. */ | 2260 | * special IO operations which ignore the immutable bit. */ |
2261 | mutex_lock(&inode->i_mutex); | 2261 | inode_lock(inode); |
2262 | oldflags = inode->i_flags & (S_NOATIME | S_IMMUTABLE | | 2262 | oldflags = inode->i_flags & (S_NOATIME | S_IMMUTABLE | |
2263 | S_NOQUOTA); | 2263 | S_NOQUOTA); |
2264 | inode->i_flags |= S_NOQUOTA | S_NOATIME | S_IMMUTABLE; | 2264 | inode->i_flags |= S_NOQUOTA | S_NOATIME | S_IMMUTABLE; |
2265 | mutex_unlock(&inode->i_mutex); | 2265 | inode_unlock(inode); |
2266 | /* | 2266 | /* |
2267 | * When S_NOQUOTA is set, remove dquot references as no more | 2267 | * When S_NOQUOTA is set, remove dquot references as no more |
2268 | * references can be added | 2268 | * references can be added |
@@ -2305,12 +2305,12 @@ out_file_init: | |||
2305 | iput(inode); | 2305 | iput(inode); |
2306 | out_lock: | 2306 | out_lock: |
2307 | if (oldflags != -1) { | 2307 | if (oldflags != -1) { |
2308 | mutex_lock(&inode->i_mutex); | 2308 | inode_lock(inode); |
2309 | /* Set the flags back (in the case of accidental quotaon() | 2309 | /* Set the flags back (in the case of accidental quotaon() |
2310 | * on a wrong file we don't want to mess up the flags) */ | 2310 | * on a wrong file we don't want to mess up the flags) */ |
2311 | inode->i_flags &= ~(S_NOATIME | S_NOQUOTA | S_IMMUTABLE); | 2311 | inode->i_flags &= ~(S_NOATIME | S_NOQUOTA | S_IMMUTABLE); |
2312 | inode->i_flags |= oldflags; | 2312 | inode->i_flags |= oldflags; |
2313 | mutex_unlock(&inode->i_mutex); | 2313 | inode_unlock(inode); |
2314 | } | 2314 | } |
2315 | mutex_unlock(&dqopt->dqonoff_mutex); | 2315 | mutex_unlock(&dqopt->dqonoff_mutex); |
2316 | out_fmt: | 2316 | out_fmt: |
@@ -2430,9 +2430,9 @@ int dquot_quota_on_mount(struct super_block *sb, char *qf_name, | |||
2430 | struct dentry *dentry; | 2430 | struct dentry *dentry; |
2431 | int error; | 2431 | int error; |
2432 | 2432 | ||
2433 | mutex_lock(&d_inode(sb->s_root)->i_mutex); | 2433 | inode_lock(d_inode(sb->s_root)); |
2434 | dentry = lookup_one_len(qf_name, sb->s_root, strlen(qf_name)); | 2434 | dentry = lookup_one_len(qf_name, sb->s_root, strlen(qf_name)); |
2435 | mutex_unlock(&d_inode(sb->s_root)->i_mutex); | 2435 | inode_unlock(d_inode(sb->s_root)); |
2436 | if (IS_ERR(dentry)) | 2436 | if (IS_ERR(dentry)) |
2437 | return PTR_ERR(dentry); | 2437 | return PTR_ERR(dentry); |
2438 | 2438 | ||
diff --git a/fs/read_write.c b/fs/read_write.c index 06b07d5a08fe..fa05985f700e 100644 --- a/fs/read_write.c +++ b/fs/read_write.c | |||
@@ -238,7 +238,7 @@ loff_t default_llseek(struct file *file, loff_t offset, int whence) | |||
238 | struct inode *inode = file_inode(file); | 238 | struct inode *inode = file_inode(file); |
239 | loff_t retval; | 239 | loff_t retval; |
240 | 240 | ||
241 | mutex_lock(&inode->i_mutex); | 241 | inode_lock(inode); |
242 | switch (whence) { | 242 | switch (whence) { |
243 | case SEEK_END: | 243 | case SEEK_END: |
244 | offset += i_size_read(inode); | 244 | offset += i_size_read(inode); |
@@ -283,7 +283,7 @@ loff_t default_llseek(struct file *file, loff_t offset, int whence) | |||
283 | retval = offset; | 283 | retval = offset; |
284 | } | 284 | } |
285 | out: | 285 | out: |
286 | mutex_unlock(&inode->i_mutex); | 286 | inode_unlock(inode); |
287 | return retval; | 287 | return retval; |
288 | } | 288 | } |
289 | EXPORT_SYMBOL(default_llseek); | 289 | EXPORT_SYMBOL(default_llseek); |
diff --git a/fs/readdir.c b/fs/readdir.c index ced679179cac..e69ef3b79787 100644 --- a/fs/readdir.c +++ b/fs/readdir.c | |||
@@ -44,7 +44,7 @@ int iterate_dir(struct file *file, struct dir_context *ctx) | |||
44 | fsnotify_access(file); | 44 | fsnotify_access(file); |
45 | file_accessed(file); | 45 | file_accessed(file); |
46 | } | 46 | } |
47 | mutex_unlock(&inode->i_mutex); | 47 | inode_unlock(inode); |
48 | out: | 48 | out: |
49 | return res; | 49 | return res; |
50 | } | 50 | } |
diff --git a/fs/reiserfs/dir.c b/fs/reiserfs/dir.c index 4a024e2ceb9f..3abd4004184b 100644 --- a/fs/reiserfs/dir.c +++ b/fs/reiserfs/dir.c | |||
@@ -38,11 +38,11 @@ static int reiserfs_dir_fsync(struct file *filp, loff_t start, loff_t end, | |||
38 | if (err) | 38 | if (err) |
39 | return err; | 39 | return err; |
40 | 40 | ||
41 | mutex_lock(&inode->i_mutex); | 41 | inode_lock(inode); |
42 | reiserfs_write_lock(inode->i_sb); | 42 | reiserfs_write_lock(inode->i_sb); |
43 | err = reiserfs_commit_for_inode(inode); | 43 | err = reiserfs_commit_for_inode(inode); |
44 | reiserfs_write_unlock(inode->i_sb); | 44 | reiserfs_write_unlock(inode->i_sb); |
45 | mutex_unlock(&inode->i_mutex); | 45 | inode_unlock(inode); |
46 | if (err < 0) | 46 | if (err < 0) |
47 | return err; | 47 | return err; |
48 | return 0; | 48 | return 0; |
diff --git a/fs/reiserfs/file.c b/fs/reiserfs/file.c index 96a1bcf33db4..9424a4ba93a9 100644 --- a/fs/reiserfs/file.c +++ b/fs/reiserfs/file.c | |||
@@ -158,7 +158,7 @@ static int reiserfs_sync_file(struct file *filp, loff_t start, loff_t end, | |||
158 | if (err) | 158 | if (err) |
159 | return err; | 159 | return err; |
160 | 160 | ||
161 | mutex_lock(&inode->i_mutex); | 161 | inode_lock(inode); |
162 | BUG_ON(!S_ISREG(inode->i_mode)); | 162 | BUG_ON(!S_ISREG(inode->i_mode)); |
163 | err = sync_mapping_buffers(inode->i_mapping); | 163 | err = sync_mapping_buffers(inode->i_mapping); |
164 | reiserfs_write_lock(inode->i_sb); | 164 | reiserfs_write_lock(inode->i_sb); |
@@ -166,7 +166,7 @@ static int reiserfs_sync_file(struct file *filp, loff_t start, loff_t end, | |||
166 | reiserfs_write_unlock(inode->i_sb); | 166 | reiserfs_write_unlock(inode->i_sb); |
167 | if (barrier_done != 1 && reiserfs_barrier_flush(inode->i_sb)) | 167 | if (barrier_done != 1 && reiserfs_barrier_flush(inode->i_sb)) |
168 | blkdev_issue_flush(inode->i_sb->s_bdev, GFP_KERNEL, NULL); | 168 | blkdev_issue_flush(inode->i_sb->s_bdev, GFP_KERNEL, NULL); |
169 | mutex_unlock(&inode->i_mutex); | 169 | inode_unlock(inode); |
170 | if (barrier_done < 0) | 170 | if (barrier_done < 0) |
171 | return barrier_done; | 171 | return barrier_done; |
172 | return (err < 0) ? -EIO : 0; | 172 | return (err < 0) ? -EIO : 0; |
diff --git a/fs/reiserfs/ioctl.c b/fs/reiserfs/ioctl.c index 6ec8a30a0911..036a1fc0a8c3 100644 --- a/fs/reiserfs/ioctl.c +++ b/fs/reiserfs/ioctl.c | |||
@@ -224,7 +224,7 @@ out_unlock: | |||
224 | page_cache_release(page); | 224 | page_cache_release(page); |
225 | 225 | ||
226 | out: | 226 | out: |
227 | mutex_unlock(&inode->i_mutex); | 227 | inode_unlock(inode); |
228 | reiserfs_write_unlock(inode->i_sb); | 228 | reiserfs_write_unlock(inode->i_sb); |
229 | return retval; | 229 | return retval; |
230 | } | 230 | } |
diff --git a/fs/reiserfs/xattr.c b/fs/reiserfs/xattr.c index e5ddb4e5ea94..57e0b2310532 100644 --- a/fs/reiserfs/xattr.c +++ b/fs/reiserfs/xattr.c | |||
@@ -64,14 +64,14 @@ | |||
64 | #ifdef CONFIG_REISERFS_FS_XATTR | 64 | #ifdef CONFIG_REISERFS_FS_XATTR |
65 | static int xattr_create(struct inode *dir, struct dentry *dentry, int mode) | 65 | static int xattr_create(struct inode *dir, struct dentry *dentry, int mode) |
66 | { | 66 | { |
67 | BUG_ON(!mutex_is_locked(&dir->i_mutex)); | 67 | BUG_ON(!inode_is_locked(dir)); |
68 | return dir->i_op->create(dir, dentry, mode, true); | 68 | return dir->i_op->create(dir, dentry, mode, true); |
69 | } | 69 | } |
70 | #endif | 70 | #endif |
71 | 71 | ||
72 | static int xattr_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) | 72 | static int xattr_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) |
73 | { | 73 | { |
74 | BUG_ON(!mutex_is_locked(&dir->i_mutex)); | 74 | BUG_ON(!inode_is_locked(dir)); |
75 | return dir->i_op->mkdir(dir, dentry, mode); | 75 | return dir->i_op->mkdir(dir, dentry, mode); |
76 | } | 76 | } |
77 | 77 | ||
@@ -85,11 +85,11 @@ static int xattr_unlink(struct inode *dir, struct dentry *dentry) | |||
85 | { | 85 | { |
86 | int error; | 86 | int error; |
87 | 87 | ||
88 | BUG_ON(!mutex_is_locked(&dir->i_mutex)); | 88 | BUG_ON(!inode_is_locked(dir)); |
89 | 89 | ||
90 | mutex_lock_nested(&d_inode(dentry)->i_mutex, I_MUTEX_CHILD); | 90 | inode_lock_nested(d_inode(dentry), I_MUTEX_CHILD); |
91 | error = dir->i_op->unlink(dir, dentry); | 91 | error = dir->i_op->unlink(dir, dentry); |
92 | mutex_unlock(&d_inode(dentry)->i_mutex); | 92 | inode_unlock(d_inode(dentry)); |
93 | 93 | ||
94 | if (!error) | 94 | if (!error) |
95 | d_delete(dentry); | 95 | d_delete(dentry); |
@@ -100,13 +100,13 @@ static int xattr_rmdir(struct inode *dir, struct dentry *dentry) | |||
100 | { | 100 | { |
101 | int error; | 101 | int error; |
102 | 102 | ||
103 | BUG_ON(!mutex_is_locked(&dir->i_mutex)); | 103 | BUG_ON(!inode_is_locked(dir)); |
104 | 104 | ||
105 | mutex_lock_nested(&d_inode(dentry)->i_mutex, I_MUTEX_CHILD); | 105 | inode_lock_nested(d_inode(dentry), I_MUTEX_CHILD); |
106 | error = dir->i_op->rmdir(dir, dentry); | 106 | error = dir->i_op->rmdir(dir, dentry); |
107 | if (!error) | 107 | if (!error) |
108 | d_inode(dentry)->i_flags |= S_DEAD; | 108 | d_inode(dentry)->i_flags |= S_DEAD; |
109 | mutex_unlock(&d_inode(dentry)->i_mutex); | 109 | inode_unlock(d_inode(dentry)); |
110 | if (!error) | 110 | if (!error) |
111 | d_delete(dentry); | 111 | d_delete(dentry); |
112 | 112 | ||
@@ -123,7 +123,7 @@ static struct dentry *open_xa_root(struct super_block *sb, int flags) | |||
123 | if (d_really_is_negative(privroot)) | 123 | if (d_really_is_negative(privroot)) |
124 | return ERR_PTR(-ENODATA); | 124 | return ERR_PTR(-ENODATA); |
125 | 125 | ||
126 | mutex_lock_nested(&d_inode(privroot)->i_mutex, I_MUTEX_XATTR); | 126 | inode_lock_nested(d_inode(privroot), I_MUTEX_XATTR); |
127 | 127 | ||
128 | xaroot = dget(REISERFS_SB(sb)->xattr_root); | 128 | xaroot = dget(REISERFS_SB(sb)->xattr_root); |
129 | if (!xaroot) | 129 | if (!xaroot) |
@@ -139,7 +139,7 @@ static struct dentry *open_xa_root(struct super_block *sb, int flags) | |||
139 | } | 139 | } |
140 | } | 140 | } |
141 | 141 | ||
142 | mutex_unlock(&d_inode(privroot)->i_mutex); | 142 | inode_unlock(d_inode(privroot)); |
143 | return xaroot; | 143 | return xaroot; |
144 | } | 144 | } |
145 | 145 | ||
@@ -156,7 +156,7 @@ static struct dentry *open_xa_dir(const struct inode *inode, int flags) | |||
156 | le32_to_cpu(INODE_PKEY(inode)->k_objectid), | 156 | le32_to_cpu(INODE_PKEY(inode)->k_objectid), |
157 | inode->i_generation); | 157 | inode->i_generation); |
158 | 158 | ||
159 | mutex_lock_nested(&d_inode(xaroot)->i_mutex, I_MUTEX_XATTR); | 159 | inode_lock_nested(d_inode(xaroot), I_MUTEX_XATTR); |
160 | 160 | ||
161 | xadir = lookup_one_len(namebuf, xaroot, strlen(namebuf)); | 161 | xadir = lookup_one_len(namebuf, xaroot, strlen(namebuf)); |
162 | if (!IS_ERR(xadir) && d_really_is_negative(xadir)) { | 162 | if (!IS_ERR(xadir) && d_really_is_negative(xadir)) { |
@@ -170,7 +170,7 @@ static struct dentry *open_xa_dir(const struct inode *inode, int flags) | |||
170 | } | 170 | } |
171 | } | 171 | } |
172 | 172 | ||
173 | mutex_unlock(&d_inode(xaroot)->i_mutex); | 173 | inode_unlock(d_inode(xaroot)); |
174 | dput(xaroot); | 174 | dput(xaroot); |
175 | return xadir; | 175 | return xadir; |
176 | } | 176 | } |
@@ -195,7 +195,7 @@ fill_with_dentries(struct dir_context *ctx, const char *name, int namelen, | |||
195 | container_of(ctx, struct reiserfs_dentry_buf, ctx); | 195 | container_of(ctx, struct reiserfs_dentry_buf, ctx); |
196 | struct dentry *dentry; | 196 | struct dentry *dentry; |
197 | 197 | ||
198 | WARN_ON_ONCE(!mutex_is_locked(&d_inode(dbuf->xadir)->i_mutex)); | 198 | WARN_ON_ONCE(!inode_is_locked(d_inode(dbuf->xadir))); |
199 | 199 | ||
200 | if (dbuf->count == ARRAY_SIZE(dbuf->dentries)) | 200 | if (dbuf->count == ARRAY_SIZE(dbuf->dentries)) |
201 | return -ENOSPC; | 201 | return -ENOSPC; |
@@ -254,7 +254,7 @@ static int reiserfs_for_each_xattr(struct inode *inode, | |||
254 | goto out_dir; | 254 | goto out_dir; |
255 | } | 255 | } |
256 | 256 | ||
257 | mutex_lock_nested(&d_inode(dir)->i_mutex, I_MUTEX_XATTR); | 257 | inode_lock_nested(d_inode(dir), I_MUTEX_XATTR); |
258 | 258 | ||
259 | buf.xadir = dir; | 259 | buf.xadir = dir; |
260 | while (1) { | 260 | while (1) { |
@@ -276,7 +276,7 @@ static int reiserfs_for_each_xattr(struct inode *inode, | |||
276 | break; | 276 | break; |
277 | buf.count = 0; | 277 | buf.count = 0; |
278 | } | 278 | } |
279 | mutex_unlock(&d_inode(dir)->i_mutex); | 279 | inode_unlock(d_inode(dir)); |
280 | 280 | ||
281 | cleanup_dentry_buf(&buf); | 281 | cleanup_dentry_buf(&buf); |
282 | 282 | ||
@@ -298,13 +298,13 @@ static int reiserfs_for_each_xattr(struct inode *inode, | |||
298 | if (!err) { | 298 | if (!err) { |
299 | int jerror; | 299 | int jerror; |
300 | 300 | ||
301 | mutex_lock_nested(&d_inode(dir->d_parent)->i_mutex, | 301 | inode_lock_nested(d_inode(dir->d_parent), |
302 | I_MUTEX_XATTR); | 302 | I_MUTEX_XATTR); |
303 | err = action(dir, data); | 303 | err = action(dir, data); |
304 | reiserfs_write_lock(inode->i_sb); | 304 | reiserfs_write_lock(inode->i_sb); |
305 | jerror = journal_end(&th); | 305 | jerror = journal_end(&th); |
306 | reiserfs_write_unlock(inode->i_sb); | 306 | reiserfs_write_unlock(inode->i_sb); |
307 | mutex_unlock(&d_inode(dir->d_parent)->i_mutex); | 307 | inode_unlock(d_inode(dir->d_parent)); |
308 | err = jerror ?: err; | 308 | err = jerror ?: err; |
309 | } | 309 | } |
310 | } | 310 | } |
@@ -384,7 +384,7 @@ static struct dentry *xattr_lookup(struct inode *inode, const char *name, | |||
384 | if (IS_ERR(xadir)) | 384 | if (IS_ERR(xadir)) |
385 | return ERR_CAST(xadir); | 385 | return ERR_CAST(xadir); |
386 | 386 | ||
387 | mutex_lock_nested(&d_inode(xadir)->i_mutex, I_MUTEX_XATTR); | 387 | inode_lock_nested(d_inode(xadir), I_MUTEX_XATTR); |
388 | xafile = lookup_one_len(name, xadir, strlen(name)); | 388 | xafile = lookup_one_len(name, xadir, strlen(name)); |
389 | if (IS_ERR(xafile)) { | 389 | if (IS_ERR(xafile)) { |
390 | err = PTR_ERR(xafile); | 390 | err = PTR_ERR(xafile); |
@@ -404,7 +404,7 @@ static struct dentry *xattr_lookup(struct inode *inode, const char *name, | |||
404 | if (err) | 404 | if (err) |
405 | dput(xafile); | 405 | dput(xafile); |
406 | out: | 406 | out: |
407 | mutex_unlock(&d_inode(xadir)->i_mutex); | 407 | inode_unlock(d_inode(xadir)); |
408 | dput(xadir); | 408 | dput(xadir); |
409 | if (err) | 409 | if (err) |
410 | return ERR_PTR(err); | 410 | return ERR_PTR(err); |
@@ -469,7 +469,7 @@ static int lookup_and_delete_xattr(struct inode *inode, const char *name) | |||
469 | if (IS_ERR(xadir)) | 469 | if (IS_ERR(xadir)) |
470 | return PTR_ERR(xadir); | 470 | return PTR_ERR(xadir); |
471 | 471 | ||
472 | mutex_lock_nested(&d_inode(xadir)->i_mutex, I_MUTEX_XATTR); | 472 | inode_lock_nested(d_inode(xadir), I_MUTEX_XATTR); |
473 | dentry = lookup_one_len(name, xadir, strlen(name)); | 473 | dentry = lookup_one_len(name, xadir, strlen(name)); |
474 | if (IS_ERR(dentry)) { | 474 | if (IS_ERR(dentry)) { |
475 | err = PTR_ERR(dentry); | 475 | err = PTR_ERR(dentry); |
@@ -483,7 +483,7 @@ static int lookup_and_delete_xattr(struct inode *inode, const char *name) | |||
483 | 483 | ||
484 | dput(dentry); | 484 | dput(dentry); |
485 | out_dput: | 485 | out_dput: |
486 | mutex_unlock(&d_inode(xadir)->i_mutex); | 486 | inode_unlock(d_inode(xadir)); |
487 | dput(xadir); | 487 | dput(xadir); |
488 | return err; | 488 | return err; |
489 | } | 489 | } |
@@ -580,11 +580,11 @@ reiserfs_xattr_set_handle(struct reiserfs_transaction_handle *th, | |||
580 | .ia_valid = ATTR_SIZE | ATTR_CTIME, | 580 | .ia_valid = ATTR_SIZE | ATTR_CTIME, |
581 | }; | 581 | }; |
582 | 582 | ||
583 | mutex_lock_nested(&d_inode(dentry)->i_mutex, I_MUTEX_XATTR); | 583 | inode_lock_nested(d_inode(dentry), I_MUTEX_XATTR); |
584 | inode_dio_wait(d_inode(dentry)); | 584 | inode_dio_wait(d_inode(dentry)); |
585 | 585 | ||
586 | err = reiserfs_setattr(dentry, &newattrs); | 586 | err = reiserfs_setattr(dentry, &newattrs); |
587 | mutex_unlock(&d_inode(dentry)->i_mutex); | 587 | inode_unlock(d_inode(dentry)); |
588 | } else | 588 | } else |
589 | update_ctime(inode); | 589 | update_ctime(inode); |
590 | out_unlock: | 590 | out_unlock: |
@@ -888,9 +888,9 @@ ssize_t reiserfs_listxattr(struct dentry * dentry, char *buffer, size_t size) | |||
888 | goto out; | 888 | goto out; |
889 | } | 889 | } |
890 | 890 | ||
891 | mutex_lock_nested(&d_inode(dir)->i_mutex, I_MUTEX_XATTR); | 891 | inode_lock_nested(d_inode(dir), I_MUTEX_XATTR); |
892 | err = reiserfs_readdir_inode(d_inode(dir), &buf.ctx); | 892 | err = reiserfs_readdir_inode(d_inode(dir), &buf.ctx); |
893 | mutex_unlock(&d_inode(dir)->i_mutex); | 893 | inode_unlock(d_inode(dir)); |
894 | 894 | ||
895 | if (!err) | 895 | if (!err) |
896 | err = buf.pos; | 896 | err = buf.pos; |
@@ -905,7 +905,7 @@ static int create_privroot(struct dentry *dentry) | |||
905 | int err; | 905 | int err; |
906 | struct inode *inode = d_inode(dentry->d_parent); | 906 | struct inode *inode = d_inode(dentry->d_parent); |
907 | 907 | ||
908 | WARN_ON_ONCE(!mutex_is_locked(&inode->i_mutex)); | 908 | WARN_ON_ONCE(!inode_is_locked(inode)); |
909 | 909 | ||
910 | err = xattr_mkdir(inode, dentry, 0700); | 910 | err = xattr_mkdir(inode, dentry, 0700); |
911 | if (err || d_really_is_negative(dentry)) { | 911 | if (err || d_really_is_negative(dentry)) { |
@@ -995,7 +995,7 @@ int reiserfs_lookup_privroot(struct super_block *s) | |||
995 | int err = 0; | 995 | int err = 0; |
996 | 996 | ||
997 | /* If we don't have the privroot located yet - go find it */ | 997 | /* If we don't have the privroot located yet - go find it */ |
998 | mutex_lock(&d_inode(s->s_root)->i_mutex); | 998 | inode_lock(d_inode(s->s_root)); |
999 | dentry = lookup_one_len(PRIVROOT_NAME, s->s_root, | 999 | dentry = lookup_one_len(PRIVROOT_NAME, s->s_root, |
1000 | strlen(PRIVROOT_NAME)); | 1000 | strlen(PRIVROOT_NAME)); |
1001 | if (!IS_ERR(dentry)) { | 1001 | if (!IS_ERR(dentry)) { |
@@ -1005,7 +1005,7 @@ int reiserfs_lookup_privroot(struct super_block *s) | |||
1005 | d_inode(dentry)->i_flags |= S_PRIVATE; | 1005 | d_inode(dentry)->i_flags |= S_PRIVATE; |
1006 | } else | 1006 | } else |
1007 | err = PTR_ERR(dentry); | 1007 | err = PTR_ERR(dentry); |
1008 | mutex_unlock(&d_inode(s->s_root)->i_mutex); | 1008 | inode_unlock(d_inode(s->s_root)); |
1009 | 1009 | ||
1010 | return err; | 1010 | return err; |
1011 | } | 1011 | } |
@@ -1025,14 +1025,14 @@ int reiserfs_xattr_init(struct super_block *s, int mount_flags) | |||
1025 | goto error; | 1025 | goto error; |
1026 | 1026 | ||
1027 | if (d_really_is_negative(privroot) && !(mount_flags & MS_RDONLY)) { | 1027 | if (d_really_is_negative(privroot) && !(mount_flags & MS_RDONLY)) { |
1028 | mutex_lock(&d_inode(s->s_root)->i_mutex); | 1028 | inode_lock(d_inode(s->s_root)); |
1029 | err = create_privroot(REISERFS_SB(s)->priv_root); | 1029 | err = create_privroot(REISERFS_SB(s)->priv_root); |
1030 | mutex_unlock(&d_inode(s->s_root)->i_mutex); | 1030 | inode_unlock(d_inode(s->s_root)); |
1031 | } | 1031 | } |
1032 | 1032 | ||
1033 | if (d_really_is_positive(privroot)) { | 1033 | if (d_really_is_positive(privroot)) { |
1034 | s->s_xattr = reiserfs_xattr_handlers; | 1034 | s->s_xattr = reiserfs_xattr_handlers; |
1035 | mutex_lock(&d_inode(privroot)->i_mutex); | 1035 | inode_lock(d_inode(privroot)); |
1036 | if (!REISERFS_SB(s)->xattr_root) { | 1036 | if (!REISERFS_SB(s)->xattr_root) { |
1037 | struct dentry *dentry; | 1037 | struct dentry *dentry; |
1038 | 1038 | ||
@@ -1043,7 +1043,7 @@ int reiserfs_xattr_init(struct super_block *s, int mount_flags) | |||
1043 | else | 1043 | else |
1044 | err = PTR_ERR(dentry); | 1044 | err = PTR_ERR(dentry); |
1045 | } | 1045 | } |
1046 | mutex_unlock(&d_inode(privroot)->i_mutex); | 1046 | inode_unlock(d_inode(privroot)); |
1047 | } | 1047 | } |
1048 | 1048 | ||
1049 | error: | 1049 | error: |
diff --git a/fs/tracefs/inode.c b/fs/tracefs/inode.c index c66f2423e1f5..4a0e48f92104 100644 --- a/fs/tracefs/inode.c +++ b/fs/tracefs/inode.c | |||
@@ -84,9 +84,9 @@ static int tracefs_syscall_mkdir(struct inode *inode, struct dentry *dentry, umo | |||
84 | * the files within the tracefs system. It is up to the individual | 84 | * the files within the tracefs system. It is up to the individual |
85 | * mkdir routine to handle races. | 85 | * mkdir routine to handle races. |
86 | */ | 86 | */ |
87 | mutex_unlock(&inode->i_mutex); | 87 | inode_unlock(inode); |
88 | ret = tracefs_ops.mkdir(name); | 88 | ret = tracefs_ops.mkdir(name); |
89 | mutex_lock(&inode->i_mutex); | 89 | inode_lock(inode); |
90 | 90 | ||
91 | kfree(name); | 91 | kfree(name); |
92 | 92 | ||
@@ -109,13 +109,13 @@ static int tracefs_syscall_rmdir(struct inode *inode, struct dentry *dentry) | |||
109 | * This time we need to unlock not only the parent (inode) but | 109 | * This time we need to unlock not only the parent (inode) but |
110 | * also the directory that is being deleted. | 110 | * also the directory that is being deleted. |
111 | */ | 111 | */ |
112 | mutex_unlock(&inode->i_mutex); | 112 | inode_unlock(inode); |
113 | mutex_unlock(&dentry->d_inode->i_mutex); | 113 | inode_unlock(dentry->d_inode); |
114 | 114 | ||
115 | ret = tracefs_ops.rmdir(name); | 115 | ret = tracefs_ops.rmdir(name); |
116 | 116 | ||
117 | mutex_lock_nested(&inode->i_mutex, I_MUTEX_PARENT); | 117 | inode_lock_nested(inode, I_MUTEX_PARENT); |
118 | mutex_lock(&dentry->d_inode->i_mutex); | 118 | inode_lock(dentry->d_inode); |
119 | 119 | ||
120 | kfree(name); | 120 | kfree(name); |
121 | 121 | ||
@@ -334,7 +334,7 @@ static struct dentry *start_creating(const char *name, struct dentry *parent) | |||
334 | if (!parent) | 334 | if (!parent) |
335 | parent = tracefs_mount->mnt_root; | 335 | parent = tracefs_mount->mnt_root; |
336 | 336 | ||
337 | mutex_lock(&parent->d_inode->i_mutex); | 337 | inode_lock(parent->d_inode); |
338 | dentry = lookup_one_len(name, parent, strlen(name)); | 338 | dentry = lookup_one_len(name, parent, strlen(name)); |
339 | if (!IS_ERR(dentry) && dentry->d_inode) { | 339 | if (!IS_ERR(dentry) && dentry->d_inode) { |
340 | dput(dentry); | 340 | dput(dentry); |
@@ -342,7 +342,7 @@ static struct dentry *start_creating(const char *name, struct dentry *parent) | |||
342 | } | 342 | } |
343 | 343 | ||
344 | if (IS_ERR(dentry)) { | 344 | if (IS_ERR(dentry)) { |
345 | mutex_unlock(&parent->d_inode->i_mutex); | 345 | inode_unlock(parent->d_inode); |
346 | simple_release_fs(&tracefs_mount, &tracefs_mount_count); | 346 | simple_release_fs(&tracefs_mount, &tracefs_mount_count); |
347 | } | 347 | } |
348 | 348 | ||
@@ -351,7 +351,7 @@ static struct dentry *start_creating(const char *name, struct dentry *parent) | |||
351 | 351 | ||
352 | static struct dentry *failed_creating(struct dentry *dentry) | 352 | static struct dentry *failed_creating(struct dentry *dentry) |
353 | { | 353 | { |
354 | mutex_unlock(&dentry->d_parent->d_inode->i_mutex); | 354 | inode_unlock(dentry->d_parent->d_inode); |
355 | dput(dentry); | 355 | dput(dentry); |
356 | simple_release_fs(&tracefs_mount, &tracefs_mount_count); | 356 | simple_release_fs(&tracefs_mount, &tracefs_mount_count); |
357 | return NULL; | 357 | return NULL; |
@@ -359,7 +359,7 @@ static struct dentry *failed_creating(struct dentry *dentry) | |||
359 | 359 | ||
360 | static struct dentry *end_creating(struct dentry *dentry) | 360 | static struct dentry *end_creating(struct dentry *dentry) |
361 | { | 361 | { |
362 | mutex_unlock(&dentry->d_parent->d_inode->i_mutex); | 362 | inode_unlock(dentry->d_parent->d_inode); |
363 | return dentry; | 363 | return dentry; |
364 | } | 364 | } |
365 | 365 | ||
@@ -544,9 +544,9 @@ void tracefs_remove(struct dentry *dentry) | |||
544 | if (!parent || !parent->d_inode) | 544 | if (!parent || !parent->d_inode) |
545 | return; | 545 | return; |
546 | 546 | ||
547 | mutex_lock(&parent->d_inode->i_mutex); | 547 | inode_lock(parent->d_inode); |
548 | ret = __tracefs_remove(dentry, parent); | 548 | ret = __tracefs_remove(dentry, parent); |
549 | mutex_unlock(&parent->d_inode->i_mutex); | 549 | inode_unlock(parent->d_inode); |
550 | if (!ret) | 550 | if (!ret) |
551 | simple_release_fs(&tracefs_mount, &tracefs_mount_count); | 551 | simple_release_fs(&tracefs_mount, &tracefs_mount_count); |
552 | } | 552 | } |
@@ -572,7 +572,7 @@ void tracefs_remove_recursive(struct dentry *dentry) | |||
572 | 572 | ||
573 | parent = dentry; | 573 | parent = dentry; |
574 | down: | 574 | down: |
575 | mutex_lock(&parent->d_inode->i_mutex); | 575 | inode_lock(parent->d_inode); |
576 | loop: | 576 | loop: |
577 | /* | 577 | /* |
578 | * The parent->d_subdirs is protected by the d_lock. Outside that | 578 | * The parent->d_subdirs is protected by the d_lock. Outside that |
@@ -587,7 +587,7 @@ void tracefs_remove_recursive(struct dentry *dentry) | |||
587 | /* perhaps simple_empty(child) makes more sense */ | 587 | /* perhaps simple_empty(child) makes more sense */ |
588 | if (!list_empty(&child->d_subdirs)) { | 588 | if (!list_empty(&child->d_subdirs)) { |
589 | spin_unlock(&parent->d_lock); | 589 | spin_unlock(&parent->d_lock); |
590 | mutex_unlock(&parent->d_inode->i_mutex); | 590 | inode_unlock(parent->d_inode); |
591 | parent = child; | 591 | parent = child; |
592 | goto down; | 592 | goto down; |
593 | } | 593 | } |
@@ -608,10 +608,10 @@ void tracefs_remove_recursive(struct dentry *dentry) | |||
608 | } | 608 | } |
609 | spin_unlock(&parent->d_lock); | 609 | spin_unlock(&parent->d_lock); |
610 | 610 | ||
611 | mutex_unlock(&parent->d_inode->i_mutex); | 611 | inode_unlock(parent->d_inode); |
612 | child = parent; | 612 | child = parent; |
613 | parent = parent->d_parent; | 613 | parent = parent->d_parent; |
614 | mutex_lock(&parent->d_inode->i_mutex); | 614 | inode_lock(parent->d_inode); |
615 | 615 | ||
616 | if (child != dentry) | 616 | if (child != dentry) |
617 | /* go up */ | 617 | /* go up */ |
@@ -619,7 +619,7 @@ void tracefs_remove_recursive(struct dentry *dentry) | |||
619 | 619 | ||
620 | if (!__tracefs_remove(child, parent)) | 620 | if (!__tracefs_remove(child, parent)) |
621 | simple_release_fs(&tracefs_mount, &tracefs_mount_count); | 621 | simple_release_fs(&tracefs_mount, &tracefs_mount_count); |
622 | mutex_unlock(&parent->d_inode->i_mutex); | 622 | inode_unlock(parent->d_inode); |
623 | } | 623 | } |
624 | 624 | ||
625 | /** | 625 | /** |
diff --git a/fs/ubifs/dir.c b/fs/ubifs/dir.c index e49bd2808bf3..795992a8321e 100644 --- a/fs/ubifs/dir.c +++ b/fs/ubifs/dir.c | |||
@@ -515,8 +515,8 @@ static int ubifs_link(struct dentry *old_dentry, struct inode *dir, | |||
515 | dbg_gen("dent '%pd' to ino %lu (nlink %d) in dir ino %lu", | 515 | dbg_gen("dent '%pd' to ino %lu (nlink %d) in dir ino %lu", |
516 | dentry, inode->i_ino, | 516 | dentry, inode->i_ino, |
517 | inode->i_nlink, dir->i_ino); | 517 | inode->i_nlink, dir->i_ino); |
518 | ubifs_assert(mutex_is_locked(&dir->i_mutex)); | 518 | ubifs_assert(inode_is_locked(dir)); |
519 | ubifs_assert(mutex_is_locked(&inode->i_mutex)); | 519 | ubifs_assert(inode_is_locked(inode)); |
520 | 520 | ||
521 | err = dbg_check_synced_i_size(c, inode); | 521 | err = dbg_check_synced_i_size(c, inode); |
522 | if (err) | 522 | if (err) |
@@ -572,8 +572,8 @@ static int ubifs_unlink(struct inode *dir, struct dentry *dentry) | |||
572 | dbg_gen("dent '%pd' from ino %lu (nlink %d) in dir ino %lu", | 572 | dbg_gen("dent '%pd' from ino %lu (nlink %d) in dir ino %lu", |
573 | dentry, inode->i_ino, | 573 | dentry, inode->i_ino, |
574 | inode->i_nlink, dir->i_ino); | 574 | inode->i_nlink, dir->i_ino); |
575 | ubifs_assert(mutex_is_locked(&dir->i_mutex)); | 575 | ubifs_assert(inode_is_locked(dir)); |
576 | ubifs_assert(mutex_is_locked(&inode->i_mutex)); | 576 | ubifs_assert(inode_is_locked(inode)); |
577 | err = dbg_check_synced_i_size(c, inode); | 577 | err = dbg_check_synced_i_size(c, inode); |
578 | if (err) | 578 | if (err) |
579 | return err; | 579 | return err; |
@@ -661,8 +661,8 @@ static int ubifs_rmdir(struct inode *dir, struct dentry *dentry) | |||
661 | 661 | ||
662 | dbg_gen("directory '%pd', ino %lu in dir ino %lu", dentry, | 662 | dbg_gen("directory '%pd', ino %lu in dir ino %lu", dentry, |
663 | inode->i_ino, dir->i_ino); | 663 | inode->i_ino, dir->i_ino); |
664 | ubifs_assert(mutex_is_locked(&dir->i_mutex)); | 664 | ubifs_assert(inode_is_locked(dir)); |
665 | ubifs_assert(mutex_is_locked(&inode->i_mutex)); | 665 | ubifs_assert(inode_is_locked(inode)); |
666 | err = check_dir_empty(c, d_inode(dentry)); | 666 | err = check_dir_empty(c, d_inode(dentry)); |
667 | if (err) | 667 | if (err) |
668 | return err; | 668 | return err; |
@@ -996,10 +996,10 @@ static int ubifs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
996 | dbg_gen("dent '%pd' ino %lu in dir ino %lu to dent '%pd' in dir ino %lu", | 996 | dbg_gen("dent '%pd' ino %lu in dir ino %lu to dent '%pd' in dir ino %lu", |
997 | old_dentry, old_inode->i_ino, old_dir->i_ino, | 997 | old_dentry, old_inode->i_ino, old_dir->i_ino, |
998 | new_dentry, new_dir->i_ino); | 998 | new_dentry, new_dir->i_ino); |
999 | ubifs_assert(mutex_is_locked(&old_dir->i_mutex)); | 999 | ubifs_assert(inode_is_locked(old_dir)); |
1000 | ubifs_assert(mutex_is_locked(&new_dir->i_mutex)); | 1000 | ubifs_assert(inode_is_locked(new_dir)); |
1001 | if (unlink) | 1001 | if (unlink) |
1002 | ubifs_assert(mutex_is_locked(&new_inode->i_mutex)); | 1002 | ubifs_assert(inode_is_locked(new_inode)); |
1003 | 1003 | ||
1004 | 1004 | ||
1005 | if (unlink && is_dir) { | 1005 | if (unlink && is_dir) { |
diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c index eff62801acbf..065c88f8e4b8 100644 --- a/fs/ubifs/file.c +++ b/fs/ubifs/file.c | |||
@@ -1317,7 +1317,7 @@ int ubifs_fsync(struct file *file, loff_t start, loff_t end, int datasync) | |||
1317 | err = filemap_write_and_wait_range(inode->i_mapping, start, end); | 1317 | err = filemap_write_and_wait_range(inode->i_mapping, start, end); |
1318 | if (err) | 1318 | if (err) |
1319 | return err; | 1319 | return err; |
1320 | mutex_lock(&inode->i_mutex); | 1320 | inode_lock(inode); |
1321 | 1321 | ||
1322 | /* Synchronize the inode unless this is a 'datasync()' call. */ | 1322 | /* Synchronize the inode unless this is a 'datasync()' call. */ |
1323 | if (!datasync || (inode->i_state & I_DIRTY_DATASYNC)) { | 1323 | if (!datasync || (inode->i_state & I_DIRTY_DATASYNC)) { |
@@ -1332,7 +1332,7 @@ int ubifs_fsync(struct file *file, loff_t start, loff_t end, int datasync) | |||
1332 | */ | 1332 | */ |
1333 | err = ubifs_sync_wbufs_by_inode(c, inode); | 1333 | err = ubifs_sync_wbufs_by_inode(c, inode); |
1334 | out: | 1334 | out: |
1335 | mutex_unlock(&inode->i_mutex); | 1335 | inode_unlock(inode); |
1336 | return err; | 1336 | return err; |
1337 | } | 1337 | } |
1338 | 1338 | ||
diff --git a/fs/ubifs/xattr.c b/fs/ubifs/xattr.c index e53292d0c21b..c7f4d434d098 100644 --- a/fs/ubifs/xattr.c +++ b/fs/ubifs/xattr.c | |||
@@ -313,7 +313,7 @@ static int setxattr(struct inode *host, const char *name, const void *value, | |||
313 | union ubifs_key key; | 313 | union ubifs_key key; |
314 | int err, type; | 314 | int err, type; |
315 | 315 | ||
316 | ubifs_assert(mutex_is_locked(&host->i_mutex)); | 316 | ubifs_assert(inode_is_locked(host)); |
317 | 317 | ||
318 | if (size > UBIFS_MAX_INO_DATA) | 318 | if (size > UBIFS_MAX_INO_DATA) |
319 | return -ERANGE; | 319 | return -ERANGE; |
@@ -550,7 +550,7 @@ int ubifs_removexattr(struct dentry *dentry, const char *name) | |||
550 | 550 | ||
551 | dbg_gen("xattr '%s', ino %lu ('%pd')", name, | 551 | dbg_gen("xattr '%s', ino %lu ('%pd')", name, |
552 | host->i_ino, dentry); | 552 | host->i_ino, dentry); |
553 | ubifs_assert(mutex_is_locked(&host->i_mutex)); | 553 | ubifs_assert(inode_is_locked(host)); |
554 | 554 | ||
555 | err = check_namespace(&nm); | 555 | err = check_namespace(&nm); |
556 | if (err < 0) | 556 | if (err < 0) |
diff --git a/fs/udf/file.c b/fs/udf/file.c index bddf3d071dae..1af98963d860 100644 --- a/fs/udf/file.c +++ b/fs/udf/file.c | |||
@@ -122,7 +122,7 @@ static ssize_t udf_file_write_iter(struct kiocb *iocb, struct iov_iter *from) | |||
122 | struct udf_inode_info *iinfo = UDF_I(inode); | 122 | struct udf_inode_info *iinfo = UDF_I(inode); |
123 | int err; | 123 | int err; |
124 | 124 | ||
125 | mutex_lock(&inode->i_mutex); | 125 | inode_lock(inode); |
126 | 126 | ||
127 | retval = generic_write_checks(iocb, from); | 127 | retval = generic_write_checks(iocb, from); |
128 | if (retval <= 0) | 128 | if (retval <= 0) |
@@ -136,7 +136,7 @@ static ssize_t udf_file_write_iter(struct kiocb *iocb, struct iov_iter *from) | |||
136 | (udf_file_entry_alloc_offset(inode) + end)) { | 136 | (udf_file_entry_alloc_offset(inode) + end)) { |
137 | err = udf_expand_file_adinicb(inode); | 137 | err = udf_expand_file_adinicb(inode); |
138 | if (err) { | 138 | if (err) { |
139 | mutex_unlock(&inode->i_mutex); | 139 | inode_unlock(inode); |
140 | udf_debug("udf_expand_adinicb: err=%d\n", err); | 140 | udf_debug("udf_expand_adinicb: err=%d\n", err); |
141 | return err; | 141 | return err; |
142 | } | 142 | } |
@@ -149,7 +149,7 @@ static ssize_t udf_file_write_iter(struct kiocb *iocb, struct iov_iter *from) | |||
149 | 149 | ||
150 | retval = __generic_file_write_iter(iocb, from); | 150 | retval = __generic_file_write_iter(iocb, from); |
151 | out: | 151 | out: |
152 | mutex_unlock(&inode->i_mutex); | 152 | inode_unlock(inode); |
153 | 153 | ||
154 | if (retval > 0) { | 154 | if (retval > 0) { |
155 | mark_inode_dirty(inode); | 155 | mark_inode_dirty(inode); |
@@ -223,12 +223,12 @@ static int udf_release_file(struct inode *inode, struct file *filp) | |||
223 | * Grab i_mutex to avoid races with writes changing i_size | 223 | * Grab i_mutex to avoid races with writes changing i_size |
224 | * while we are running. | 224 | * while we are running. |
225 | */ | 225 | */ |
226 | mutex_lock(&inode->i_mutex); | 226 | inode_lock(inode); |
227 | down_write(&UDF_I(inode)->i_data_sem); | 227 | down_write(&UDF_I(inode)->i_data_sem); |
228 | udf_discard_prealloc(inode); | 228 | udf_discard_prealloc(inode); |
229 | udf_truncate_tail_extent(inode); | 229 | udf_truncate_tail_extent(inode); |
230 | up_write(&UDF_I(inode)->i_data_sem); | 230 | up_write(&UDF_I(inode)->i_data_sem); |
231 | mutex_unlock(&inode->i_mutex); | 231 | inode_unlock(inode); |
232 | } | 232 | } |
233 | return 0; | 233 | return 0; |
234 | } | 234 | } |
diff --git a/fs/udf/inode.c b/fs/udf/inode.c index 87dc16d15572..166d3ed32c39 100644 --- a/fs/udf/inode.c +++ b/fs/udf/inode.c | |||
@@ -262,7 +262,7 @@ int udf_expand_file_adinicb(struct inode *inode) | |||
262 | .nr_to_write = 1, | 262 | .nr_to_write = 1, |
263 | }; | 263 | }; |
264 | 264 | ||
265 | WARN_ON_ONCE(!mutex_is_locked(&inode->i_mutex)); | 265 | WARN_ON_ONCE(!inode_is_locked(inode)); |
266 | if (!iinfo->i_lenAlloc) { | 266 | if (!iinfo->i_lenAlloc) { |
267 | if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_SHORT_AD)) | 267 | if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_SHORT_AD)) |
268 | iinfo->i_alloc_type = ICBTAG_FLAG_AD_SHORT; | 268 | iinfo->i_alloc_type = ICBTAG_FLAG_AD_SHORT; |
diff --git a/fs/utimes.c b/fs/utimes.c index aa138d64560a..85c40f4f373d 100644 --- a/fs/utimes.c +++ b/fs/utimes.c | |||
@@ -103,9 +103,9 @@ static int utimes_common(struct path *path, struct timespec *times) | |||
103 | } | 103 | } |
104 | } | 104 | } |
105 | retry_deleg: | 105 | retry_deleg: |
106 | mutex_lock(&inode->i_mutex); | 106 | inode_lock(inode); |
107 | error = notify_change(path->dentry, &newattrs, &delegated_inode); | 107 | error = notify_change(path->dentry, &newattrs, &delegated_inode); |
108 | mutex_unlock(&inode->i_mutex); | 108 | inode_unlock(inode); |
109 | if (delegated_inode) { | 109 | if (delegated_inode) { |
110 | error = break_deleg_wait(&delegated_inode); | 110 | error = break_deleg_wait(&delegated_inode); |
111 | if (!error) | 111 | if (!error) |
diff --git a/fs/xattr.c b/fs/xattr.c index d5dd6c8b82a7..07d0e47f6a7f 100644 --- a/fs/xattr.c +++ b/fs/xattr.c | |||
@@ -129,7 +129,7 @@ vfs_setxattr(struct dentry *dentry, const char *name, const void *value, | |||
129 | if (error) | 129 | if (error) |
130 | return error; | 130 | return error; |
131 | 131 | ||
132 | mutex_lock(&inode->i_mutex); | 132 | inode_lock(inode); |
133 | error = security_inode_setxattr(dentry, name, value, size, flags); | 133 | error = security_inode_setxattr(dentry, name, value, size, flags); |
134 | if (error) | 134 | if (error) |
135 | goto out; | 135 | goto out; |
@@ -137,7 +137,7 @@ vfs_setxattr(struct dentry *dentry, const char *name, const void *value, | |||
137 | error = __vfs_setxattr_noperm(dentry, name, value, size, flags); | 137 | error = __vfs_setxattr_noperm(dentry, name, value, size, flags); |
138 | 138 | ||
139 | out: | 139 | out: |
140 | mutex_unlock(&inode->i_mutex); | 140 | inode_unlock(inode); |
141 | return error; | 141 | return error; |
142 | } | 142 | } |
143 | EXPORT_SYMBOL_GPL(vfs_setxattr); | 143 | EXPORT_SYMBOL_GPL(vfs_setxattr); |
@@ -277,7 +277,7 @@ vfs_removexattr(struct dentry *dentry, const char *name) | |||
277 | if (error) | 277 | if (error) |
278 | return error; | 278 | return error; |
279 | 279 | ||
280 | mutex_lock(&inode->i_mutex); | 280 | inode_lock(inode); |
281 | error = security_inode_removexattr(dentry, name); | 281 | error = security_inode_removexattr(dentry, name); |
282 | if (error) | 282 | if (error) |
283 | goto out; | 283 | goto out; |
@@ -290,7 +290,7 @@ vfs_removexattr(struct dentry *dentry, const char *name) | |||
290 | } | 290 | } |
291 | 291 | ||
292 | out: | 292 | out: |
293 | mutex_unlock(&inode->i_mutex); | 293 | inode_unlock(inode); |
294 | return error; | 294 | return error; |
295 | } | 295 | } |
296 | EXPORT_SYMBOL_GPL(vfs_removexattr); | 296 | EXPORT_SYMBOL_GPL(vfs_removexattr); |
diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c index ebe9b8290a70..bb2b8f354041 100644 --- a/fs/xfs/xfs_file.c +++ b/fs/xfs/xfs_file.c | |||
@@ -55,7 +55,7 @@ xfs_rw_ilock( | |||
55 | int type) | 55 | int type) |
56 | { | 56 | { |
57 | if (type & XFS_IOLOCK_EXCL) | 57 | if (type & XFS_IOLOCK_EXCL) |
58 | mutex_lock(&VFS_I(ip)->i_mutex); | 58 | inode_lock(VFS_I(ip)); |
59 | xfs_ilock(ip, type); | 59 | xfs_ilock(ip, type); |
60 | } | 60 | } |
61 | 61 | ||
@@ -66,7 +66,7 @@ xfs_rw_iunlock( | |||
66 | { | 66 | { |
67 | xfs_iunlock(ip, type); | 67 | xfs_iunlock(ip, type); |
68 | if (type & XFS_IOLOCK_EXCL) | 68 | if (type & XFS_IOLOCK_EXCL) |
69 | mutex_unlock(&VFS_I(ip)->i_mutex); | 69 | inode_unlock(VFS_I(ip)); |
70 | } | 70 | } |
71 | 71 | ||
72 | static inline void | 72 | static inline void |
@@ -76,7 +76,7 @@ xfs_rw_ilock_demote( | |||
76 | { | 76 | { |
77 | xfs_ilock_demote(ip, type); | 77 | xfs_ilock_demote(ip, type); |
78 | if (type & XFS_IOLOCK_EXCL) | 78 | if (type & XFS_IOLOCK_EXCL) |
79 | mutex_unlock(&VFS_I(ip)->i_mutex); | 79 | inode_unlock(VFS_I(ip)); |
80 | } | 80 | } |
81 | 81 | ||
82 | /* | 82 | /* |
diff --git a/fs/xfs/xfs_pnfs.c b/fs/xfs/xfs_pnfs.c index dc6221942b85..ade236e90bb3 100644 --- a/fs/xfs/xfs_pnfs.c +++ b/fs/xfs/xfs_pnfs.c | |||
@@ -42,11 +42,11 @@ xfs_break_layouts( | |||
42 | while ((error = break_layout(inode, false) == -EWOULDBLOCK)) { | 42 | while ((error = break_layout(inode, false) == -EWOULDBLOCK)) { |
43 | xfs_iunlock(ip, *iolock); | 43 | xfs_iunlock(ip, *iolock); |
44 | if (with_imutex && (*iolock & XFS_IOLOCK_EXCL)) | 44 | if (with_imutex && (*iolock & XFS_IOLOCK_EXCL)) |
45 | mutex_unlock(&inode->i_mutex); | 45 | inode_unlock(inode); |
46 | error = break_layout(inode, true); | 46 | error = break_layout(inode, true); |
47 | *iolock = XFS_IOLOCK_EXCL; | 47 | *iolock = XFS_IOLOCK_EXCL; |
48 | if (with_imutex) | 48 | if (with_imutex) |
49 | mutex_lock(&inode->i_mutex); | 49 | inode_lock(inode); |
50 | xfs_ilock(ip, *iolock); | 50 | xfs_ilock(ip, *iolock); |
51 | } | 51 | } |
52 | 52 | ||