fusefs: only search for FREAD fufh in readdir
The extra search for an FEXEC fufh shall be removed, since readdir is only supposed to be called on a directory opened with FREAD. The sole exception is NFS, which will call VOP_READDIR with directories that aren't open at all. fuse already has special code to handle that. Also remove the fuse_filehandle_get_dir() function, since it's not used anywhere else. Signed-off-by: CismonX <admin@cismon.net> Reviewed by: asomers MFC after: 2 weeks Pull Request: https://github.com/freebsd/freebsd-src/pull/1729
This commit is contained in:
@@ -266,16 +266,6 @@ fuse_extattr_check_cred(struct vnode *vp, int ns, struct ucred *cred,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get a filehandle for a directory */
|
|
||||||
static int
|
|
||||||
fuse_filehandle_get_dir(struct vnode *vp, struct fuse_filehandle **fufhp,
|
|
||||||
struct ucred *cred, pid_t pid)
|
|
||||||
{
|
|
||||||
if (fuse_filehandle_get(vp, FREAD, fufhp, cred, pid) == 0)
|
|
||||||
return 0;
|
|
||||||
return fuse_filehandle_get(vp, FEXEC, fufhp, cred, pid);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Send FUSE_FLUSH for this vnode */
|
/* Send FUSE_FLUSH for this vnode */
|
||||||
static int
|
static int
|
||||||
fuse_flush(struct vnode *vp, struct ucred *cred, pid_t pid, int fflag)
|
fuse_flush(struct vnode *vp, struct ucred *cred, pid_t pid, int fflag)
|
||||||
@@ -2063,7 +2053,7 @@ fuse_vnop_readdir(struct vop_readdir_args *ap)
|
|||||||
return (EXTERROR(EINVAL, "Buffer is too small"));
|
return (EXTERROR(EINVAL, "Buffer is too small"));
|
||||||
|
|
||||||
tresid = uio->uio_resid;
|
tresid = uio->uio_resid;
|
||||||
err = fuse_filehandle_get_dir(vp, &fufh, cred, pid);
|
err = fuse_filehandle_get(vp, FREAD, &fufh, cred, pid);
|
||||||
if (err == EBADF && mp->mnt_flag & MNT_EXPORTED) {
|
if (err == EBADF && mp->mnt_flag & MNT_EXPORTED) {
|
||||||
KASSERT(!fsess_is_impl(mp, FUSE_OPENDIR),
|
KASSERT(!fsess_is_impl(mp, FUSE_OPENDIR),
|
||||||
("FUSE file systems that implement "
|
("FUSE file systems that implement "
|
||||||
|
|||||||
Reference in New Issue
Block a user