Whamcloud - gitweb
Branch b1_4
authoradilger <adilger>
Thu, 8 Sep 2005 18:16:22 +0000 (18:16 +0000)
committeradilger <adilger>
Thu, 8 Sep 2005 18:16:22 +0000 (18:16 +0000)
Description: liblustre could not open files whose last component is a symlink
Details    : sysio_path_walk() would incorrectly pass the open intent to
     intermediate path components.
b=6363
r=oleg, lee, devesh

libsysio/src/namei.c

index c4b6072..9dc7a15 100644 (file)
@@ -257,12 +257,14 @@ _sysio_path_walk(struct pnode *parent, struct nameidata *nd)
                        lpath[cc] = '\0';                       /* NUL term */
                        /*
                         * Handle symbolic links with recursion. Yuck!
                        lpath[cc] = '\0';                       /* NUL term */
                        /*
                         * Handle symbolic links with recursion. Yuck!
+                        * Pass the NULL intent for recursive symlink
+                        * except the last component.
                         */
                        ND_INIT(&nameidata,
                                (nd->nd_flags | ND_NEGOK),
                                lpath,
                                nd->nd_root,
                         */
                        ND_INIT(&nameidata,
                                (nd->nd_flags | ND_NEGOK),
                                lpath,
                                nd->nd_root,
-                               nd->nd_intent);
+                               !next.len ? nd->nd_intent : NULL);
                        nameidata.nd_slicnt = nd->nd_slicnt + 1;
                        err =
                            _sysio_path_walk(nd->nd_pno->p_parent, &nameidata);
                        nameidata.nd_slicnt = nd->nd_slicnt + 1;
                        err =
                            _sysio_path_walk(nd->nd_pno->p_parent, &nameidata);