[Libsysio-commit] unification: libsysio/src inode.c mount.c rw.c
Brought to you by:
lward
From: Lee W. <lw...@us...> - 2007-04-12 17:13:33
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv3117 Modified Files: Tag: unification inode.c mount.c rw.c Log Message: _sysio_p_validate will now disconnect the sub-graph if the validation fails. _sysio_pb_disconnect moved up in the file to provide a forward declaration for _sysio_p_validate. _sysio_p_rename modified so as not to use prune as some sort of a test. The sub-tree is simply disconnected. This can have weird results on stateless file system client implementations. They would need something like NFS's silly delete to preserve access to open files, of course. Index: inode.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/inode.c,v retrieving revision 1.25.2.2 retrieving revision 1.25.2.3 diff -u -w -b -B -p -r1.25.2.2 -r1.25.2.3 --- inode.c 11 Apr 2007 20:44:14 -0000 1.25.2.2 +++ inode.c 12 Apr 2007 17:13:30 -0000 1.25.2.3 @@ -447,6 +447,30 @@ _sysio_pb_gone(struct pnode_base *pb) } /* + * Clean up the namespace graph after an unlink. + */ +static void +_sysio_pb_disconnect(struct pnode_base *pb) +{ + struct pnode *pno; + + /* + * Disconnect all aliases associated with the referenced base node. + */ + pno = pb->pb_aliases.lh_first; + do { + pno->p_parent = NULL; + } while ((pno = pno->p_links.le_next)); + /* + * Remove name from the names cache so that it can't + * be found anymore. + */ + if (pb->pb_name.len) + LIST_REMOVE(pb, pb_names); + pb->pb_name.len = 0; +} + +/* * Generate more path (alias) nodes for the fast allocator. */ static void @@ -569,7 +593,8 @@ _sysio_p_validate(struct pnode *pno, str err = -ESTALE; I_RELE(ino); } - } + } else if (pno->p_base->pb_ino) + _sysio_pb_disconnect(pno->p_base); return err; } @@ -885,30 +910,6 @@ _sysio_p_setattr(struct pnode *pno, } /* - * Clean up the namespace graph after an unlink. - */ -static void -_sysio_pb_disconnect(struct pnode_base *pb) -{ - struct pnode *pno; - - /* - * Disconnect all aliases associated with the referenced base node. - */ - pno = pb->pb_aliases.lh_first; - do { - pno->p_parent = NULL; - } while ((pno = pno->p_links.le_next)); - /* - * Remove name from the names cache so that it can't - * be found anymore. - */ - if (pb->pb_name.len) - LIST_REMOVE(pb, pb_names); - pb->pb_name.len = 0; -} - -/* * Perform unlink operation on some pnode. */ int @@ -1010,16 +1011,6 @@ _sysio_p_rename(struct pnode *old, struc if (S_ISDIR(new->p_base->pb_ino->i_stbuf.st_mode)) { if (!S_ISDIR(old->p_base->pb_ino->i_stbuf.st_mode)) return -EISDIR; - /* - * Should check that the directory is empty. We - * can't reliably depend on any check we can make - * from here, though. - * - * We can check if anything is open in the sub-tree - * though. - */ - if (_sysio_p_prune(new) != 1) - return -EBUSY; } else if (S_ISDIR(old->p_base->pb_ino->i_stbuf.st_mode)) return -ENOTDIR; } @@ -1035,7 +1026,7 @@ _sysio_p_rename(struct pnode *old, struc */ _sysio_pb_disconnect(old->p_base); /* - * Discionnect the new if positive. We want new lookups + * Disconnect the new if positive. We want new lookups * to find the just renamed entity. */ if (new->p_base->pb_ino) Index: mount.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/mount.c,v retrieving revision 1.21.4.3 retrieving revision 1.21.4.4 diff -u -w -b -B -p -r1.21.4.3 -r1.21.4.4 --- mount.c 12 Apr 2007 01:51:13 -0000 1.21.4.3 +++ mount.c 12 Apr 2007 17:13:30 -0000 1.21.4.4 @@ -166,14 +166,6 @@ _sysio_do_mount(struct filesys *fs, goto error; } /* - * It may have been a while since the root inode was validated; - * better validate again. - */ - err = _sysio_p_validate(mnt->mnt_root, NULL, NULL); - if (err) - goto error; - - /* * It better be a directory! */ if (!S_ISDIR(mnt->mnt_root->p_base->pb_ino->i_stbuf.st_mode)) { Index: rw.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/rw.c,v retrieving revision 1.16.4.2 retrieving revision 1.16.4.3 diff -u -w -b -B -p -r1.16.4.2 -r1.16.4.3 --- rw.c 10 Apr 2007 21:25:31 -0000 1.16.4.2 +++ rw.c 12 Apr 2007 17:13:30 -0000 1.16.4.3 @@ -106,7 +106,7 @@ _sysio_post_io(int (*f)(struct inode *in /* * Post the op. */ - err = PNOP_CALL(f, pno->p_base->pb_ino, ioctx); + err = INOP_CALL(f, pno->p_base->pb_ino, ioctx); } while (0); if (!err) { *ioctxp = ioctx; |