diff options
Diffstat (limited to 'net/9p/client.c')
-rw-r--r-- | net/9p/client.c | 59 |
1 files changed, 34 insertions, 25 deletions
diff --git a/net/9p/client.c b/net/9p/client.c index 67717f69412e..4b529454616d 100644 --- a/net/9p/client.c +++ b/net/9p/client.c | |||
@@ -189,6 +189,9 @@ static struct p9_req_t *p9_tag_alloc(struct p9_client *c, u16 tag) | |||
189 | printk(KERN_ERR "Couldn't grow tag array\n"); | 189 | printk(KERN_ERR "Couldn't grow tag array\n"); |
190 | kfree(req->tc); | 190 | kfree(req->tc); |
191 | kfree(req->rc); | 191 | kfree(req->rc); |
192 | kfree(req->wq); | ||
193 | req->tc = req->rc = NULL; | ||
194 | req->wq = NULL; | ||
192 | return ERR_PTR(-ENOMEM); | 195 | return ERR_PTR(-ENOMEM); |
193 | } | 196 | } |
194 | req->tc->sdata = (char *) req->tc + sizeof(struct p9_fcall); | 197 | req->tc->sdata = (char *) req->tc + sizeof(struct p9_fcall); |
@@ -311,12 +314,6 @@ static void p9_free_req(struct p9_client *c, struct p9_req_t *r) | |||
311 | r->status = REQ_STATUS_IDLE; | 314 | r->status = REQ_STATUS_IDLE; |
312 | if (tag != P9_NOTAG && p9_idpool_check(tag, c->tagpool)) | 315 | if (tag != P9_NOTAG && p9_idpool_check(tag, c->tagpool)) |
313 | p9_idpool_put(tag, c->tagpool); | 316 | p9_idpool_put(tag, c->tagpool); |
314 | |||
315 | /* if this was a flush request we have to free response fcall */ | ||
316 | if (r->rc->id == P9_RFLUSH) { | ||
317 | kfree(r->tc); | ||
318 | kfree(r->rc); | ||
319 | } | ||
320 | } | 317 | } |
321 | 318 | ||
322 | /** | 319 | /** |
@@ -611,19 +608,21 @@ reterr: | |||
611 | 608 | ||
612 | static struct p9_fid *p9_fid_create(struct p9_client *clnt) | 609 | static struct p9_fid *p9_fid_create(struct p9_client *clnt) |
613 | { | 610 | { |
614 | int err; | 611 | int ret; |
615 | struct p9_fid *fid; | 612 | struct p9_fid *fid; |
613 | unsigned long flags; | ||
616 | 614 | ||
617 | P9_DPRINTK(P9_DEBUG_FID, "clnt %p\n", clnt); | 615 | P9_DPRINTK(P9_DEBUG_FID, "clnt %p\n", clnt); |
618 | fid = kmalloc(sizeof(struct p9_fid), GFP_KERNEL); | 616 | fid = kmalloc(sizeof(struct p9_fid), GFP_KERNEL); |
619 | if (!fid) | 617 | if (!fid) |
620 | return ERR_PTR(-ENOMEM); | 618 | return ERR_PTR(-ENOMEM); |
621 | 619 | ||
622 | fid->fid = p9_idpool_get(clnt->fidpool); | 620 | ret = p9_idpool_get(clnt->fidpool); |
623 | if (fid->fid < 0) { | 621 | if (fid->fid < 0) { |
624 | err = -ENOSPC; | 622 | ret = -ENOSPC; |
625 | goto error; | 623 | goto error; |
626 | } | 624 | } |
625 | fid->fid = ret; | ||
627 | 626 | ||
628 | memset(&fid->qid, 0, sizeof(struct p9_qid)); | 627 | memset(&fid->qid, 0, sizeof(struct p9_qid)); |
629 | fid->mode = -1; | 628 | fid->mode = -1; |
@@ -632,27 +631,28 @@ static struct p9_fid *p9_fid_create(struct p9_client *clnt) | |||
632 | fid->clnt = clnt; | 631 | fid->clnt = clnt; |
633 | fid->aux = NULL; | 632 | fid->aux = NULL; |
634 | 633 | ||
635 | spin_lock(&clnt->lock); | 634 | spin_lock_irqsave(&clnt->lock, flags); |
636 | list_add(&fid->flist, &clnt->fidlist); | 635 | list_add(&fid->flist, &clnt->fidlist); |
637 | spin_unlock(&clnt->lock); | 636 | spin_unlock_irqrestore(&clnt->lock, flags); |
638 | 637 | ||
639 | return fid; | 638 | return fid; |
640 | 639 | ||
641 | error: | 640 | error: |
642 | kfree(fid); | 641 | kfree(fid); |
643 | return ERR_PTR(err); | 642 | return ERR_PTR(ret); |
644 | } | 643 | } |
645 | 644 | ||
646 | static void p9_fid_destroy(struct p9_fid *fid) | 645 | static void p9_fid_destroy(struct p9_fid *fid) |
647 | { | 646 | { |
648 | struct p9_client *clnt; | 647 | struct p9_client *clnt; |
648 | unsigned long flags; | ||
649 | 649 | ||
650 | P9_DPRINTK(P9_DEBUG_FID, "fid %d\n", fid->fid); | 650 | P9_DPRINTK(P9_DEBUG_FID, "fid %d\n", fid->fid); |
651 | clnt = fid->clnt; | 651 | clnt = fid->clnt; |
652 | p9_idpool_put(fid->fid, clnt->fidpool); | 652 | p9_idpool_put(fid->fid, clnt->fidpool); |
653 | spin_lock(&clnt->lock); | 653 | spin_lock_irqsave(&clnt->lock, flags); |
654 | list_del(&fid->flist); | 654 | list_del(&fid->flist); |
655 | spin_unlock(&clnt->lock); | 655 | spin_unlock_irqrestore(&clnt->lock, flags); |
656 | kfree(fid); | 656 | kfree(fid); |
657 | } | 657 | } |
658 | 658 | ||
@@ -818,7 +818,9 @@ struct p9_fid *p9_client_attach(struct p9_client *clnt, struct p9_fid *afid, | |||
818 | } | 818 | } |
819 | 819 | ||
820 | P9_DPRINTK(P9_DEBUG_9P, "<<< RATTACH qid %x.%llx.%x\n", | 820 | P9_DPRINTK(P9_DEBUG_9P, "<<< RATTACH qid %x.%llx.%x\n", |
821 | qid.type, qid.path, qid.version); | 821 | qid.type, |
822 | (unsigned long long)qid.path, | ||
823 | qid.version); | ||
822 | 824 | ||
823 | memmove(&fid->qid, &qid, sizeof(struct p9_qid)); | 825 | memmove(&fid->qid, &qid, sizeof(struct p9_qid)); |
824 | 826 | ||
@@ -865,7 +867,9 @@ p9_client_auth(struct p9_client *clnt, char *uname, u32 n_uname, char *aname) | |||
865 | } | 867 | } |
866 | 868 | ||
867 | P9_DPRINTK(P9_DEBUG_9P, "<<< RAUTH qid %x.%llx.%x\n", | 869 | P9_DPRINTK(P9_DEBUG_9P, "<<< RAUTH qid %x.%llx.%x\n", |
868 | qid.type, qid.path, qid.version); | 870 | qid.type, |
871 | (unsigned long long)qid.path, | ||
872 | qid.version); | ||
869 | 873 | ||
870 | memmove(&afid->qid, &qid, sizeof(struct p9_qid)); | 874 | memmove(&afid->qid, &qid, sizeof(struct p9_qid)); |
871 | p9_free_req(clnt, req); | 875 | p9_free_req(clnt, req); |
@@ -930,7 +934,8 @@ struct p9_fid *p9_client_walk(struct p9_fid *oldfid, int nwname, char **wnames, | |||
930 | 934 | ||
931 | for (count = 0; count < nwqids; count++) | 935 | for (count = 0; count < nwqids; count++) |
932 | P9_DPRINTK(P9_DEBUG_9P, "<<< [%d] %x.%llx.%x\n", | 936 | P9_DPRINTK(P9_DEBUG_9P, "<<< [%d] %x.%llx.%x\n", |
933 | count, wqids[count].type, wqids[count].path, | 937 | count, wqids[count].type, |
938 | (unsigned long long)wqids[count].path, | ||
934 | wqids[count].version); | 939 | wqids[count].version); |
935 | 940 | ||
936 | if (nwname) | 941 | if (nwname) |
@@ -980,7 +985,9 @@ int p9_client_open(struct p9_fid *fid, int mode) | |||
980 | } | 985 | } |
981 | 986 | ||
982 | P9_DPRINTK(P9_DEBUG_9P, "<<< ROPEN qid %x.%llx.%x iounit %x\n", | 987 | P9_DPRINTK(P9_DEBUG_9P, "<<< ROPEN qid %x.%llx.%x iounit %x\n", |
983 | qid.type, qid.path, qid.version, iounit); | 988 | qid.type, |
989 | (unsigned long long)qid.path, | ||
990 | qid.version, iounit); | ||
984 | 991 | ||
985 | fid->mode = mode; | 992 | fid->mode = mode; |
986 | fid->iounit = iounit; | 993 | fid->iounit = iounit; |
@@ -1023,7 +1030,9 @@ int p9_client_fcreate(struct p9_fid *fid, char *name, u32 perm, int mode, | |||
1023 | } | 1030 | } |
1024 | 1031 | ||
1025 | P9_DPRINTK(P9_DEBUG_9P, "<<< RCREATE qid %x.%llx.%x iounit %x\n", | 1032 | P9_DPRINTK(P9_DEBUG_9P, "<<< RCREATE qid %x.%llx.%x iounit %x\n", |
1026 | qid.type, qid.path, qid.version, iounit); | 1033 | qid.type, |
1034 | (unsigned long long)qid.path, | ||
1035 | qid.version, iounit); | ||
1027 | 1036 | ||
1028 | fid->mode = mode; | 1037 | fid->mode = mode; |
1029 | fid->iounit = iounit; | 1038 | fid->iounit = iounit; |
@@ -1230,9 +1239,9 @@ struct p9_wstat *p9_client_stat(struct p9_fid *fid) | |||
1230 | "<<< name=%s uid=%s gid=%s muid=%s extension=(%s)\n" | 1239 | "<<< name=%s uid=%s gid=%s muid=%s extension=(%s)\n" |
1231 | "<<< uid=%d gid=%d n_muid=%d\n", | 1240 | "<<< uid=%d gid=%d n_muid=%d\n", |
1232 | ret->size, ret->type, ret->dev, ret->qid.type, | 1241 | ret->size, ret->type, ret->dev, ret->qid.type, |
1233 | ret->qid.path, ret->qid.version, ret->mode, | 1242 | (unsigned long long)ret->qid.path, ret->qid.version, ret->mode, |
1234 | ret->atime, ret->mtime, ret->length, ret->name, | 1243 | ret->atime, ret->mtime, (unsigned long long)ret->length, |
1235 | ret->uid, ret->gid, ret->muid, ret->extension, | 1244 | ret->name, ret->uid, ret->gid, ret->muid, ret->extension, |
1236 | ret->n_uid, ret->n_gid, ret->n_muid); | 1245 | ret->n_uid, ret->n_gid, ret->n_muid); |
1237 | 1246 | ||
1238 | free_and_error: | 1247 | free_and_error: |
@@ -1255,9 +1264,9 @@ int p9_client_wstat(struct p9_fid *fid, struct p9_wstat *wst) | |||
1255 | " name=%s uid=%s gid=%s muid=%s extension=(%s)\n" | 1264 | " name=%s uid=%s gid=%s muid=%s extension=(%s)\n" |
1256 | " uid=%d gid=%d n_muid=%d\n", | 1265 | " uid=%d gid=%d n_muid=%d\n", |
1257 | wst->size, wst->type, wst->dev, wst->qid.type, | 1266 | wst->size, wst->type, wst->dev, wst->qid.type, |
1258 | wst->qid.path, wst->qid.version, wst->mode, | 1267 | (unsigned long long)wst->qid.path, wst->qid.version, wst->mode, |
1259 | wst->atime, wst->mtime, wst->length, wst->name, | 1268 | wst->atime, wst->mtime, (unsigned long long)wst->length, |
1260 | wst->uid, wst->gid, wst->muid, wst->extension, | 1269 | wst->name, wst->uid, wst->gid, wst->muid, wst->extension, |
1261 | wst->n_uid, wst->n_gid, wst->n_muid); | 1270 | wst->n_uid, wst->n_gid, wst->n_muid); |
1262 | err = 0; | 1271 | err = 0; |
1263 | clnt = fid->clnt; | 1272 | clnt = fid->clnt; |