- Pass the ISOPEN flag to namei so filesystems will know we're about to

open them or otherwise access the data.
This commit is contained in:
Jeff Roberson 2005-04-27 09:05:19 +00:00
parent 53c34859a7
commit 7625cbf3cc
5 changed files with 7 additions and 6 deletions

View File

@ -268,7 +268,7 @@ linux_uselib(struct thread *td, struct linux_uselib_args *args)
* XXX: This code should make use of vn_open(), rather than doing * XXX: This code should make use of vn_open(), rather than doing
* all this stuff itself. * all this stuff itself.
*/ */
NDINIT(&ni, LOOKUP, FOLLOW|LOCKLEAF, UIO_SYSSPACE, library, td); NDINIT(&ni, LOOKUP, ISOPEN|FOLLOW|LOCKLEAF, UIO_SYSSPACE, library, td);
error = namei(&ni); error = namei(&ni);
LFREEPATH(library); LFREEPATH(library);
if (error) if (error)

View File

@ -171,7 +171,8 @@ coff_load_file(struct thread *td, char *name)
unsigned long bss_size = 0; unsigned long bss_size = 0;
int i; int i;
NDINIT(&nd, LOOKUP, LOCKLEAF | FOLLOW | SAVENAME, UIO_SYSSPACE, name, td); NDINIT(&nd, LOOKUP, ISOPEN | LOCKLEAF | FOLLOW | SAVENAME,
UIO_SYSSPACE, name, td);
error = namei(&nd); error = namei(&nd);
if (error) if (error)

View File

@ -348,7 +348,7 @@ do_execve(td, args, mac_p)
* in ni_vp amoung other things. * in ni_vp amoung other things.
*/ */
ndp = &nd; ndp = &nd;
NDINIT(ndp, LOOKUP, LOCKLEAF | FOLLOW | SAVENAME, NDINIT(ndp, LOOKUP, ISOPEN | LOCKLEAF | FOLLOW | SAVENAME,
UIO_SYSSPACE, args->fname, td); UIO_SYSSPACE, args->fname, td);
mtx_lock(&Giant); mtx_lock(&Giant);

View File

@ -118,7 +118,7 @@ vn_open_cred(ndp, flagp, cmode, cred, fdidx)
fmode = *flagp; fmode = *flagp;
if (fmode & O_CREAT) { if (fmode & O_CREAT) {
ndp->ni_cnd.cn_nameiop = CREATE; ndp->ni_cnd.cn_nameiop = CREATE;
ndp->ni_cnd.cn_flags = LOCKPARENT | LOCKLEAF | MPSAFE; ndp->ni_cnd.cn_flags = ISOPEN | LOCKPARENT | LOCKLEAF | MPSAFE;
if ((fmode & O_EXCL) == 0 && (fmode & O_NOFOLLOW) == 0) if ((fmode & O_EXCL) == 0 && (fmode & O_NOFOLLOW) == 0)
ndp->ni_cnd.cn_flags |= FOLLOW; ndp->ni_cnd.cn_flags |= FOLLOW;
bwillwrite(); bwillwrite();
@ -178,7 +178,7 @@ vn_open_cred(ndp, flagp, cmode, cred, fdidx)
} }
} else { } else {
ndp->ni_cnd.cn_nameiop = LOOKUP; ndp->ni_cnd.cn_nameiop = LOOKUP;
ndp->ni_cnd.cn_flags = ndp->ni_cnd.cn_flags = ISOPEN |
((fmode & O_NOFOLLOW) ? NOFOLLOW : FOLLOW) | ((fmode & O_NOFOLLOW) ? NOFOLLOW : FOLLOW) |
LOCKSHARED | LOCKLEAF | MPSAFE; LOCKSHARED | LOCKLEAF | MPSAFE;
if ((error = namei(ndp)) != 0) if ((error = namei(ndp)) != 0)

View File

@ -2025,7 +2025,7 @@ swapon(struct thread *td, struct swapon_args *uap)
goto done; goto done;
} }
NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, uap->name, td); NDINIT(&nd, LOOKUP, ISOPEN | FOLLOW, UIO_USERSPACE, uap->name, td);
error = namei(&nd); error = namei(&nd);
if (error) if (error)
goto done; goto done;