Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F160316057
D57096.id179373.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
19 KB
Referenced Files
None
Subscribers
None
D57096.id179373.diff
View Options
diff --git a/sys/fs/p9fs/p9_client.h b/sys/fs/p9fs/p9_client.h
--- a/sys/fs/p9fs/p9_client.h
+++ b/sys/fs/p9fs/p9_client.h
@@ -102,7 +102,6 @@
struct p9_qid qid; /* server identifier */
uint32_t mtu; /* max transferrable unit at a time */
uid_t uid; /* numeric uid of the local user who owns this handle */
- int v_opens; /* keep count on the number of opens called with this fiel handle */
STAILQ_ENTRY(p9_fid) fid_next; /* points to next fid in the list */
};
diff --git a/sys/fs/p9fs/p9fs.h b/sys/fs/p9fs/p9fs.h
--- a/sys/fs/p9fs/p9fs.h
+++ b/sys/fs/p9fs/p9fs.h
@@ -88,21 +88,33 @@
"VOFID List lock", NULL, MTX_DEF)
#define P9FS_VOFID_LOCK_DESTROY(_sc) mtx_destroy(P9FS_VOFID_MTX(_sc))
+#define P9FS_FID_MTX(_sc) (&(_sc)->fid_mtx)
+#define P9FS_FID_LOCK(_sc) mtx_lock(P9FS_FID_MTX(_sc))
+#define P9FS_FID_UNLOCK(_sc) mtx_unlock(P9FS_FID_MTX(_sc))
+#define P9FS_FID_LOCK_INIT(_sc) mtx_init(P9FS_FID_MTX(_sc), \
+ "p9fs_lookup fid lock", NULL, MTX_DEF)
+#define P9FS_FID_LOCK_DESTROY(_sc) mtx_destroy(P9FS_FID_MTX(_sc))
+
#define VFID 0x01
#define VOFID 0x02
+/* FID removal flags */
+#define REMOVE_VFID 1
+#define REMOVE_VOFID 2
+#define REMOVE_ALL 3
+
/* A Plan9 node. */
struct p9fs_node {
STAILQ_HEAD( ,p9_fid) vfid_list; /* vfid related to uid */
struct mtx vfid_mtx; /* mutex for vfid list */
STAILQ_HEAD( ,p9_fid) vofid_list; /* vofid related to uid */
struct mtx vofid_mtx; /* mutex for vofid list */
- struct p9fs_node *parent; /* pointer to parent p9fs node */
struct p9fs_qid vqid; /* the server qid, will be from the host */
struct vnode *v_node; /* vnode for this fs_node. */
struct p9fs_inode inode; /* in memory representation of ondisk information*/
struct p9fs_session *p9fs_ses; /* Session_ptr for this node */
- STAILQ_ENTRY(p9fs_node) p9fs_node_next;
+ struct mtx fid_mtx; /* mutex for fid during vop_lookup */
+ struct p9_fid *gfid; /* generic fid */
u_int flags;
};
@@ -152,7 +164,6 @@
const char *aname; /* name of remote file tree being mounted */
struct p9_client *clnt; /* 9p client */
struct mtx p9fs_mtx; /* mutex used for guarding the chain.*/
- STAILQ_HEAD( ,p9fs_node) virt_node_list; /* list of p9fs nodes in this session*/
struct p9_fid *mnt_fid; /* to save nobody 's fid for unmounting as root user */
unsigned int name_max; /* cached max filename length */
};
@@ -196,12 +207,14 @@
void p9fs_destroy_node(struct p9fs_node **npp);
void p9fs_dispose_node(struct p9fs_node **npp);
void p9fs_cleanup(struct p9fs_node *vp);
-void p9fs_fid_remove_all(struct p9fs_node *np, int leave_ofids);
+void p9fs_fid_remove_all(struct p9fs_node *np, int remove_fids);
void p9fs_fid_remove(struct p9fs_node *np, struct p9_fid *vfid,
int fid_type);
void p9fs_fid_add(struct p9fs_node *np, struct p9_fid *fid,
int fid_type);
struct p9_fid *p9fs_get_fid(struct p9_client *clnt,
struct p9fs_node *np, struct ucred *cred, int fid_type, int mode, int *error);
+struct p9_fid *p9fs_get_or_add_fid(struct p9fs_node *node,
+ struct p9_fid *fid, struct ucred *cr, int *error);
#endif /* FS_P9FS_P9FS_H */
diff --git a/sys/fs/p9fs/p9fs_subr.c b/sys/fs/p9fs/p9fs_subr.c
--- a/sys/fs/p9fs/p9fs_subr.c
+++ b/sys/fs/p9fs/p9fs_subr.c
@@ -114,8 +114,6 @@
P9_DEBUG(SUBR, "%s: attach successful fid :%p\n", __func__, fid);
fid->uid = vses->uid;
- /* initialize the node list for the session */
- STAILQ_INIT(&vses->virt_node_list);
P9FS_LOCK_INIT(vses);
P9_DEBUG(SUBR, "%s: INIT session successful\n", __func__);
@@ -132,20 +130,10 @@
{
struct p9fs_session *vses;
struct p9fs_mount *vmp;
- struct p9fs_node *np, *pnp, *tmp;
vmp = VFSTOP9(mp);
vses = &vmp->p9fs_session;
- /* break the node->parent references */
- STAILQ_FOREACH_SAFE(np, &vses->virt_node_list, p9fs_node_next, tmp) {
- if (np->parent && np->parent != np) {
- pnp = np->parent;
- np->parent = NULL;
- vrele(P9FS_NTOV(pnp));
- }
- }
-
/* We are about to teardown, we dont allow anything other than clunk after this.*/
p9_client_begin_disconnect(vses->clnt);
}
@@ -187,16 +175,18 @@
* as well as destroy/clunk them.
*/
void
-p9fs_fid_remove_all(struct p9fs_node *np, int leave_ofids)
+p9fs_fid_remove_all(struct p9fs_node *np, int remove_fids)
{
struct p9_fid *fid, *tfid;
- STAILQ_FOREACH_SAFE(fid, &np->vfid_list, fid_next, tfid) {
- STAILQ_REMOVE(&np->vfid_list, fid, p9_fid, fid_next);
- p9_client_clunk(fid);
+ if (remove_fids & REMOVE_VFID) {
+ STAILQ_FOREACH_SAFE(fid, &np->vfid_list, fid_next, tfid) {
+ STAILQ_REMOVE(&np->vfid_list, fid, p9_fid, fid_next);
+ p9_client_clunk(fid);
+ }
}
- if (!leave_ofids) {
+ if (remove_fids & REMOVE_VOFID) {
STAILQ_FOREACH_SAFE(fid, &np->vofid_list, fid_next, tfid) {
STAILQ_REMOVE(&np->vofid_list, fid, p9_fid, fid_next);
p9_client_clunk(fid);
@@ -243,30 +233,6 @@
}
}
-/* Build the path from root to current directory */
-static int
-p9fs_get_full_path(struct p9fs_node *np, char ***names)
-{
- int i, n;
- struct p9fs_node *node;
- char **wnames;
-
- n = 0;
- for (node = np ; (node != NULL) && !IS_ROOT(node) ; node = node->parent)
- n++;
-
- if (node == NULL)
- return (0);
-
- wnames = malloc(n * sizeof(char *), M_TEMP, M_ZERO|M_WAITOK);
-
- for (i = n-1, node = np; i >= 0 ; i--, node = node->parent)
- wnames[i] = node->inode.i_name;
-
- *names = wnames;
- return (n);
-}
-
/*
* Return TRUE if this fid can be used for the requested mode.
*/
@@ -328,26 +294,20 @@
}
/*
- * Function returns the fid sturcture for a file corresponding to current user id.
- * First it searches in the fid list of the corresponding p9fs node.
- * New fid will be created if not already present and added in the corresponding
- * fid list in the p9fs node.
- * If the user is not already attached then this will attach the user first
- * and then create a new fid for this particular file by doing dir walk.
+ * Function returns the fid structure for a file corresponding to current user id.
+ * It searches in the fid list of the corresponding p9fs node.
+ * If the node is not the root and a fid is not found, it will return NULL.
+ * Otherwise, if it needs to attach the user, it will do so.
*/
-struct p9_fid *
-p9fs_get_fid(struct p9_client *clnt, struct p9fs_node *np, struct ucred *cred,
+static struct p9_fid *
+p9fs_fetch_fid(struct p9_client *clnt, struct p9fs_node *np, struct ucred *cred,
int fid_type, int mode, int *error)
{
uid_t uid;
- struct p9_fid *fid, *oldfid;
+ struct p9_fid *fid;
struct p9fs_node *root;
struct p9fs_session *vses;
- int i, l, clone;
- char **wnames = NULL;
- uint16_t nwnames;
- oldfid = NULL;
vses = np->p9fs_ses;
if (vses->flags & P9_ACCESS_ANY)
@@ -359,12 +319,13 @@
/*
* Search for the fid in corresponding fid list.
- * We should return NULL for VOFID if it is not present in the list.
- * Because VOFID should have been created during the file open.
- * If VFID is not present in the list then we should create one.
+ * We should return NULL for VOFIDs because they should
+ * have been created during VOP_OPEN. For VFIDs,
+ * let p9fs_get_fid() handle the case we don't find one,
+ * except if this node is the root node.
*/
fid = p9fs_get_fid_from_uid(np, uid, fid_type, mode);
- if (fid != NULL || fid_type == VOFID)
+ if (fid != NULL || !IS_ROOT(np) || fid_type == VOFID)
return (fid);
/* Check root if the user is attached */
@@ -379,37 +340,40 @@
p9fs_fid_add(root, fid, fid_type);
}
- /* If we are looking for root then return it */
- if (IS_ROOT(np))
- return (fid);
+ return (fid);
+}
- /* Get full path from root to p9fs node */
- nwnames = p9fs_get_full_path(np, &wnames);
+struct p9_fid *
+p9fs_get_fid(struct p9_client *clnt, struct p9fs_node *np, struct ucred *cred,
+ int fid_type, int mode, int *error)
+{
+ struct p9_fid *fid;
+
+ fid = p9fs_fetch_fid(clnt, np, cred, fid_type, mode, error);
+ if (*error != 0)
+ return (NULL);
+ if (fid == NULL && fid_type == VFID)
+ return (np->gfid);
- /*
- * Could not get full path.
- * If p9fs node is not deleted, parent should exist.
- */
- KASSERT(nwnames != 0, ("%s: Directory of %s doesn't exist", __func__, np->inode.i_name));
-
- clone = 1;
- i = 0;
- while (i < nwnames) {
- l = MIN(nwnames - i, P9_MAXWELEM);
-
- fid = p9_client_walk(fid, l, wnames, clone, error);
- if (*error != 0) {
- if (oldfid)
- p9_client_clunk(oldfid);
- fid = NULL;
- goto bail_out;
- }
- oldfid = fid;
- clone = 0;
- i += l ;
- }
- p9fs_fid_add(np, fid, fid_type);
-bail_out:
- free(wnames, M_TEMP);
return (fid);
}
+
+/* Add the given fid if we don't find a suitable one */
+struct p9_fid *
+p9fs_get_or_add_fid(struct p9fs_node *node, struct p9_fid *fid, struct ucred *cr,
+ int *error)
+{
+ struct p9_fid *vfid;
+
+ P9FS_FID_LOCK(node);
+ vfid = p9fs_fetch_fid(node->p9fs_ses->clnt, node, cr, VFID, -1, error);
+ if (*error != 0) {
+ P9FS_FID_UNLOCK(node);
+ return (NULL);
+ }
+ if (vfid == NULL)
+ p9fs_fid_add(node, fid, VFID);
+ P9FS_FID_UNLOCK(node);
+
+ return (vfid);
+}
diff --git a/sys/fs/p9fs/p9fs_vfsops.c b/sys/fs/p9fs/p9fs_vfsops.c
--- a/sys/fs/p9fs/p9fs_vfsops.c
+++ b/sys/fs/p9fs/p9fs_vfsops.c
@@ -74,10 +74,6 @@
if (node == NULL)
return;
- if (node->parent && node->parent != node) {
- vrele(P9FS_NTOV(node->parent));
- }
-
P9_DEBUG(VOPS, "%s: node: %p\n", __func__, *npp);
vp = P9FS_NTOV(node);
@@ -231,6 +227,7 @@
/* Destroy the FID LIST locks */
P9FS_VFID_LOCK_DESTROY(np);
P9FS_VOFID_LOCK_DESTROY(np);
+ P9FS_FID_LOCK_DESTROY(np);
/* Dispose all node knowledge.*/
p9fs_dispose_node(&np);
@@ -265,6 +262,7 @@
uint32_t hash;
int error, error_reload = 0;
struct p9fs_inode *inode;
+ struct p9_fid *vfid;
td = curthread;
vmp = VFSTOP9(mp);
@@ -283,10 +281,13 @@
*vpp = vp;
return (0);
}
+ node = vp->v_data;
+ vfid = p9fs_get_or_add_fid(node, fid, curthread->td_ucred, &error);
error = p9fs_reload_stats_dotl(vp, curthread->td_ucred);
if (error != 0) {
- node = vp->v_data;
/* Remove stale vnode from hash list */
+ if (vfid == NULL)
+ p9fs_fid_remove(node, fid, VFID);
vfs_hash_remove(vp);
P9FS_NODE_SETF(node, P9FS_NODE_DELETED);
@@ -295,8 +296,9 @@
vp = NULL;
} else {
*vpp = vp;
- /* Clunk the new fid if not root */
- p9_client_clunk(fid);
+ /* Clunk the new fid if not root and we had it already */
+ if (vfid != NULL)
+ p9_client_clunk(fid);
return (0);
}
}
@@ -329,13 +331,16 @@
P9FS_VOFID_LOCK_INIT(np);
STAILQ_INIT(&np->vofid_list);
- vref(P9FS_NTOV(parent));
- np->parent = parent;
+ P9FS_FID_LOCK_INIT(np);
+
np->p9fs_ses = vses; /* Map the current session */
inode = &np->inode;
/*Fill the name of the file in inode */
inode->i_name = malloc(strlen(name)+1, M_TEMP, M_NOWAIT | M_ZERO);
strlcpy(inode->i_name, name, strlen(name)+1);
+
+ /* Create the generic fid for this node */
+ np->gfid = p9_client_walk(parent->gfid, 1, &name, 1, &error);
} else {
vp->v_type = VDIR; /* root vp is a directory */
vp->v_vflag |= VV_ROOT;
@@ -348,6 +353,9 @@
inode->i_qid_path = fid->qid.path;
P9FS_SET_LINKS(inode);
+ if (error)
+ goto out;
+
lockmgr(vp->v_vnlock, LK_EXCLUSIVE, NULL);
if (vp->v_type != VFIFO)
VN_LOCK_ASHARE(vp);
@@ -375,7 +383,6 @@
if (*vpp == NULL) {
P9FS_LOCK(vses);
- STAILQ_INSERT_TAIL(&vses->virt_node_list, np, p9fs_node_next);
P9FS_NODE_SETF(np, P9FS_NODE_IN_SESSION);
P9FS_UNLOCK(vses);
vn_set_state(vp, VSTATE_CONSTRUCTED);
@@ -393,7 +400,11 @@
return (0);
out:
/* Something went wrong, dispose the node */
- if (!IS_ROOT(np)) {
+ if (np->gfid != NULL)
+ p9_client_clunk(np->gfid);
+
+ /* Taken from D55755 */
+ if (np != NULL && !IS_ROOT(np)) {
p9fs_destroy_node(&np);
}
@@ -446,12 +457,18 @@
goto out;
}
+ /* Attach the generic user */
+ p9fs_root->gfid = p9_client_attach(vses->clnt, NULL, "generic", 0,
+ vses->aname, &error);
+ if (error)
+ goto out;
+
P9FS_VFID_LOCK_INIT(p9fs_root);
STAILQ_INIT(&p9fs_root->vfid_list);
p9fs_fid_add(p9fs_root, fid, VFID);
P9FS_VOFID_LOCK_INIT(p9fs_root);
STAILQ_INIT(&p9fs_root->vofid_list);
- p9fs_root->parent = p9fs_root;
+ P9FS_FID_LOCK_INIT(p9fs_root);
P9FS_NODE_SETF(p9fs_root, P9FS_NODE_ROOT);
p9fs_root->p9fs_ses = vses;
vfs_getnewfsid(mp);
diff --git a/sys/fs/p9fs/p9fs_vnops.c b/sys/fs/p9fs/p9fs_vnops.c
--- a/sys/fs/p9fs/p9fs_vnops.c
+++ b/sys/fs/p9fs/p9fs_vnops.c
@@ -111,24 +111,31 @@
if ((np->flags & P9FS_NODE_DELETED) == 0)
vfs_hash_remove(vp);
+ /* Taken from D55755 */
P9FS_LOCK(vses);
if ((np->flags & P9FS_NODE_IN_SESSION) != 0) {
P9FS_NODE_CLRF(np, P9FS_NODE_IN_SESSION);
- STAILQ_REMOVE(&vses->virt_node_list, np, p9fs_node, p9fs_node_next);
- } else {
P9FS_UNLOCK(vses);
- return;
- }
- P9FS_UNLOCK(vses);
- /* Invalidate all entries to a particular vnode. */
- cache_purge(vp);
+ /* Invalidate all entries to a particular vnode. */
+ cache_purge(vp);
- /* Destroy the vm object and flush associated pages. */
- vnode_destroy_vobject(vp);
+ /* Destroy the vm object and flush associated pages. */
+ vnode_destroy_vobject(vp);
+ } else {
+ /*
+ * The node was allocated in p9fs_vget_common but vfs_hash_insert()
+ * found a duplicate and called vgone() on us before we could
+ * add ourselves. We must still release FIDs and dispose the
+ * node to ensure vp->v_data is cleared before freevnode()
+ * checks it.
+ */
+ P9FS_UNLOCK(vses);
+ }
/* Remove all the FID */
- p9fs_fid_remove_all(np, FALSE);
+ p9fs_fid_remove_all(np, REMOVE_ALL);
+ p9_client_clunk(np->gfid);
/* Dispose all node knowledge.*/
p9fs_destroy_node(&np);
@@ -156,6 +163,7 @@
/*
* recycle vnodes which are no longer referenced i.e, their usecount is zero
+ * also close open file descriptors
*/
static int
p9fs_inactive(struct vop_inactive_args *ap)
@@ -166,7 +174,13 @@
vp = ap->a_vp;
np = P9FS_VTON(vp);
+ if (np == NULL)
+ return (0);
+
P9_DEBUG(VOPS, "%s: vp:%p node:%p file:%s\n", __func__, vp, np, np->inode.i_name);
+
+ p9fs_fid_remove_all(np, REMOVE_VOFID);
+
if (np->flags & P9FS_NODE_DELETED)
vrecycle(vp);
@@ -223,7 +237,7 @@
struct p9fs_node *np;
struct p9fs_session *vses;
struct mount *mp; /* Get the mount point */
- struct p9_fid *dvfid, *newfid;
+ struct p9_fid *dvfid, *newfid, *vfid;
uint64_t flags;
int error;
struct vattr vattr;
@@ -316,13 +330,25 @@
if (error == -1) {
vp = *vpp;
+ np = P9FS_VTON(vp);
/* Check if the entry in cache is stale or not */
- if ((p9fs_node_cmp(vp, &newfid->qid) == 0) &&
- ((error = VOP_GETATTR(vp, &vattr, cnp->cn_cred)) == 0)) {
- goto out;
+ if (p9fs_node_cmp(vp, &newfid->qid) == 0) {
+ error = 0;
+ vfid = p9fs_get_or_add_fid(np, newfid, cnp->cn_cred, &error);
+ if (error == 0) {
+ if (VOP_GETATTR(vp, &vattr, cnp->cn_cred) != 0) {
+ if (vfid == NULL)
+ p9fs_fid_remove(np, newfid, VFID);
+ } else {
+ if (vfid != NULL)
+ p9_client_clunk(newfid);
+ cnp->cn_nameptr[cnp->cn_namelen] = tmpchr;
+ return (0);
+ }
+ }
}
/*
- * This case, we have an error coming from getattr,
+ * This case, we have an error coming from getattr or fetching fid,
* act accordingly.
*/
cache_purge(vp);
@@ -332,6 +358,7 @@
vrele(vp);
*vpp = NULL;
+ np = NULL;
} else if (error == ENOENT) {
if (VN_IS_DOOMED(dvp))
goto out;
@@ -476,7 +503,6 @@
if (ofid != NULL) {
struct p9fs_node *np = P9FS_VTON(*vpp);
- ofid->v_opens = 0;
/*
* The 9P file creation request natively opens
* the file as part of the create operation and
@@ -718,7 +744,6 @@
*/
vofid = p9fs_get_fid(vses->clnt, np, ap->a_cred, VOFID, mode, &error);
if (vofid != NULL) {
- vofid->v_opens++;
return (0);
} else {
/*vofid is the open fid for this file.*/
@@ -731,7 +756,6 @@
if (error != 0)
p9_client_clunk(vofid);
else {
- vofid->v_opens = 1;
filesize = np->inode.i_size;
vnode_create_vobject(vp, filesize, ap->a_td);
p9fs_fid_add(np, vofid, VOFID);
@@ -741,17 +765,13 @@
}
/*
- * Close the open references. Just reduce the open count on vofid and return.
- * Let clunking of VOFID happen in p9fs_reclaim.
+ * Do nothing. Let clunking happen in p9fs_inactive and p9fs_reclaim.
*/
static int
p9fs_close(struct vop_close_args *ap)
{
struct vnode *vp;
struct p9fs_node *np;
- struct p9fs_session *vses;
- struct p9_fid *vofid;
- int error;
vp = ap->a_vp;
np = P9FS_VTON(vp);
@@ -759,21 +779,8 @@
if (np == NULL)
return (0);
- vses = np->p9fs_ses;
- error = 0;
-
P9_DEBUG(VOPS, "%s: file_name %s\n", __func__, np->inode.i_name);
- /*
- * Translate kernel fflags to 9p mode
- */
- vofid = p9fs_get_fid(vses->clnt, np, ap->a_cred, VOFID,
- p9fs_uflags_mode(ap->a_fflag, 1), &error);
- if (vofid == NULL)
- return (0);
-
- vofid->v_opens--;
-
return (0);
}
@@ -1301,21 +1308,15 @@
struct open_fid_state {
struct p9_fid *vofid;
- int fflags;
int opened;
};
-/*
- * TODO: change this to take P9PROTO_* mode and avoid routing through
- * VOP_OPEN, factoring out implementation of p9fs_open.
- */
static int
-p9fs_get_open_fid(struct vnode *vp, int fflags, struct ucred *cr, struct open_fid_state *statep)
+p9fs_get_open_fid(struct vnode *vp, int mode, struct ucred *cr, struct open_fid_state *statep)
{
struct p9fs_node *np;
struct p9fs_session *vses;
- struct p9_fid *vofid;
- int mode = p9fs_uflags_mode(fflags, TRUE);
+ struct p9_fid *vofid, *vfid;
int error = 0;
statep->opened = FALSE;
@@ -1324,15 +1325,19 @@
vses = np->p9fs_ses;
vofid = p9fs_get_fid(vses->clnt, np, cr, VOFID, mode, &error);
if (vofid == NULL) {
- error = VOP_OPEN(vp, fflags, cr, curthread, NULL);
+ vfid = p9fs_get_fid(vses->clnt, np, cr, VFID, -1, &error);
+ if (error)
+ return (error);
+
+ vofid = p9_client_walk(vfid, 0, NULL, 1, &error);
+ if (error)
+ return (error);
+
+ error = p9_client_open(vofid, mode);
if (error) {
+ p9_client_clunk(vofid);
return (error);
}
- vofid = p9fs_get_fid(vses->clnt, np, cr, VOFID, mode, &error);
- if (vofid == NULL) {
- return (EBADF);
- }
- statep->fflags = fflags;
statep->opened = TRUE;
}
statep->vofid = vofid;
@@ -1340,10 +1345,10 @@
}
static void
-p9fs_release_open_fid(struct vnode *vp, struct ucred *cr, struct open_fid_state *statep)
+p9fs_release_open_fid(struct open_fid_state *statep)
{
if (statep->opened) {
- (void) VOP_CLOSE(vp, statep->fflags, cr, curthread);
+ p9_client_clunk(statep->vofid);
}
}
@@ -1382,7 +1387,7 @@
if (uio->uio_offset < 0)
return (EINVAL);
- error = p9fs_get_open_fid(vp, FREAD, ap->a_cred, &ostate);
+ error = p9fs_get_open_fid(vp, P9PROTO_OREAD, ap->a_cred, &ostate);
if (error)
return (error);
@@ -1426,7 +1431,7 @@
uio->uio_offset = offset;
out:
uma_zfree(p9fs_io_buffer_zone, io_buffer);
- p9fs_release_open_fid(vp, ap->a_cred, &ostate);
+ p9fs_release_open_fid(&ostate);
return (error);
}
@@ -1458,7 +1463,7 @@
error = 0;
ioflag = ap->a_ioflag;
- error = p9fs_get_open_fid(vp, FWRITE, ap->a_cred, &ostate);
+ error = p9fs_get_open_fid(vp, P9PROTO_OWRITE, ap->a_cred, &ostate);
if (error)
return (error);
@@ -1533,7 +1538,7 @@
out:
if (io_buffer)
uma_zfree(p9fs_io_buffer_zone, io_buffer);
- p9fs_release_open_fid(vp, ap->a_cred, &ostate);
+ p9fs_release_open_fid(&ostate);
return (error);
}
@@ -1567,7 +1572,7 @@
/* Remove all non-open fids associated with the vp */
if (np->inode.i_links_count == 1)
- p9fs_fid_remove_all(np, TRUE);
+ p9fs_fid_remove_all(np, REMOVE_VFID);
/* Invalidate all entries of vnode from name cache and hash list. */
cache_purge(vp);
@@ -2072,7 +2077,7 @@
else
cr = bp->b_wcred;
- error = p9fs_get_open_fid(vp, bp->b_iocmd == BIO_READ ? FREAD : FWRITE, cr, &ostate);
+ error = p9fs_get_open_fid(vp, bp->b_iocmd == BIO_READ ? P9PROTO_OREAD : P9PROTO_OWRITE, cr, &ostate);
if (error) {
P9_DEBUG(ERROR, "%s: p9fs_get_open_fid failed: %d\n", __func__, error);
bp->b_error = error;
@@ -2082,7 +2087,7 @@
}
p9fs_doio(vp, bp, ostate.vofid, cr);
- p9fs_release_open_fid(vp, cr, &ostate);
+ p9fs_release_open_fid(&ostate);
return (0);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Jun 24, 4:57 AM (14 h, 55 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
34274398
Default Alt Text
D57096.id179373.diff (19 KB)
Attached To
Mode
D57096: Close files that were opened by guest VM via 9pfs
Attached
Detach File
Event Timeline
Log In to Comment