[Libsysio-commit] HEAD: libsysio/src inode.c
Brought to you by:
lward
From: Lee W. <lw...@us...> - 2009-01-22 19:07:51
|
Update of /cvsroot/libsysio/libsysio/src In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv15278/src Modified Files: inode.c Log Message: With I_ASSOCIATIONS defined, inodes keep a list of all path-base nodes that are currently associated. Always, association of a path-base node with an i-node is now done via the macro PB_SET_ASSOC(). This, new, macro will not allow an already associated path-base node to gain a new association; This to enforce the emerging policy of "once set, immutable" for these nodes. You can set the association of an unassociated path-base node or clear it, only. Index: inode.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/inode.c,v retrieving revision 1.52 retrieving revision 1.53 diff -u -w -b -B -p -r1.52 -r1.53 --- inode.c 22 Jan 2009 18:06:44 -0000 1.52 +++ inode.c 22 Jan 2009 19:07:42 -0000 1.53 @@ -304,6 +304,9 @@ _sysio_i_gone(struct inode *ino) if (ino->i_ref) abort(); +#ifdef I_ASSOCIATIIONS + assert(!I_ISASSOC(ino)); +#endif if (!ino->i_zombie) icache_delete(ino); TAILQ_REMOVE(&_sysio_inodes, ino, i_nodes); @@ -508,7 +511,8 @@ _sysio_pb_new(struct qstr *name, struct if (!name) name = &noname; - PB_INIT(pb, name, parent, ino); + PB_INIT(pb, name, parent); + PB_SET_ASSOC(pb, ino); if (ino) I_REF(ino); PB_LOCK(pb); @@ -587,14 +591,14 @@ _sysio_pb_gone(struct pnode_base *pb) ino = pb->pb_ino; if (ino) I_LOCK(ino); - pb->pb_ino = NULL; + PB_SET_ASSOC(pb, NULL); PB_UNLOCK(pb); mutex_destroy(&pb->pb_mutex); free(pb); if (ino) { I_RELE(ino); - if (!(ino->i_ref || ino->i_immune)) + if (!(ino->i_ref || ino->i_immune || I_ISASSOC(ino))) _sysio_i_gone(ino); else I_UNLOCK(ino); @@ -893,12 +897,17 @@ _sysio_p_validate(struct pnode *pno, str /* * Make valid. */ - pno->p_base->pb_ino = ino; + PB_SET_ASSOC(pno->p_base, ino); I_REF(pno->p_base->pb_ino); } else if (pno->p_base->pb_ino != ino) { /* * Path resolves to a different inode, now. The * currently attached inode, then, is stale. + * + * Don't want to disconnect it. If caller + * is handles based, we want to keep returning + * stale. Other users should know better than to + * keep retrying; It'll never become valid. */ err = -ESTALE; I_PUT(ino); @@ -1280,7 +1289,7 @@ _sysio_p_link(struct pnode *old, struct err = PNOP_LINK(old, new); if (err) return err; - new->p_base->pb_ino = old->p_base->pb_ino; + PB_SET_ASSOC(new->p_base, old->p_base->pb_ino); I_REF(new->p_base->pb_ino); return 0; } |