diff options
author | Jim Garlick <garlick@llnl.gov> | 2012-02-26 15:49:57 -0500 |
---|---|---|
committer | Eric Van Hensbergen <ericvh@gmail.com> | 2012-02-26 15:49:57 -0500 |
commit | 208f3c28aab706fca2bc1bae7091da8a99c5e322 (patch) | |
tree | aa05253f7dece741e2a9a90a0fad2879a54b2039 /net | |
parent | a314f2748e76c866222a18e639c640d584d277fb (diff) |
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: Jim Garlick <garlick@llnl.gov>
Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/9p/client.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/net/9p/client.c b/net/9p/client.c index 6efbb334c3ad..b23a17c431c8 100644 --- a/net/9p/client.c +++ b/net/9p/client.c | |||
@@ -1428,6 +1428,7 @@ int p9_client_clunk(struct p9_fid *fid) | |||
1428 | int err; | 1428 | int err; |
1429 | struct p9_client *clnt; | 1429 | struct p9_client *clnt; |
1430 | struct p9_req_t *req; | 1430 | struct p9_req_t *req; |
1431 | int retries = 0; | ||
1431 | 1432 | ||
1432 | if (!fid) { | 1433 | if (!fid) { |
1433 | pr_warn("%s (%d): Trying to clunk with NULL fid\n", | 1434 | pr_warn("%s (%d): Trying to clunk with NULL fid\n", |
@@ -1436,7 +1437,9 @@ int p9_client_clunk(struct p9_fid *fid) | |||
1436 | return 0; | 1437 | return 0; |
1437 | } | 1438 | } |
1438 | 1439 | ||
1439 | p9_debug(P9_DEBUG_9P, ">>> TCLUNK fid %d\n", fid->fid); | 1440 | again: |
1441 | p9_debug(P9_DEBUG_9P, ">>> TCLUNK fid %d (try %d)\n", fid->fid, | ||
1442 | retries); | ||
1440 | err = 0; | 1443 | err = 0; |
1441 | clnt = fid->clnt; | 1444 | clnt = fid->clnt; |
1442 | 1445 | ||
@@ -1452,8 +1455,14 @@ int p9_client_clunk(struct p9_fid *fid) | |||
1452 | error: | 1455 | error: |
1453 | /* | 1456 | /* |
1454 | * Fid is not valid even after a failed clunk | 1457 | * Fid is not valid even after a failed clunk |
1458 | * If interrupted, retry once then give up and | ||
1459 | * leak fid until umount. | ||
1455 | */ | 1460 | */ |
1456 | p9_fid_destroy(fid); | 1461 | if (err == -ERESTARTSYS) { |
1462 | if (retries++ == 0) | ||
1463 | goto again; | ||
1464 | } else | ||
1465 | p9_fid_destroy(fid); | ||
1457 | return err; | 1466 | return err; |
1458 | } | 1467 | } |
1459 | EXPORT_SYMBOL(p9_client_clunk); | 1468 | EXPORT_SYMBOL(p9_client_clunk); |
@@ -1478,7 +1487,10 @@ int p9_client_remove(struct p9_fid *fid) | |||
1478 | 1487 | ||
1479 | p9_free_req(clnt, req); | 1488 | p9_free_req(clnt, req); |
1480 | error: | 1489 | error: |
1481 | p9_fid_destroy(fid); | 1490 | if (err == -ERESTARTSYS) |
1491 | p9_client_clunk(fid); | ||
1492 | else | ||
1493 | p9_fid_destroy(fid); | ||
1482 | return err; | 1494 | return err; |
1483 | } | 1495 | } |
1484 | EXPORT_SYMBOL(p9_client_remove); | 1496 | EXPORT_SYMBOL(p9_client_remove); |