Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 208f3c28 authored by Jim Garlick's avatar Jim Garlick Committed by Eric Van Hensbergen
Browse files

net/9p: handle flushed Tclunk/Tremove



When a Tclunk or Tremove request is flushed, the fid is not freed on the
server.

p9_client_clunk() should retry once on interrupt, then if interrupted
again, leak the fid for the duration of the connection.

p9_client_remove() should call p9_client_clunk() on interrupt
instead of unconditionally destroying the fid.

Signed-off-by: default avatarJim Garlick <garlick@llnl.gov>
Signed-off-by: default avatarEric Van Hensbergen <ericvh@gmail.com>
parent a314f274
Loading
Loading
Loading
Loading
+15 −3
Original line number Diff line number Diff line
@@ -1428,6 +1428,7 @@ int p9_client_clunk(struct p9_fid *fid)
	int err;
	struct p9_client *clnt;
	struct p9_req_t *req;
	int retries = 0;

	if (!fid) {
		pr_warn("%s (%d): Trying to clunk with NULL fid\n",
@@ -1436,7 +1437,9 @@ int p9_client_clunk(struct p9_fid *fid)
		return 0;
	}

	p9_debug(P9_DEBUG_9P, ">>> TCLUNK fid %d\n", fid->fid);
again:
	p9_debug(P9_DEBUG_9P, ">>> TCLUNK fid %d (try %d)\n", fid->fid,
								retries);
	err = 0;
	clnt = fid->clnt;

@@ -1452,7 +1455,13 @@ int p9_client_clunk(struct p9_fid *fid)
error:
	/*
	 * Fid is not valid even after a failed clunk
	 * If interrupted, retry once then give up and
	 * leak fid until umount.
	 */
	if (err == -ERESTARTSYS) {
		if (retries++ == 0)
			goto again;
	} else
		p9_fid_destroy(fid);
	return err;
}
@@ -1478,6 +1487,9 @@ int p9_client_remove(struct p9_fid *fid)

	p9_free_req(clnt, req);
error:
	if (err == -ERESTARTSYS)
		p9_client_clunk(fid);
	else
		p9_fid_destroy(fid);
	return err;
}