Re: sys_semget()
Ratna Manoj Bolla <[email protected]>
| Newsgroups | gmane.linux.cluster.openmosix.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi,
I got a doubt while debugging for my patch.
please see at line no 1257 below !. (this from fs/inode.c)
void iput(struct inode *inode)
1209 {
1210 if (inode) {
1211 struct super_block *sb = inode->i_sb;
1212 struct super_operations *op = NULL;
1213
1214 if (inode->i_state == I_CLEAR)
1215 BUG();
1216
1217 if (sb && sb->s_op)
1218 op = sb->s_op;
1219 if (op && op->put_inode)
1220 op->put_inode(inode);
1221
1222 if (!atomic_dec_and_lock(&inode->i_count, &inode_lock))
1223 return;
1224
1225 if (!inode->i_nlink) {
1226 list_del(&inode->i_list);
1227 INIT_LIST_HEAD(&inode->i_list);
1228 inode->i_state|=I_FREEING;
1229 inodes_stat.nr_inodes--;
1230 spin_unlock(&inode_lock);
1231
1232 if (inode->i_data.nrpages)
1233 truncate_inode_pages(&inode->i_data, 0);
1234
1235 if (op && op->delete_inode) {
1236 void (*delete)(struct inode *) = op->delete_inode;
1237 if (!is_bad_inode(inode))
1238 DQUOT_INIT(inode);
1239 /* s_op->delete_inode internally
recalls clear_inode() */
1240 delete(inode);
1241 } else
1242 clear_inode(inode);
1243 spin_lock(&inode_lock);
1244 list_del(&inode->i_hash);
1245 INIT_LIST_HEAD(&inode->i_hash);
1246 spin_unlock(&inode_lock);
1247 wake_up(&inode->i_wait);
1248 if (inode->i_state != I_CLEAR)
1249 BUG();
1250 } else {
1251 if (!list_empty(&inode->i_hash)) {
1252 if (!(inode->i_state & (I_DIRTY|I_LOCK)))
1253 __refile_inode(inode);
1254 inodes_stat.nr_unused++;
1255 spin_unlock(&inode_lock);
1256 if (!sb || (sb->s_flags & MS_ACTIVE))
1257 return;
Can any body tell what happens if somebody takes a reference to this inode
with iget() ? [inode has not been deleted from hash list .... even if some
body took reference here the inode will be cleared for sure .. who(lock or
semaphore) ensure that this will not heppen ?]
1258 write_inode_now(inode, 1);
1259 spin_lock(&inode_lock);
1260 inodes_stat.nr_unused--;
1261 list_del_init(&inode->i_hash);
1262 }
1263 list_del_init(&inode->i_list);
1264 inode->i_state|=I_FREEING;
1265 inodes_stat.nr_inodes--;
1266 spin_unlock(&inode_lock);
1267 if (inode->i_data.nrpages)
1268 truncate_inode_pages(&inode->i_data, 0);
1269 clear_inode(inode);
1270 }
1271 destroy_inode(inode);
1272 }
1273 }
-------------------------------------------------------
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642