Thread: [Libsysio-commit] HEAD: libsysio/src namei.c
Brought to you by:
lward
From: Lee W. <lw...@us...> - 2003-06-11 23:14:53
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1:/tmp/cvs-serv5668 Modified Files: namei.c Log Message: When built with automounts enabled, if a directory has the sticky- bit set but there is no .mount file, namei loops until the automount limit count is exceeded. Once that has happened, no further automounts were allowed in the path. Removed the else block that reset the error code, when the lookup on .mount failed, so that namei will begin processing the next component. Index: namei.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/namei.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -w -b -B -p -r1.5 -r1.6 --- namei.c 24 Mar 2003 22:09:06 -0000 1.5 +++ namei.c 11 Jun 2003 20:43:34 -0000 1.6 @@ -293,8 +293,7 @@ _sysio_path_walk(struct pnode *parent, s * Must send the intent-path again. */ path = nd->nd_path; - } else if (err == -ENOENT) - err = 0; + } if (!err) { P_RELE(pno); nd->nd_amcnt++; |
From: Sonja T. <so...@us...> - 2003-10-28 21:02:28
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1:/tmp/cvs-serv3617/src Modified Files: namei.c Log Message: Fixed bug in namei that assumed a non-zero return from readlink was an error Fixed bugs in test_driver.c Added test_symlink.pl into test_all.pl Index: namei.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/namei.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -w -b -B -p -r1.7 -r1.8 --- namei.c 14 Aug 2003 18:39:33 -0000 1.7 +++ namei.c 28 Oct 2003 20:59:39 -0000 1.8 @@ -222,7 +222,7 @@ _sysio_path_walk(struct pnode *parent, s ino->i_ops.inop_readlink(nd->nd_pno, lpath, MAXPATHLEN); - if (err) { + if (err < 0) { free(lpath); break; } |
From: Ruth K. <rk...@us...> - 2004-01-12 23:02:15
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1:/tmp/cvs-serv18100 Modified Files: namei.c Log Message: Fortran libs prepend cwd to path, if first char is not '/', so remove everything up to the first ':' to get rid of Cplant prefix Index: namei.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/namei.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -w -b -B -p -r1.8 -r1.9 --- namei.c 28 Oct 2003 20:59:39 -0000 1.8 +++ namei.c 12 Jan 2004 23:02:08 -0000 1.9 @@ -435,28 +435,12 @@ _sysio_path_walk(struct pnode *parent, s } #ifdef CPLANT_YOD -static const char * -strip_prefix(const char *path) -{ - /* * for backward compatibility w/protocol switch - * remove 'prefix:' iff first ':' immediately - * precedes first '/' + * remove everything up to the first ':' + * fortran libs prepend cwd to path, so not much choice */ - - char *colon, *slash; - - colon = strchr(path, ':'); - slash = strchr(path, '/'); - - if (slash == colon + 1) - return(slash); - else - return(path); - -} -#define STRIP_PREFIX(p) strip_prefix(p) +#define STRIP_PREFIX(p) strchr(p,':') ? strchr(p,':')+1 : p #else #define STRIP_PREFIX(p) p #endif |
From: Lee W. <lw...@us...> - 2004-03-05 13:29:23
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25438/src Modified Files: namei.c Log Message: The indication that a directory *might* be an automount candidate is the ISUID flag. Not ISVTX. Changed to reflect that. Index: namei.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/namei.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -w -b -B -p -r1.11 -r1.12 --- namei.c 14 Feb 2004 19:42:59 -0000 1.11 +++ namei.c 5 Mar 2004 13:07:19 -0000 1.12 @@ -252,7 +252,7 @@ _sysio_path_walk(struct pnode *parent, s S_ISDIR(ino->i_mode) && (nd->nd_pno->p_mount->mnt_flags & MOUNT_F_AUTO) && nd->nd_amcnt < MAX_MOUNT_DEPTH && - ino->i_mode & S_ISVTX) { + ino->i_mode & S_ISUID) { struct pnode *pno; /* |
From: Lee W. <lw...@us...> - 2005-09-15 14:51:10
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21780 Modified Files: namei.c Log Message: When processing a symbolic link, the intent was passed always. This was incorrect because the symlink could be an intermediate, and *not* contain the final target. Fixed. Index: namei.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/namei.c,v retrieving revision 1.16 retrieving revision 1.17 diff -u -w -b -B -p -r1.16 -r1.17 --- namei.c 14 Oct 2004 14:59:29 -0000 1.16 +++ namei.c 15 Sep 2005 14:50:57 -0000 1.17 @@ -262,7 +262,7 @@ _sysio_path_walk(struct pnode *parent, s (nd->nd_flags | ND_NEGOK), lpath, nd->nd_root, - nd->nd_intent); + !next.len ? nd_intent : NULL); nameidata.nd_slicnt = nd->nd_slicnt + 1; err = _sysio_path_walk(nd->nd_pno->p_parent, &nameidata); |
From: Lee W. <lw...@us...> - 2005-09-15 19:29:10
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26988/src Modified Files: namei.c Log Message: Oops. I had only the nd_intent field name. Not the pointer prepended. Index: namei.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/namei.c,v retrieving revision 1.17 retrieving revision 1.18 diff -u -w -b -B -p -r1.17 -r1.18 --- namei.c 15 Sep 2005 14:50:57 -0000 1.17 +++ namei.c 15 Sep 2005 19:29:02 -0000 1.18 @@ -262,7 +262,7 @@ _sysio_path_walk(struct pnode *parent, s (nd->nd_flags | ND_NEGOK), lpath, nd->nd_root, - !next.len ? nd_intent : NULL); + !next.len ? nd->nd_intent : NULL); nameidata.nd_slicnt = nd->nd_slicnt + 1; err = _sysio_path_walk(nd->nd_pno->p_parent, &nameidata); |
From: Lee W. <lw...@us...> - 2006-02-08 17:17:51
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3483/src Modified Files: namei.c Log Message: The startup code in the tests directory should process the namespace initialization variable before the initial working directory. Fixed. From ClusterFS bugzilla #10114; When compiled to support an initial working directory that is deferred until needed, a chdir to a non-existent directory would cause an abort. This behavior is per design. Not technically a bug. However, it's very unfriendly. Especially so, since the accepted thing to do in this situation is to just leave the current working directory at the root of the namespace. This change, then, alters the behavior to the commonly accepted. Index: namei.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/namei.c,v retrieving revision 1.18 retrieving revision 1.19 diff -u -w -b -B -p -r1.18 -r1.19 --- namei.c 15 Sep 2005 19:29:02 -0000 1.18 +++ namei.c 8 Feb 2006 17:17:43 -0000 1.19 @@ -186,19 +186,22 @@ _sysio_path_walk(struct pnode *parent, s if (!parent) { const char *icwd; - if (!_sysio_init_cwd) + if (!_sysio_init_cwd && !nd->nd_root) abort(); /* - * Finally have to set the curretn working directory. We can + * Finally have to set the current working directory. We can * not tolerate errors here or else risk leaving the process * in a very unexpected location. We abort then unless all goes * well. */ icwd = _sysio_init_cwd; _sysio_init_cwd = NULL; - if (_sysio_namei(NULL, icwd, 0, NULL, &parent) != 0 || - _sysio_p_chdir(parent) != 0) + parent = nd->nd_root; + if (!parent) + abort(); + (void )_sysio_namei(nd->nd_root, icwd, 0, NULL, &parent); + if (_sysio_p_chdir(parent) != 0) abort(); } #endif |
From: Lee W. <lw...@us...> - 2006-05-03 22:37:26
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21443 Modified Files: namei.c Log Message: Documented the new ND_NOPERMCHECK flag to the path walk routine. Index: namei.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/namei.c,v retrieving revision 1.21 retrieving revision 1.22 diff -u -w -b -B -p -r1.21 -r1.22 --- namei.c 3 May 2006 22:34:46 -0000 1.21 +++ namei.c 3 May 2006 22:37:23 -0000 1.22 @@ -158,6 +158,7 @@ lookup(struct pnode *parent, * ND_NOFOLLOW symbolic links are not followed * ND_NEGOK if terminal/leaf does not exist, return * path node (alias) anyway. + * ND_NOPERMCHECK do not check permissions */ int _sysio_path_walk(struct pnode *parent, struct nameidata *nd) |
From: Lee W. <lw...@us...> - 2006-05-04 02:32:19
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21667 Modified Files: namei.c Log Message: Fixed a comment, only. Index: namei.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/namei.c,v retrieving revision 1.22 retrieving revision 1.23 diff -u -w -b -B -p -r1.22 -r1.23 --- namei.c 3 May 2006 22:37:23 -0000 1.22 +++ namei.c 4 May 2006 02:32:08 -0000 1.23 @@ -97,11 +97,11 @@ lookup(struct pnode *parent, if (!parent->p_base->pb_ino) return -ENOTDIR; - if (check_permissions) { /* - * Sometimes we don't want to do this. At initialization + * Sometimes we don't want to check permissions. At initialization * time, for instance. */ + if (check_permissions) { err = _sysio_permitted(parent, X_OK); if (err) return err; |
From: Lee W. <lw...@us...> - 2007-04-12 20:06:35
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv14308 Modified Files: namei.c Log Message: Remove unneeded _BSD_SOURCE definition. Index: namei.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/namei.c,v retrieving revision 1.23 retrieving revision 1.24 diff -u -w -b -B -p -r1.23 -r1.24 --- namei.c 4 May 2006 02:32:08 -0000 1.23 +++ namei.c 12 Apr 2007 20:06:29 -0000 1.24 @@ -41,10 +41,6 @@ * le...@sa... */ -#if defined(AUTOMOUNT_FILE_NAME) && defined(__linux__) -#define _BSD_SOURCE -#endif - #include <stdlib.h> #include <string.h> #include <errno.h> |
From: Lee W. <lw...@us...> - 2008-03-04 18:07:13
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6648/src Modified Files: namei.c Log Message: When doing an automount the pnode for the ".mount" file was not being held; It was released immediately after the lookup. It should be nailed down during the automount as well. It is now. Index: namei.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/namei.c,v retrieving revision 1.26 retrieving revision 1.27 diff -u -w -b -B -p -r1.26 -r1.27 --- namei.c 1 May 2007 16:33:53 -0000 1.26 +++ namei.c 4 Mar 2008 18:07:08 -0000 1.27 @@ -303,9 +303,7 @@ _sysio_path_walk(struct pnode *parent, s NULL, NULL, 1); - if (pno) - P_RELE(pno); - if (!err && _sysio_automount(pno) == 0) { + if (!err && (err = _sysio_automount(pno) == 0)) { struct pnode *root; /* @@ -337,6 +335,10 @@ _sysio_path_walk(struct pnode *parent, s path = nd->nd_path; nd->nd_amcnt++; + } + if (pno) + P_RELE(pno); + if (!err) { /* * Must go back top and retry with this * new pnode as parent. |
From: Lee W. <lw...@us...> - 2008-04-07 19:16:00
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1208 Modified Files: namei.c Log Message: Fixed bug in _sysio_path_walk where if the source did not exist then the routine would loop forever. Index: namei.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/namei.c,v retrieving revision 1.27 retrieving revision 1.28 diff -u -w -b -B -p -r1.27 -r1.28 --- namei.c 4 Mar 2008 18:07:08 -0000 1.27 +++ namei.c 7 Apr 2008 19:15:49 -0000 1.28 @@ -303,7 +303,7 @@ _sysio_path_walk(struct pnode *parent, s NULL, NULL, 1); - if (!err && (err = _sysio_automount(pno) == 0)) { + if (!err && (err = _sysio_automount(pno)) == 0) { struct pnode *root; /* |
From: Lee W. <lw...@us...> - 2008-04-22 21:56:07
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19135/src Modified Files: namei.c Log Message: Two changes: 1) Pnodes that are root of a mount now loop on themselves. Changed lookup to descend, then move up when encountering such a node now. 2) Automounts need their root to have a soft-reference, always, now. Index: namei.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/namei.c,v retrieving revision 1.28 retrieving revision 1.29 diff -u -w -b -B -p -r1.28 -r1.29 --- namei.c 7 Apr 2008 19:15:49 -0000 1.28 +++ namei.c 22 Apr 2008 21:56:03 -0000 1.29 @@ -118,7 +118,11 @@ lookup(struct pnode *parent, else if (name->len == 2 && name->name[0] == '.' && name->name[1] == '.') { + while (parent->p_mount->mnt_root == parent && + parent != parent->p_mount->mnt_covers) + parent = parent->p_mount->mnt_covers; pno = parent->p_parent; + assert(pno); } if (pno) P_REF(pno); @@ -129,8 +133,6 @@ lookup(struct pnode *parent, err = _sysio_p_find_alias(parent, name, &pno); if (err) return err; - } - /* * While covered, move to the covering node. */ @@ -142,6 +144,7 @@ lookup(struct pnode *parent, P_RELE(pno); pno = cover; } + } *pnop = pno; @@ -296,6 +299,7 @@ _sysio_path_walk(struct pnode *parent, s * arrange the mount if so. */ assert(!nd->nd_pno->p_cover); + pno = NULL; err = lookup(nd->nd_pno, &_sysio_mount_file_name, @@ -304,28 +308,21 @@ _sysio_path_walk(struct pnode *parent, s NULL, 1); if (!err && (err = _sysio_automount(pno)) == 0) { - struct pnode *root; - /* * All went well. Need to switch * parent pno and ino to the * root of the newly mounted sub-tree. * * NB: - * We don't recurseively retry these + * We don't recursively retry these * things. It's OK to have the new root * be an automount-point but it's going * to take another lookup to accomplish it. * The alternative could get us into an * infinite loop. */ - root = nd->nd_pno->p_cover; - assert(root); - P_RELE(nd->nd_pno); - nd->nd_pno = root; -#if 0 + nd->nd_pno = nd->nd_pno->p_cover; P_REF(nd->nd_pno); -#endif ino = nd->nd_pno->p_base->pb_ino; assert(ino); |
From: Ruth K. <rk...@us...> - 2008-11-04 22:05:00
|
Update of /cvsroot/libsysio/libsysio/src In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv18082 Modified Files: namei.c Log Message: fix for cray Bug 745866 stat call on broken symlink fails Index: namei.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/namei.c,v retrieving revision 1.31 retrieving revision 1.32 diff -u -w -b -B -p -r1.31 -r1.32 --- namei.c 15 Oct 2008 22:01:01 -0000 1.31 +++ namei.c 4 Nov 2008 22:04:47 -0000 1.32 @@ -311,7 +311,7 @@ _sysio_path_walk(struct pnode *parent, s P_REF(nd->nd_pno); P_PUT(nd->nd_pno); ND_INIT(&nameidata, - (nd->nd_flags | ND_NEGOK), + nd->nd_flags, lpath, nd->nd_root, !next.len ? nd->nd_intent : NULL); |
From: Lee W. <lw...@us...> - 2009-02-04 19:17:47
|
Update of /cvsroot/libsysio/libsysio/src In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv27400/src Modified Files: namei.c Log Message: Added support for the new ND_NXMNT flag. Changed the local routine that traverses to the next component in a path, called lookup. It now takes nameidata flags, and honors ND_NOPERMCHECK and ND_NXMNT. Removed the check_permissions flag as it's function is captured in this more general mechanism. Index: namei.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/namei.c,v retrieving revision 1.33 retrieving revision 1.34 diff -u -w -b -B -p -r1.33 -r1.34 --- namei.c 6 Dec 2008 21:56:25 -0000 1.33 +++ namei.c 4 Feb 2009 19:17:42 -0000 1.34 @@ -82,10 +82,10 @@ _sysio_next_component(const char *path, static int lookup(struct pnode *parent, struct qstr *name, + unsigned flags, struct pnode **pnop, struct intent *intnt, - const char *path, - int check_permissions) + const char *path) { int err; struct pnode *pno; @@ -98,7 +98,7 @@ lookup(struct pnode *parent, * Sometimes we don't want to check permissions. At initialization * time, for instance. */ - if (check_permissions) { + if (!(flags & ND_NOPERMCHECK)) { err = _sysio_permitted(parent, X_OK); if (err) return err; @@ -123,7 +123,9 @@ lookup(struct pnode *parent, * one node in any given type locked while we're doing this. */ pno = parent; - if (pno == pno->p_parent && pno->p_cover != pno) { + if (!(flags & ND_NXMNT) && + pno == pno->p_parent && + pno->p_cover != pno) { /* * This node loops on itself and is not the root @@ -168,6 +170,7 @@ lookup(struct pnode *parent, err = _sysio_p_find_alias(parent, name, &pno); if (err) return err; + if (!(flags & ND_NXMNT)) { /* * While covered, move to the covering node. */ @@ -180,6 +183,7 @@ lookup(struct pnode *parent, pno = cover; } } + } *pnop = pno; @@ -198,6 +202,7 @@ lookup(struct pnode *parent, * ND_NEGOK if terminal/leaf does not exist, return * path node (alias) anyway. * ND_NOPERMCHECK do not check permissions + * ND_NXMNT do not cross mount points */ int _sysio_path_walk(struct pnode *parent, struct nameidata *nd) @@ -247,7 +252,11 @@ _sysio_path_walk(struct pnode *parent, s parent = nd->nd_root; if (!parent) abort(); - (void )_sysio_namei(nd->nd_root, icwd, 0, NULL, &parent); + (void )_sysio_namei(nd->nd_root, + icwd, + nd->nd_flags & ND_NXMNT, + NULL, + &parent); if (_sysio_p_chdir(parent) != 0) abort(); P_PUT(parent); @@ -328,7 +337,8 @@ _sysio_path_walk(struct pnode *parent, s ino = nd->nd_pno->p_base->pb_ino; } #ifdef AUTOMOUNT_FILE_NAME - else if (ino && + else if ((nd->nd_flags & ND_NXMNT) && + ino && nd->nd_amcnt < MAX_MOUNT_DEPTH && S_ISDIR(ino->i_stbuf.st_mode) && ino->i_stbuf.st_mode & S_ISUID && @@ -351,10 +361,10 @@ _sysio_path_walk(struct pnode *parent, s err = lookup(nd->nd_pno, &_sysio_mount_file_name, + 0, &pno, NULL, - NULL, - 1); + NULL); } if (!err && (err = _sysio_automount(pno)) == 0) { struct pnode *covered; @@ -463,12 +473,12 @@ _sysio_path_walk(struct pnode *parent, s err = lookup(parent, &this, + (nd->nd_flags & (ND_NOPERMCHECK|ND_NXMNT)), &nd->nd_pno, (path || !next.len) ? nd->nd_intent : NULL, - (path && next.len) ? path : NULL, - !(nd->nd_flags & ND_NOPERMCHECK)); + (path && next.len) ? path : NULL); if (err) { if (err == -ENOENT && !next.len && |
From: Lee W. <lw...@us...> - 2009-08-04 14:19:11
|
Update of /cvsroot/libsysio/libsysio/src In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv18445/src Modified Files: namei.c Log Message: The namei family now takes the ND_WANTPARENT flag as well. This new flag causes a lock to be taken on the parent of the returned pnode when the return indicates success. Updated copyright date and contact. Index: namei.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/namei.c,v retrieving revision 1.34 retrieving revision 1.35 diff -u -w -b -B -p -r1.34 -r1.35 --- namei.c 4 Feb 2009 19:17:42 -0000 1.34 +++ namei.c 4 Aug 2009 14:19:00 -0000 1.35 @@ -9,7 +9,7 @@ * terms of the GNU Lesser General Public License * (see cit/LGPL or http://www.gnu.org/licenses/lgpl.html) * - * Cplant(TM) Copyright 1998-2007 Sandia Corporation. + * Cplant(TM) Copyright 1998-2009 Sandia Corporation. * Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive * license for use of this work by or on behalf of the US Government. * Export of this program may require a license from the United States @@ -36,7 +36,7 @@ * Lee Ward * Sandia National Laboratories, New Mexico * P.O. Box 5800 - * Albuquerque, NM 87185-1110 + * Albuquerque, NM 87185-1319 * * le...@sa... */ @@ -211,6 +211,7 @@ _sysio_path_walk(struct pnode *parent, s const char *path; struct qstr this, next; struct inode *ino; + int done; /* * NULL path? @@ -282,6 +283,7 @@ _sysio_path_walk(struct pnode *parent, s path = next.name; parent = NULL; err = 0; + done = 0; /* * Derecurse the path tree-walk. @@ -294,6 +296,11 @@ _sysio_path_walk(struct pnode *parent, s ssize_t cc; struct nameidata nameidata; + if (parent) { + P_PUT(parent); + parent = NULL; + } + if (nd->nd_slicnt >= MAX_SYMLINK) { err = -ELOOP; break; @@ -334,6 +341,10 @@ _sysio_path_walk(struct pnode *parent, s break; P_PUT(nd->nd_pno); nd->nd_pno = nameidata.nd_pno; + if (nd->nd_flags & ND_WANTPARENT) { + parent = nd->nd_pno->p_parent; + assert(P_ISLOCKED(parent) && parent->p_ref); + } ino = nd->nd_pno->p_base->pb_ino; } #ifdef AUTOMOUNT_FILE_NAME @@ -403,6 +414,10 @@ _sysio_path_walk(struct pnode *parent, s * Must go back top and retry with this * new pnode as parent. */ + if (parent) { + P_PUT(parent); + parent = NULL; + } continue; } err = 0; /* it never happened */ @@ -428,6 +443,8 @@ _sysio_path_walk(struct pnode *parent, s } nd->nd_path = this.name + this.len; _sysio_next_component(nd->nd_path, &next); + if (parent) + P_PUT(parent); parent = nd->nd_pno; nd->nd_pno = NULL; @@ -484,7 +501,7 @@ _sysio_path_walk(struct pnode *parent, s !next.len && (nd->nd_flags & ND_NEGOK)) err = 0; - break; + done = 1; } path = NULL; /* Stop that! */ /* @@ -499,14 +516,15 @@ _sysio_path_walk(struct pnode *parent, s * to include the path again. */ path = nd->nd_path; - } - /* - * Finished with the current parent. + * Also, the parent isn't really the parent. */ P_PUT(parent); parent = NULL; } + if (done) + break; + } /* * Trailing separators cause us to break from the loop with @@ -524,12 +542,19 @@ _sysio_path_walk(struct pnode *parent, s err = -ENOTDIR; } + if (parent) { + if (err || !(nd->nd_flags & ND_WANTPARENT)) { /* - * Put the parent if present. Either we have a dup of the original - * parent or an intermediate reference. + * Put the parent if present. Either we have a dup of + * the original parent or an intermediate reference. */ - if (parent) P_PUT(parent); + parent = NULL; + } + } else if (!err && (nd->nd_flags & ND_WANTPARENT)) { + parent = nd->nd_pno->p_parent; + P_GET(parent); + } /* * On error, we will want to drop the current |
From: Lee W. <lw...@us...> - 2009-08-20 01:06:13
|
Update of /cvsroot/libsysio/libsysio/src In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv10820/src Modified Files: namei.c Log Message: The new logic in pathwalk introduced an error; Reported by Jason Cope at ANL. If a direcotry to be traversed did not grant X permission then the error was caught, the done flag set, and nd->nd_pno is left as NULL. The next thing that was done was to check that the parent mount was same as nd->nd_pno mount. Oops, nd->nd_pno was left set to NULL, resulting in the train wreck we know so well as SIGSEGV. In this change, when handling the error we now set the done flag, do the ENOENT check and if that fails, we break. No need to check if we crossed into a new mount point. Index: namei.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/namei.c,v retrieving revision 1.35 retrieving revision 1.36 diff -u -w -b -B -p -r1.35 -r1.36 --- namei.c 4 Aug 2009 14:19:00 -0000 1.35 +++ namei.c 20 Aug 2009 01:06:01 -0000 1.36 @@ -497,11 +497,13 @@ _sysio_path_walk(struct pnode *parent, s : NULL, (path && next.len) ? path : NULL); if (err) { + done = 1; if (err == -ENOENT && !next.len && (nd->nd_flags & ND_NEGOK)) err = 0; - done = 1; + else + break; } path = NULL; /* Stop that! */ /* |
From: Ruth K. <rk...@us...> - 2009-09-18 20:16:49
|
Update of /cvsroot/libsysio/libsysio/src In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv27528 Modified Files: namei.c Log Message: ND_NXMNT prevents traversal of a mount, so, automounts are not helpful in the presence of this flag. Index: namei.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/namei.c,v retrieving revision 1.36 retrieving revision 1.37 diff -u -w -b -B -p -r1.36 -r1.37 --- namei.c 20 Aug 2009 01:06:01 -0000 1.36 +++ namei.c 18 Sep 2009 20:16:37 -0000 1.37 @@ -348,7 +348,7 @@ _sysio_path_walk(struct pnode *parent, s ino = nd->nd_pno->p_base->pb_ino; } #ifdef AUTOMOUNT_FILE_NAME - else if ((nd->nd_flags & ND_NXMNT) && + else if (!(nd->nd_flags & ND_NXMNT) && ino && nd->nd_amcnt < MAX_MOUNT_DEPTH && S_ISDIR(ino->i_stbuf.st_mode) && |