aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2013-11-06 09:54:52 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2013-11-09 00:16:31 -0500
commit5a3cd99285dc793a4022fa75ceeb323eb6d29ac9 (patch)
tree84d6be981f67655016a62febd87f89bec53c89b3
parentb18825a7c8e37a7cf6abb97a12a6ad71af160de7 (diff)
iget/iget5: don't bother with ->i_lock until we find a match
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r--Documentation/filesystems/porting8
-rw-r--r--drivers/staging/lustre/lustre/llite/namei.c2
-rw-r--r--fs/inode.c20
-rw-r--r--fs/ntfs/inode.c2
4 files changed, 16 insertions, 16 deletions
diff --git a/Documentation/filesystems/porting b/Documentation/filesystems/porting
index f0890581f7f6..fe2b7ae6f962 100644
--- a/Documentation/filesystems/porting
+++ b/Documentation/filesystems/porting
@@ -455,3 +455,11 @@ in your dentry operations instead.
455 vfs_follow_link has been removed. Filesystems must use nd_set_link 455 vfs_follow_link has been removed. Filesystems must use nd_set_link
456 from ->follow_link for normal symlinks, or nd_jump_link for magic 456 from ->follow_link for normal symlinks, or nd_jump_link for magic
457 /proc/<pid> style links. 457 /proc/<pid> style links.
458--
459[mandatory]
460 iget5_locked()/ilookup5()/ilookup5_nowait() test() callback used to be
461 called with both ->i_lock and inode_hash_lock held; the former is *not*
462 taken anymore, so verify that your callbacks do not rely on it (none
463 of the in-tree instances did). inode_hash_lock is still held,
464 of course, so they are still serialized wrt removal from inode hash,
465 as well as wrt set() callback of iget5_locked().
diff --git a/drivers/staging/lustre/lustre/llite/namei.c b/drivers/staging/lustre/lustre/llite/namei.c
index 34815b550e71..90bbdae824ac 100644
--- a/drivers/staging/lustre/lustre/llite/namei.c
+++ b/drivers/staging/lustre/lustre/llite/namei.c
@@ -83,7 +83,7 @@ int ll_unlock(__u32 mode, struct lustre_handle *lockh)
83} 83}
84 84
85 85
86/* called from iget5_locked->find_inode() under inode_lock spinlock */ 86/* called from iget5_locked->find_inode() under inode_hash_lock spinlock */
87static int ll_test_inode(struct inode *inode, void *opaque) 87static int ll_test_inode(struct inode *inode, void *opaque)
88{ 88{
89 struct ll_inode_info *lli = ll_i2info(inode); 89 struct ll_inode_info *lli = ll_i2info(inode);
diff --git a/fs/inode.c b/fs/inode.c
index b33ba8e021cc..bf7a8b3ab937 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -773,15 +773,11 @@ static struct inode *find_inode(struct super_block *sb,
773 773
774repeat: 774repeat:
775 hlist_for_each_entry(inode, head, i_hash) { 775 hlist_for_each_entry(inode, head, i_hash) {
776 spin_lock(&inode->i_lock); 776 if (inode->i_sb != sb)
777 if (inode->i_sb != sb) {
778 spin_unlock(&inode->i_lock);
779 continue; 777 continue;
780 } 778 if (!test(inode, data))
781 if (!test(inode, data)) {
782 spin_unlock(&inode->i_lock);
783 continue; 779 continue;
784 } 780 spin_lock(&inode->i_lock);
785 if (inode->i_state & (I_FREEING|I_WILL_FREE)) { 781 if (inode->i_state & (I_FREEING|I_WILL_FREE)) {
786 __wait_on_freeing_inode(inode); 782 __wait_on_freeing_inode(inode);
787 goto repeat; 783 goto repeat;
@@ -804,15 +800,11 @@ static struct inode *find_inode_fast(struct super_block *sb,
804 800
805repeat: 801repeat:
806 hlist_for_each_entry(inode, head, i_hash) { 802 hlist_for_each_entry(inode, head, i_hash) {
807 spin_lock(&inode->i_lock); 803 if (inode->i_ino != ino)
808 if (inode->i_ino != ino) {
809 spin_unlock(&inode->i_lock);
810 continue; 804 continue;
811 } 805 if (inode->i_sb != sb)
812 if (inode->i_sb != sb) {
813 spin_unlock(&inode->i_lock);
814 continue; 806 continue;
815 } 807 spin_lock(&inode->i_lock);
816 if (inode->i_state & (I_FREEING|I_WILL_FREE)) { 808 if (inode->i_state & (I_FREEING|I_WILL_FREE)) {
817 __wait_on_freeing_inode(inode); 809 __wait_on_freeing_inode(inode);
818 goto repeat; 810 goto repeat;
diff --git a/fs/ntfs/inode.c b/fs/ntfs/inode.c
index 2778b0255dc6..ffb9b3675736 100644
--- a/fs/ntfs/inode.c
+++ b/fs/ntfs/inode.c
@@ -55,7 +55,7 @@
55 * 55 *
56 * Return 1 if the attributes match and 0 if not. 56 * Return 1 if the attributes match and 0 if not.
57 * 57 *
58 * NOTE: This function runs with the inode->i_lock spin lock held so it is not 58 * NOTE: This function runs with the inode_hash_lock spin lock held so it is not
59 * allowed to sleep. 59 * allowed to sleep.
60 */ 60 */
61int ntfs_test_inode(struct inode *vi, ntfs_attr *na) 61int ntfs_test_inode(struct inode *vi, ntfs_attr *na)