diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2016-10-08 10:44:37 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2016-10-08 10:44:37 -0400 |
commit | 33e09f0ee76e9e4108c5aed67e027ef5e3fe0634 (patch) | |
tree | ea13876185ce57c4a1aba22b33d996962b862ace | |
parent | c5317167854e01dbb42d2291406ab8448d272868 (diff) | |
parent | 2864f301424227d9d3bde6d550bc224a83535b46 (diff) |
Merge branch 'work.iget' into work.misc
-rw-r--r-- | fs/inode.c | 41 |
1 files changed, 34 insertions, 7 deletions
diff --git a/fs/inode.c b/fs/inode.c index 7e3ef3af3db9..691c00747e72 100644 --- a/fs/inode.c +++ b/fs/inode.c | |||
@@ -1021,13 +1021,17 @@ struct inode *iget5_locked(struct super_block *sb, unsigned long hashval, | |||
1021 | { | 1021 | { |
1022 | struct hlist_head *head = inode_hashtable + hash(sb, hashval); | 1022 | struct hlist_head *head = inode_hashtable + hash(sb, hashval); |
1023 | struct inode *inode; | 1023 | struct inode *inode; |
1024 | 1024 | again: | |
1025 | spin_lock(&inode_hash_lock); | 1025 | spin_lock(&inode_hash_lock); |
1026 | inode = find_inode(sb, head, test, data); | 1026 | inode = find_inode(sb, head, test, data); |
1027 | spin_unlock(&inode_hash_lock); | 1027 | spin_unlock(&inode_hash_lock); |
1028 | 1028 | ||
1029 | if (inode) { | 1029 | if (inode) { |
1030 | wait_on_inode(inode); | 1030 | wait_on_inode(inode); |
1031 | if (unlikely(inode_unhashed(inode))) { | ||
1032 | iput(inode); | ||
1033 | goto again; | ||
1034 | } | ||
1031 | return inode; | 1035 | return inode; |
1032 | } | 1036 | } |
1033 | 1037 | ||
@@ -1064,6 +1068,10 @@ struct inode *iget5_locked(struct super_block *sb, unsigned long hashval, | |||
1064 | destroy_inode(inode); | 1068 | destroy_inode(inode); |
1065 | inode = old; | 1069 | inode = old; |
1066 | wait_on_inode(inode); | 1070 | wait_on_inode(inode); |
1071 | if (unlikely(inode_unhashed(inode))) { | ||
1072 | iput(inode); | ||
1073 | goto again; | ||
1074 | } | ||
1067 | } | 1075 | } |
1068 | return inode; | 1076 | return inode; |
1069 | 1077 | ||
@@ -1091,12 +1099,16 @@ struct inode *iget_locked(struct super_block *sb, unsigned long ino) | |||
1091 | { | 1099 | { |
1092 | struct hlist_head *head = inode_hashtable + hash(sb, ino); | 1100 | struct hlist_head *head = inode_hashtable + hash(sb, ino); |
1093 | struct inode *inode; | 1101 | struct inode *inode; |
1094 | 1102 | again: | |
1095 | spin_lock(&inode_hash_lock); | 1103 | spin_lock(&inode_hash_lock); |
1096 | inode = find_inode_fast(sb, head, ino); | 1104 | inode = find_inode_fast(sb, head, ino); |
1097 | spin_unlock(&inode_hash_lock); | 1105 | spin_unlock(&inode_hash_lock); |
1098 | if (inode) { | 1106 | if (inode) { |
1099 | wait_on_inode(inode); | 1107 | wait_on_inode(inode); |
1108 | if (unlikely(inode_unhashed(inode))) { | ||
1109 | iput(inode); | ||
1110 | goto again; | ||
1111 | } | ||
1100 | return inode; | 1112 | return inode; |
1101 | } | 1113 | } |
1102 | 1114 | ||
@@ -1131,6 +1143,10 @@ struct inode *iget_locked(struct super_block *sb, unsigned long ino) | |||
1131 | destroy_inode(inode); | 1143 | destroy_inode(inode); |
1132 | inode = old; | 1144 | inode = old; |
1133 | wait_on_inode(inode); | 1145 | wait_on_inode(inode); |
1146 | if (unlikely(inode_unhashed(inode))) { | ||
1147 | iput(inode); | ||
1148 | goto again; | ||
1149 | } | ||
1134 | } | 1150 | } |
1135 | return inode; | 1151 | return inode; |
1136 | } | 1152 | } |
@@ -1266,10 +1282,16 @@ EXPORT_SYMBOL(ilookup5_nowait); | |||
1266 | struct inode *ilookup5(struct super_block *sb, unsigned long hashval, | 1282 | struct inode *ilookup5(struct super_block *sb, unsigned long hashval, |
1267 | int (*test)(struct inode *, void *), void *data) | 1283 | int (*test)(struct inode *, void *), void *data) |
1268 | { | 1284 | { |
1269 | struct inode *inode = ilookup5_nowait(sb, hashval, test, data); | 1285 | struct inode *inode; |
1270 | 1286 | again: | |
1271 | if (inode) | 1287 | inode = ilookup5_nowait(sb, hashval, test, data); |
1288 | if (inode) { | ||
1272 | wait_on_inode(inode); | 1289 | wait_on_inode(inode); |
1290 | if (unlikely(inode_unhashed(inode))) { | ||
1291 | iput(inode); | ||
1292 | goto again; | ||
1293 | } | ||
1294 | } | ||
1273 | return inode; | 1295 | return inode; |
1274 | } | 1296 | } |
1275 | EXPORT_SYMBOL(ilookup5); | 1297 | EXPORT_SYMBOL(ilookup5); |
@@ -1286,13 +1308,18 @@ struct inode *ilookup(struct super_block *sb, unsigned long ino) | |||
1286 | { | 1308 | { |
1287 | struct hlist_head *head = inode_hashtable + hash(sb, ino); | 1309 | struct hlist_head *head = inode_hashtable + hash(sb, ino); |
1288 | struct inode *inode; | 1310 | struct inode *inode; |
1289 | 1311 | again: | |
1290 | spin_lock(&inode_hash_lock); | 1312 | spin_lock(&inode_hash_lock); |
1291 | inode = find_inode_fast(sb, head, ino); | 1313 | inode = find_inode_fast(sb, head, ino); |
1292 | spin_unlock(&inode_hash_lock); | 1314 | spin_unlock(&inode_hash_lock); |
1293 | 1315 | ||
1294 | if (inode) | 1316 | if (inode) { |
1295 | wait_on_inode(inode); | 1317 | wait_on_inode(inode); |
1318 | if (unlikely(inode_unhashed(inode))) { | ||
1319 | iput(inode); | ||
1320 | goto again; | ||
1321 | } | ||
1322 | } | ||
1296 | return inode; | 1323 | return inode; |
1297 | } | 1324 | } |
1298 | EXPORT_SYMBOL(ilookup); | 1325 | EXPORT_SYMBOL(ilookup); |