diff options
author | David Howells <dhowells@redhat.com> | 2019-05-09 17:22:50 -0400 |
---|---|---|
committer | David Howells <dhowells@redhat.com> | 2019-05-16 11:25:21 -0400 |
commit | ffba718e935402e7f42b8cd5d1e00e4a3907d361 (patch) | |
tree | a77dadcb55b3cc56cbb1f8a583448944214ba163 /fs/afs | |
parent | fefb2483dc10c736e4235984fed4f3a61c99e1c2 (diff) |
afs: Get rid of afs_call::reply[]
Replace the afs_call::reply[] array with a bunch of typed members so that
the compiler can use type-checking on them. It's also easier for the eye
to see what's going on.
Signed-off-by: David Howells <dhowells@redhat.com>
Diffstat (limited to 'fs/afs')
-rw-r--r-- | fs/afs/cmservice.c | 14 | ||||
-rw-r--r-- | fs/afs/file.c | 2 | ||||
-rw-r--r-- | fs/afs/flock.c | 2 | ||||
-rw-r--r-- | fs/afs/fs_probe.c | 4 | ||||
-rw-r--r-- | fs/afs/fsclient.c | 287 | ||||
-rw-r--r-- | fs/afs/internal.h | 24 | ||||
-rw-r--r-- | fs/afs/rxrpc.c | 9 | ||||
-rw-r--r-- | fs/afs/vl_probe.c | 4 | ||||
-rw-r--r-- | fs/afs/vlclient.c | 33 | ||||
-rw-r--r-- | fs/afs/yfsclient.c | 217 |
10 files changed, 293 insertions, 303 deletions
diff --git a/fs/afs/cmservice.c b/fs/afs/cmservice.c index 748090014519..01437cfe5432 100644 --- a/fs/afs/cmservice.c +++ b/fs/afs/cmservice.c | |||
@@ -213,7 +213,7 @@ static int afs_find_cm_server_by_peer(struct afs_call *call) | |||
213 | return 0; | 213 | return 0; |
214 | } | 214 | } |
215 | 215 | ||
216 | call->cm_server = server; | 216 | call->server = server; |
217 | return afs_record_cm_probe(call, server); | 217 | return afs_record_cm_probe(call, server); |
218 | } | 218 | } |
219 | 219 | ||
@@ -234,7 +234,7 @@ static int afs_find_cm_server_by_uuid(struct afs_call *call, | |||
234 | return 0; | 234 | return 0; |
235 | } | 235 | } |
236 | 236 | ||
237 | call->cm_server = server; | 237 | call->server = server; |
238 | return afs_record_cm_probe(call, server); | 238 | return afs_record_cm_probe(call, server); |
239 | } | 239 | } |
240 | 240 | ||
@@ -260,8 +260,8 @@ static void SRXAFSCB_CallBack(struct work_struct *work) | |||
260 | * server holds up change visibility till it receives our reply so as | 260 | * server holds up change visibility till it receives our reply so as |
261 | * to maintain cache coherency. | 261 | * to maintain cache coherency. |
262 | */ | 262 | */ |
263 | if (call->cm_server) | 263 | if (call->server) |
264 | afs_break_callbacks(call->cm_server, call->count, call->request); | 264 | afs_break_callbacks(call->server, call->count, call->request); |
265 | 265 | ||
266 | afs_send_empty_reply(call); | 266 | afs_send_empty_reply(call); |
267 | afs_put_call(call); | 267 | afs_put_call(call); |
@@ -376,10 +376,10 @@ static void SRXAFSCB_InitCallBackState(struct work_struct *work) | |||
376 | { | 376 | { |
377 | struct afs_call *call = container_of(work, struct afs_call, work); | 377 | struct afs_call *call = container_of(work, struct afs_call, work); |
378 | 378 | ||
379 | _enter("{%p}", call->cm_server); | 379 | _enter("{%p}", call->server); |
380 | 380 | ||
381 | if (call->cm_server) | 381 | if (call->server) |
382 | afs_init_callback_state(call->cm_server); | 382 | afs_init_callback_state(call->server); |
383 | afs_send_empty_reply(call); | 383 | afs_send_empty_reply(call); |
384 | afs_put_call(call); | 384 | afs_put_call(call); |
385 | _leave(""); | 385 | _leave(""); |
diff --git a/fs/afs/file.c b/fs/afs/file.c index f59c6149fa02..415c84dddb89 100644 --- a/fs/afs/file.c +++ b/fs/afs/file.c | |||
@@ -408,7 +408,7 @@ static int afs_readpage(struct file *file, struct page *page) | |||
408 | static void afs_readpages_page_done(struct afs_call *call, struct afs_read *req) | 408 | static void afs_readpages_page_done(struct afs_call *call, struct afs_read *req) |
409 | { | 409 | { |
410 | #ifdef CONFIG_AFS_FSCACHE | 410 | #ifdef CONFIG_AFS_FSCACHE |
411 | struct afs_vnode *vnode = call->reply[0]; | 411 | struct afs_vnode *vnode = call->xvnode; |
412 | #endif | 412 | #endif |
413 | struct page *page = req->pages[req->index]; | 413 | struct page *page = req->pages[req->index]; |
414 | 414 | ||
diff --git a/fs/afs/flock.c b/fs/afs/flock.c index c91cd201013f..ce8275940b99 100644 --- a/fs/afs/flock.c +++ b/fs/afs/flock.c | |||
@@ -74,7 +74,7 @@ static void afs_schedule_lock_extension(struct afs_vnode *vnode) | |||
74 | */ | 74 | */ |
75 | void afs_lock_op_done(struct afs_call *call) | 75 | void afs_lock_op_done(struct afs_call *call) |
76 | { | 76 | { |
77 | struct afs_vnode *vnode = call->reply[0]; | 77 | struct afs_vnode *vnode = call->xvnode; |
78 | 78 | ||
79 | if (call->error == 0) { | 79 | if (call->error == 0) { |
80 | spin_lock(&vnode->lock); | 80 | spin_lock(&vnode->lock); |
diff --git a/fs/afs/fs_probe.c b/fs/afs/fs_probe.c index 5d3abde52a0f..9b7266209343 100644 --- a/fs/afs/fs_probe.c +++ b/fs/afs/fs_probe.c | |||
@@ -33,8 +33,8 @@ static bool afs_fs_probe_done(struct afs_server *server) | |||
33 | void afs_fileserver_probe_result(struct afs_call *call) | 33 | void afs_fileserver_probe_result(struct afs_call *call) |
34 | { | 34 | { |
35 | struct afs_addr_list *alist = call->alist; | 35 | struct afs_addr_list *alist = call->alist; |
36 | struct afs_server *server = call->reply[0]; | 36 | struct afs_server *server = call->server; |
37 | unsigned int server_index = (long)call->reply[1]; | 37 | unsigned int server_index = call->server_index; |
38 | unsigned int index = call->addr_ix; | 38 | unsigned int index = call->addr_ix; |
39 | unsigned int rtt = UINT_MAX; | 39 | unsigned int rtt = UINT_MAX; |
40 | bool have_result = false; | 40 | bool have_result = false; |
diff --git a/fs/afs/fsclient.c b/fs/afs/fsclient.c index dc6f8da0dfa0..16bcc578e3b2 100644 --- a/fs/afs/fsclient.c +++ b/fs/afs/fsclient.c | |||
@@ -392,7 +392,7 @@ static void xdr_decode_AFSFetchVolumeStatus(const __be32 **_bp, | |||
392 | */ | 392 | */ |
393 | static int afs_deliver_fs_fetch_status_vnode(struct afs_call *call) | 393 | static int afs_deliver_fs_fetch_status_vnode(struct afs_call *call) |
394 | { | 394 | { |
395 | struct afs_vnode *vnode = call->reply[0]; | 395 | struct afs_vnode *vnode = call->xvnode; |
396 | const __be32 *bp; | 396 | const __be32 *bp; |
397 | int ret; | 397 | int ret; |
398 | 398 | ||
@@ -409,7 +409,7 @@ static int afs_deliver_fs_fetch_status_vnode(struct afs_call *call) | |||
409 | if (ret < 0) | 409 | if (ret < 0) |
410 | return ret; | 410 | return ret; |
411 | xdr_decode_AFSCallBack(call, vnode, &bp); | 411 | xdr_decode_AFSCallBack(call, vnode, &bp); |
412 | xdr_decode_AFSVolSync(&bp, call->reply[1]); | 412 | xdr_decode_AFSVolSync(&bp, call->out_volsync); |
413 | 413 | ||
414 | _leave(" = 0 [done]"); | 414 | _leave(" = 0 [done]"); |
415 | return 0; | 415 | return 0; |
@@ -450,8 +450,8 @@ int afs_fs_fetch_file_status(struct afs_fs_cursor *fc, struct afs_volsync *volsy | |||
450 | } | 450 | } |
451 | 451 | ||
452 | call->key = fc->key; | 452 | call->key = fc->key; |
453 | call->reply[0] = vnode; | 453 | call->xvnode = vnode; |
454 | call->reply[1] = volsync; | 454 | call->out_volsync = volsync; |
455 | call->expected_version = new_inode ? 1 : vnode->status.data_version; | 455 | call->expected_version = new_inode ? 1 : vnode->status.data_version; |
456 | call->want_reply_time = true; | 456 | call->want_reply_time = true; |
457 | 457 | ||
@@ -476,8 +476,8 @@ int afs_fs_fetch_file_status(struct afs_fs_cursor *fc, struct afs_volsync *volsy | |||
476 | */ | 476 | */ |
477 | static int afs_deliver_fs_fetch_data(struct afs_call *call) | 477 | static int afs_deliver_fs_fetch_data(struct afs_call *call) |
478 | { | 478 | { |
479 | struct afs_vnode *vnode = call->reply[0]; | 479 | struct afs_vnode *vnode = call->xvnode; |
480 | struct afs_read *req = call->reply[2]; | 480 | struct afs_read *req = call->read_request; |
481 | const __be32 *bp; | 481 | const __be32 *bp; |
482 | unsigned int size; | 482 | unsigned int size; |
483 | int ret; | 483 | int ret; |
@@ -578,7 +578,7 @@ static int afs_deliver_fs_fetch_data(struct afs_call *call) | |||
578 | if (ret < 0) | 578 | if (ret < 0) |
579 | return ret; | 579 | return ret; |
580 | xdr_decode_AFSCallBack(call, vnode, &bp); | 580 | xdr_decode_AFSCallBack(call, vnode, &bp); |
581 | xdr_decode_AFSVolSync(&bp, call->reply[1]); | 581 | xdr_decode_AFSVolSync(&bp, call->out_volsync); |
582 | 582 | ||
583 | call->unmarshall++; | 583 | call->unmarshall++; |
584 | 584 | ||
@@ -601,7 +601,7 @@ static int afs_deliver_fs_fetch_data(struct afs_call *call) | |||
601 | 601 | ||
602 | static void afs_fetch_data_destructor(struct afs_call *call) | 602 | static void afs_fetch_data_destructor(struct afs_call *call) |
603 | { | 603 | { |
604 | struct afs_read *req = call->reply[2]; | 604 | struct afs_read *req = call->read_request; |
605 | 605 | ||
606 | afs_put_read(req); | 606 | afs_put_read(req); |
607 | afs_flat_call_destructor(call); | 607 | afs_flat_call_destructor(call); |
@@ -641,9 +641,9 @@ static int afs_fs_fetch_data64(struct afs_fs_cursor *fc, struct afs_read *req) | |||
641 | return -ENOMEM; | 641 | return -ENOMEM; |
642 | 642 | ||
643 | call->key = fc->key; | 643 | call->key = fc->key; |
644 | call->reply[0] = vnode; | 644 | call->xvnode = vnode; |
645 | call->reply[1] = NULL; /* volsync */ | 645 | call->out_volsync = NULL; |
646 | call->reply[2] = req; | 646 | call->read_request = req; |
647 | call->expected_version = vnode->status.data_version; | 647 | call->expected_version = vnode->status.data_version; |
648 | call->want_reply_time = true; | 648 | call->want_reply_time = true; |
649 | 649 | ||
@@ -692,9 +692,9 @@ int afs_fs_fetch_data(struct afs_fs_cursor *fc, struct afs_read *req) | |||
692 | return -ENOMEM; | 692 | return -ENOMEM; |
693 | 693 | ||
694 | call->key = fc->key; | 694 | call->key = fc->key; |
695 | call->reply[0] = vnode; | 695 | call->xvnode = vnode; |
696 | call->reply[1] = NULL; /* volsync */ | 696 | call->out_volsync = NULL; |
697 | call->reply[2] = req; | 697 | call->read_request = req; |
698 | call->expected_version = vnode->status.data_version; | 698 | call->expected_version = vnode->status.data_version; |
699 | call->want_reply_time = true; | 699 | call->want_reply_time = true; |
700 | 700 | ||
@@ -721,7 +721,7 @@ int afs_fs_fetch_data(struct afs_fs_cursor *fc, struct afs_read *req) | |||
721 | */ | 721 | */ |
722 | static int afs_deliver_fs_create_vnode(struct afs_call *call) | 722 | static int afs_deliver_fs_create_vnode(struct afs_call *call) |
723 | { | 723 | { |
724 | struct afs_vnode *vnode = call->reply[0]; | 724 | struct afs_vnode *dvnode = call->dvnode; |
725 | const __be32 *bp; | 725 | const __be32 *bp; |
726 | int ret; | 726 | int ret; |
727 | 727 | ||
@@ -733,16 +733,16 @@ static int afs_deliver_fs_create_vnode(struct afs_call *call) | |||
733 | 733 | ||
734 | /* unmarshall the reply once we've received all of it */ | 734 | /* unmarshall the reply once we've received all of it */ |
735 | bp = call->buffer; | 735 | bp = call->buffer; |
736 | xdr_decode_AFSFid(&bp, call->reply[1]); | 736 | xdr_decode_AFSFid(&bp, call->out_fid); |
737 | ret = afs_decode_status(call, &bp, call->reply[2], NULL, NULL, NULL); | 737 | ret = afs_decode_status(call, &bp, call->out_extra_status, NULL, NULL, NULL); |
738 | if (ret < 0) | 738 | if (ret < 0) |
739 | return ret; | 739 | return ret; |
740 | ret = afs_decode_status(call, &bp, &vnode->status, vnode, | 740 | ret = afs_decode_status(call, &bp, &dvnode->status, dvnode, |
741 | &call->expected_version, NULL); | 741 | &call->expected_version, NULL); |
742 | if (ret < 0) | 742 | if (ret < 0) |
743 | return ret; | 743 | return ret; |
744 | xdr_decode_AFSCallBack_raw(call, call->reply[3], &bp); | 744 | xdr_decode_AFSCallBack_raw(call, call->out_cb, &bp); |
745 | /* xdr_decode_AFSVolSync(&bp, call->reply[X]); */ | 745 | xdr_decode_AFSVolSync(&bp, call->out_volsync); |
746 | 746 | ||
747 | _leave(" = 0 [done]"); | 747 | _leave(" = 0 [done]"); |
748 | return 0; | 748 | return 0; |
@@ -776,9 +776,9 @@ int afs_fs_create(struct afs_fs_cursor *fc, | |||
776 | struct afs_file_status *newstatus, | 776 | struct afs_file_status *newstatus, |
777 | struct afs_callback *newcb) | 777 | struct afs_callback *newcb) |
778 | { | 778 | { |
779 | struct afs_vnode *vnode = fc->vnode; | 779 | struct afs_vnode *dvnode = fc->vnode; |
780 | struct afs_call *call; | 780 | struct afs_call *call; |
781 | struct afs_net *net = afs_v2net(vnode); | 781 | struct afs_net *net = afs_v2net(dvnode); |
782 | size_t namesz, reqsz, padsz; | 782 | size_t namesz, reqsz, padsz; |
783 | __be32 *bp; | 783 | __be32 *bp; |
784 | 784 | ||
@@ -804,19 +804,19 @@ int afs_fs_create(struct afs_fs_cursor *fc, | |||
804 | return -ENOMEM; | 804 | return -ENOMEM; |
805 | 805 | ||
806 | call->key = fc->key; | 806 | call->key = fc->key; |
807 | call->reply[0] = vnode; | 807 | call->dvnode = dvnode; |
808 | call->reply[1] = newfid; | 808 | call->out_fid = newfid; |
809 | call->reply[2] = newstatus; | 809 | call->out_extra_status = newstatus; |
810 | call->reply[3] = newcb; | 810 | call->out_cb = newcb; |
811 | call->expected_version = current_data_version + 1; | 811 | call->expected_version = current_data_version + 1; |
812 | call->want_reply_time = true; | 812 | call->want_reply_time = true; |
813 | 813 | ||
814 | /* marshall the parameters */ | 814 | /* marshall the parameters */ |
815 | bp = call->request; | 815 | bp = call->request; |
816 | *bp++ = htonl(S_ISDIR(mode) ? FSMAKEDIR : FSCREATEFILE); | 816 | *bp++ = htonl(S_ISDIR(mode) ? FSMAKEDIR : FSCREATEFILE); |
817 | *bp++ = htonl(vnode->fid.vid); | 817 | *bp++ = htonl(dvnode->fid.vid); |
818 | *bp++ = htonl(vnode->fid.vnode); | 818 | *bp++ = htonl(dvnode->fid.vnode); |
819 | *bp++ = htonl(vnode->fid.unique); | 819 | *bp++ = htonl(dvnode->fid.unique); |
820 | *bp++ = htonl(namesz); | 820 | *bp++ = htonl(namesz); |
821 | memcpy(bp, name, namesz); | 821 | memcpy(bp, name, namesz); |
822 | bp = (void *) bp + namesz; | 822 | bp = (void *) bp + namesz; |
@@ -825,26 +825,26 @@ int afs_fs_create(struct afs_fs_cursor *fc, | |||
825 | bp = (void *) bp + padsz; | 825 | bp = (void *) bp + padsz; |
826 | } | 826 | } |
827 | *bp++ = htonl(AFS_SET_MODE | AFS_SET_MTIME); | 827 | *bp++ = htonl(AFS_SET_MODE | AFS_SET_MTIME); |
828 | *bp++ = htonl(vnode->vfs_inode.i_mtime.tv_sec); /* mtime */ | 828 | *bp++ = htonl(dvnode->vfs_inode.i_mtime.tv_sec); /* mtime */ |
829 | *bp++ = 0; /* owner */ | 829 | *bp++ = 0; /* owner */ |
830 | *bp++ = 0; /* group */ | 830 | *bp++ = 0; /* group */ |
831 | *bp++ = htonl(mode & S_IALLUGO); /* unix mode */ | 831 | *bp++ = htonl(mode & S_IALLUGO); /* unix mode */ |
832 | *bp++ = 0; /* segment size */ | 832 | *bp++ = 0; /* segment size */ |
833 | 833 | ||
834 | afs_use_fs_server(call, fc->cbi); | 834 | afs_use_fs_server(call, fc->cbi); |
835 | trace_afs_make_fs_call1(call, &vnode->fid, name); | 835 | trace_afs_make_fs_call1(call, &dvnode->fid, name); |
836 | afs_set_fc_call(call, fc); | 836 | afs_set_fc_call(call, fc); |
837 | afs_make_call(&fc->ac, call, GFP_NOFS); | 837 | afs_make_call(&fc->ac, call, GFP_NOFS); |
838 | return afs_wait_for_call_to_complete(call, &fc->ac); | 838 | return afs_wait_for_call_to_complete(call, &fc->ac); |
839 | } | 839 | } |
840 | 840 | ||
841 | /* | 841 | /* |
842 | * Deliver reply data to any operation that returns file status and volume | 842 | * Deliver reply data to any operation that returns directory status and volume |
843 | * sync. | 843 | * sync. |
844 | */ | 844 | */ |
845 | static int afs_deliver_fs_status_and_vol(struct afs_call *call) | 845 | static int afs_deliver_fs_dir_status_and_vol(struct afs_call *call) |
846 | { | 846 | { |
847 | struct afs_vnode *vnode = call->reply[0]; | 847 | struct afs_vnode *dvnode = call->dvnode; |
848 | const __be32 *bp; | 848 | const __be32 *bp; |
849 | int ret; | 849 | int ret; |
850 | 850 | ||
@@ -856,11 +856,11 @@ static int afs_deliver_fs_status_and_vol(struct afs_call *call) | |||
856 | 856 | ||
857 | /* unmarshall the reply once we've received all of it */ | 857 | /* unmarshall the reply once we've received all of it */ |
858 | bp = call->buffer; | 858 | bp = call->buffer; |
859 | ret = afs_decode_status(call, &bp, &vnode->status, vnode, | 859 | ret = afs_decode_status(call, &bp, &dvnode->status, dvnode, |
860 | &call->expected_version, NULL); | 860 | &call->expected_version, NULL); |
861 | if (ret < 0) | 861 | if (ret < 0) |
862 | return ret; | 862 | return ret; |
863 | /* xdr_decode_AFSVolSync(&bp, call->reply[X]); */ | 863 | xdr_decode_AFSVolSync(&bp, call->out_volsync); |
864 | 864 | ||
865 | _leave(" = 0 [done]"); | 865 | _leave(" = 0 [done]"); |
866 | return 0; | 866 | return 0; |
@@ -872,14 +872,14 @@ static int afs_deliver_fs_status_and_vol(struct afs_call *call) | |||
872 | static const struct afs_call_type afs_RXFSRemoveFile = { | 872 | static const struct afs_call_type afs_RXFSRemoveFile = { |
873 | .name = "FS.RemoveFile", | 873 | .name = "FS.RemoveFile", |
874 | .op = afs_FS_RemoveFile, | 874 | .op = afs_FS_RemoveFile, |
875 | .deliver = afs_deliver_fs_status_and_vol, | 875 | .deliver = afs_deliver_fs_dir_status_and_vol, |
876 | .destructor = afs_flat_call_destructor, | 876 | .destructor = afs_flat_call_destructor, |
877 | }; | 877 | }; |
878 | 878 | ||
879 | static const struct afs_call_type afs_RXFSRemoveDir = { | 879 | static const struct afs_call_type afs_RXFSRemoveDir = { |
880 | .name = "FS.RemoveDir", | 880 | .name = "FS.RemoveDir", |
881 | .op = afs_FS_RemoveDir, | 881 | .op = afs_FS_RemoveDir, |
882 | .deliver = afs_deliver_fs_status_and_vol, | 882 | .deliver = afs_deliver_fs_dir_status_and_vol, |
883 | .destructor = afs_flat_call_destructor, | 883 | .destructor = afs_flat_call_destructor, |
884 | }; | 884 | }; |
885 | 885 | ||
@@ -911,8 +911,8 @@ int afs_fs_remove(struct afs_fs_cursor *fc, struct afs_vnode *vnode, | |||
911 | return -ENOMEM; | 911 | return -ENOMEM; |
912 | 912 | ||
913 | call->key = fc->key; | 913 | call->key = fc->key; |
914 | call->reply[0] = dvnode; | 914 | call->dvnode = dvnode; |
915 | call->reply[1] = vnode; | 915 | call->xvnode = vnode; |
916 | call->expected_version = current_data_version + 1; | 916 | call->expected_version = current_data_version + 1; |
917 | 917 | ||
918 | /* marshall the parameters */ | 918 | /* marshall the parameters */ |
@@ -941,7 +941,7 @@ int afs_fs_remove(struct afs_fs_cursor *fc, struct afs_vnode *vnode, | |||
941 | */ | 941 | */ |
942 | static int afs_deliver_fs_link(struct afs_call *call) | 942 | static int afs_deliver_fs_link(struct afs_call *call) |
943 | { | 943 | { |
944 | struct afs_vnode *dvnode = call->reply[0], *vnode = call->reply[1]; | 944 | struct afs_vnode *dvnode = call->dvnode, *vnode = call->xvnode; |
945 | const __be32 *bp; | 945 | const __be32 *bp; |
946 | int ret; | 946 | int ret; |
947 | 947 | ||
@@ -960,7 +960,7 @@ static int afs_deliver_fs_link(struct afs_call *call) | |||
960 | &call->expected_version, NULL); | 960 | &call->expected_version, NULL); |
961 | if (ret < 0) | 961 | if (ret < 0) |
962 | return ret; | 962 | return ret; |
963 | /* xdr_decode_AFSVolSync(&bp, call->reply[X]); */ | 963 | xdr_decode_AFSVolSync(&bp, call->out_volsync); |
964 | 964 | ||
965 | _leave(" = 0 [done]"); | 965 | _leave(" = 0 [done]"); |
966 | return 0; | 966 | return 0; |
@@ -1002,8 +1002,8 @@ int afs_fs_link(struct afs_fs_cursor *fc, struct afs_vnode *vnode, | |||
1002 | return -ENOMEM; | 1002 | return -ENOMEM; |
1003 | 1003 | ||
1004 | call->key = fc->key; | 1004 | call->key = fc->key; |
1005 | call->reply[0] = dvnode; | 1005 | call->dvnode = dvnode; |
1006 | call->reply[1] = vnode; | 1006 | call->xvnode = vnode; |
1007 | call->expected_version = current_data_version + 1; | 1007 | call->expected_version = current_data_version + 1; |
1008 | 1008 | ||
1009 | /* marshall the parameters */ | 1009 | /* marshall the parameters */ |
@@ -1035,7 +1035,7 @@ int afs_fs_link(struct afs_fs_cursor *fc, struct afs_vnode *vnode, | |||
1035 | */ | 1035 | */ |
1036 | static int afs_deliver_fs_symlink(struct afs_call *call) | 1036 | static int afs_deliver_fs_symlink(struct afs_call *call) |
1037 | { | 1037 | { |
1038 | struct afs_vnode *vnode = call->reply[0]; | 1038 | struct afs_vnode *dvnode = call->dvnode; |
1039 | const __be32 *bp; | 1039 | const __be32 *bp; |
1040 | int ret; | 1040 | int ret; |
1041 | 1041 | ||
@@ -1047,15 +1047,15 @@ static int afs_deliver_fs_symlink(struct afs_call *call) | |||
1047 | 1047 | ||
1048 | /* unmarshall the reply once we've received all of it */ | 1048 | /* unmarshall the reply once we've received all of it */ |
1049 | bp = call->buffer; | 1049 | bp = call->buffer; |
1050 | xdr_decode_AFSFid(&bp, call->reply[1]); | 1050 | xdr_decode_AFSFid(&bp, call->out_fid); |
1051 | ret = afs_decode_status(call, &bp, call->reply[2], NULL, NULL, NULL); | 1051 | ret = afs_decode_status(call, &bp, call->out_extra_status, NULL, NULL, NULL); |
1052 | if (ret < 0) | 1052 | if (ret < 0) |
1053 | return ret; | 1053 | return ret; |
1054 | ret = afs_decode_status(call, &bp, &vnode->status, vnode, | 1054 | ret = afs_decode_status(call, &bp, &dvnode->status, dvnode, |
1055 | &call->expected_version, NULL); | 1055 | &call->expected_version, NULL); |
1056 | if (ret < 0) | 1056 | if (ret < 0) |
1057 | return ret; | 1057 | return ret; |
1058 | /* xdr_decode_AFSVolSync(&bp, call->reply[X]); */ | 1058 | xdr_decode_AFSVolSync(&bp, call->out_volsync); |
1059 | 1059 | ||
1060 | _leave(" = 0 [done]"); | 1060 | _leave(" = 0 [done]"); |
1061 | return 0; | 1061 | return 0; |
@@ -1081,9 +1081,9 @@ int afs_fs_symlink(struct afs_fs_cursor *fc, | |||
1081 | struct afs_fid *newfid, | 1081 | struct afs_fid *newfid, |
1082 | struct afs_file_status *newstatus) | 1082 | struct afs_file_status *newstatus) |
1083 | { | 1083 | { |
1084 | struct afs_vnode *vnode = fc->vnode; | 1084 | struct afs_vnode *dvnode = fc->vnode; |
1085 | struct afs_call *call; | 1085 | struct afs_call *call; |
1086 | struct afs_net *net = afs_v2net(vnode); | 1086 | struct afs_net *net = afs_v2net(dvnode); |
1087 | size_t namesz, reqsz, padsz, c_namesz, c_padsz; | 1087 | size_t namesz, reqsz, padsz, c_namesz, c_padsz; |
1088 | __be32 *bp; | 1088 | __be32 *bp; |
1089 | 1089 | ||
@@ -1107,17 +1107,17 @@ int afs_fs_symlink(struct afs_fs_cursor *fc, | |||
1107 | return -ENOMEM; | 1107 | return -ENOMEM; |
1108 | 1108 | ||
1109 | call->key = fc->key; | 1109 | call->key = fc->key; |
1110 | call->reply[0] = vnode; | 1110 | call->dvnode = dvnode; |
1111 | call->reply[1] = newfid; | 1111 | call->out_fid = newfid; |
1112 | call->reply[2] = newstatus; | 1112 | call->out_extra_status = newstatus; |
1113 | call->expected_version = current_data_version + 1; | 1113 | call->expected_version = current_data_version + 1; |
1114 | 1114 | ||
1115 | /* marshall the parameters */ | 1115 | /* marshall the parameters */ |
1116 | bp = call->request; | 1116 | bp = call->request; |
1117 | *bp++ = htonl(FSSYMLINK); | 1117 | *bp++ = htonl(FSSYMLINK); |
1118 | *bp++ = htonl(vnode->fid.vid); | 1118 | *bp++ = htonl(dvnode->fid.vid); |
1119 | *bp++ = htonl(vnode->fid.vnode); | 1119 | *bp++ = htonl(dvnode->fid.vnode); |
1120 | *bp++ = htonl(vnode->fid.unique); | 1120 | *bp++ = htonl(dvnode->fid.unique); |
1121 | *bp++ = htonl(namesz); | 1121 | *bp++ = htonl(namesz); |
1122 | memcpy(bp, name, namesz); | 1122 | memcpy(bp, name, namesz); |
1123 | bp = (void *) bp + namesz; | 1123 | bp = (void *) bp + namesz; |
@@ -1133,14 +1133,14 @@ int afs_fs_symlink(struct afs_fs_cursor *fc, | |||
1133 | bp = (void *) bp + c_padsz; | 1133 | bp = (void *) bp + c_padsz; |
1134 | } | 1134 | } |
1135 | *bp++ = htonl(AFS_SET_MODE | AFS_SET_MTIME); | 1135 | *bp++ = htonl(AFS_SET_MODE | AFS_SET_MTIME); |
1136 | *bp++ = htonl(vnode->vfs_inode.i_mtime.tv_sec); /* mtime */ | 1136 | *bp++ = htonl(dvnode->vfs_inode.i_mtime.tv_sec); /* mtime */ |
1137 | *bp++ = 0; /* owner */ | 1137 | *bp++ = 0; /* owner */ |
1138 | *bp++ = 0; /* group */ | 1138 | *bp++ = 0; /* group */ |
1139 | *bp++ = htonl(S_IRWXUGO); /* unix mode */ | 1139 | *bp++ = htonl(S_IRWXUGO); /* unix mode */ |
1140 | *bp++ = 0; /* segment size */ | 1140 | *bp++ = 0; /* segment size */ |
1141 | 1141 | ||
1142 | afs_use_fs_server(call, fc->cbi); | 1142 | afs_use_fs_server(call, fc->cbi); |
1143 | trace_afs_make_fs_call1(call, &vnode->fid, name); | 1143 | trace_afs_make_fs_call1(call, &dvnode->fid, name); |
1144 | afs_set_fc_call(call, fc); | 1144 | afs_set_fc_call(call, fc); |
1145 | afs_make_call(&fc->ac, call, GFP_NOFS); | 1145 | afs_make_call(&fc->ac, call, GFP_NOFS); |
1146 | return afs_wait_for_call_to_complete(call, &fc->ac); | 1146 | return afs_wait_for_call_to_complete(call, &fc->ac); |
@@ -1151,7 +1151,7 @@ int afs_fs_symlink(struct afs_fs_cursor *fc, | |||
1151 | */ | 1151 | */ |
1152 | static int afs_deliver_fs_rename(struct afs_call *call) | 1152 | static int afs_deliver_fs_rename(struct afs_call *call) |
1153 | { | 1153 | { |
1154 | struct afs_vnode *orig_dvnode = call->reply[0], *new_dvnode = call->reply[1]; | 1154 | struct afs_vnode *orig_dvnode = call->dvnode, *new_dvnode = call->xvnode; |
1155 | const __be32 *bp; | 1155 | const __be32 *bp; |
1156 | int ret; | 1156 | int ret; |
1157 | 1157 | ||
@@ -1173,7 +1173,7 @@ static int afs_deliver_fs_rename(struct afs_call *call) | |||
1173 | if (ret < 0) | 1173 | if (ret < 0) |
1174 | return ret; | 1174 | return ret; |
1175 | } | 1175 | } |
1176 | /* xdr_decode_AFSVolSync(&bp, call->reply[X]); */ | 1176 | xdr_decode_AFSVolSync(&bp, call->out_volsync); |
1177 | 1177 | ||
1178 | _leave(" = 0 [done]"); | 1178 | _leave(" = 0 [done]"); |
1179 | return 0; | 1179 | return 0; |
@@ -1229,8 +1229,8 @@ int afs_fs_rename(struct afs_fs_cursor *fc, | |||
1229 | return -ENOMEM; | 1229 | return -ENOMEM; |
1230 | 1230 | ||
1231 | call->key = fc->key; | 1231 | call->key = fc->key; |
1232 | call->reply[0] = orig_dvnode; | 1232 | call->dvnode = orig_dvnode; |
1233 | call->reply[1] = new_dvnode; | 1233 | call->xvnode = new_dvnode; |
1234 | call->expected_version = current_orig_data_version + 1; | 1234 | call->expected_version = current_orig_data_version + 1; |
1235 | call->expected_version_2 = current_new_data_version + 1; | 1235 | call->expected_version_2 = current_new_data_version + 1; |
1236 | 1236 | ||
@@ -1271,7 +1271,7 @@ int afs_fs_rename(struct afs_fs_cursor *fc, | |||
1271 | */ | 1271 | */ |
1272 | static int afs_deliver_fs_store_data(struct afs_call *call) | 1272 | static int afs_deliver_fs_store_data(struct afs_call *call) |
1273 | { | 1273 | { |
1274 | struct afs_vnode *vnode = call->reply[0]; | 1274 | struct afs_vnode *vnode = call->xvnode; |
1275 | const __be32 *bp; | 1275 | const __be32 *bp; |
1276 | int ret; | 1276 | int ret; |
1277 | 1277 | ||
@@ -1287,7 +1287,7 @@ static int afs_deliver_fs_store_data(struct afs_call *call) | |||
1287 | &call->expected_version, NULL); | 1287 | &call->expected_version, NULL); |
1288 | if (ret < 0) | 1288 | if (ret < 0) |
1289 | return ret; | 1289 | return ret; |
1290 | /* xdr_decode_AFSVolSync(&bp, call->reply[X]); */ | 1290 | xdr_decode_AFSVolSync(&bp, call->out_volsync); |
1291 | 1291 | ||
1292 | afs_pages_written_back(vnode, call); | 1292 | afs_pages_written_back(vnode, call); |
1293 | 1293 | ||
@@ -1337,7 +1337,7 @@ static int afs_fs_store_data64(struct afs_fs_cursor *fc, | |||
1337 | 1337 | ||
1338 | call->key = fc->key; | 1338 | call->key = fc->key; |
1339 | call->mapping = mapping; | 1339 | call->mapping = mapping; |
1340 | call->reply[0] = vnode; | 1340 | call->xvnode = vnode; |
1341 | call->first = first; | 1341 | call->first = first; |
1342 | call->last = last; | 1342 | call->last = last; |
1343 | call->first_offset = offset; | 1343 | call->first_offset = offset; |
@@ -1417,7 +1417,7 @@ int afs_fs_store_data(struct afs_fs_cursor *fc, struct address_space *mapping, | |||
1417 | 1417 | ||
1418 | call->key = fc->key; | 1418 | call->key = fc->key; |
1419 | call->mapping = mapping; | 1419 | call->mapping = mapping; |
1420 | call->reply[0] = vnode; | 1420 | call->xvnode = vnode; |
1421 | call->first = first; | 1421 | call->first = first; |
1422 | call->last = last; | 1422 | call->last = last; |
1423 | call->first_offset = offset; | 1423 | call->first_offset = offset; |
@@ -1455,7 +1455,7 @@ int afs_fs_store_data(struct afs_fs_cursor *fc, struct address_space *mapping, | |||
1455 | */ | 1455 | */ |
1456 | static int afs_deliver_fs_store_status(struct afs_call *call) | 1456 | static int afs_deliver_fs_store_status(struct afs_call *call) |
1457 | { | 1457 | { |
1458 | struct afs_vnode *vnode = call->reply[0]; | 1458 | struct afs_vnode *vnode = call->xvnode; |
1459 | const __be32 *bp; | 1459 | const __be32 *bp; |
1460 | int ret; | 1460 | int ret; |
1461 | 1461 | ||
@@ -1471,7 +1471,7 @@ static int afs_deliver_fs_store_status(struct afs_call *call) | |||
1471 | &call->expected_version, NULL); | 1471 | &call->expected_version, NULL); |
1472 | if (ret < 0) | 1472 | if (ret < 0) |
1473 | return ret; | 1473 | return ret; |
1474 | /* xdr_decode_AFSVolSync(&bp, call->reply[X]); */ | 1474 | xdr_decode_AFSVolSync(&bp, call->out_volsync); |
1475 | 1475 | ||
1476 | _leave(" = 0 [done]"); | 1476 | _leave(" = 0 [done]"); |
1477 | return 0; | 1477 | return 0; |
@@ -1524,7 +1524,7 @@ static int afs_fs_setattr_size64(struct afs_fs_cursor *fc, struct iattr *attr) | |||
1524 | return -ENOMEM; | 1524 | return -ENOMEM; |
1525 | 1525 | ||
1526 | call->key = fc->key; | 1526 | call->key = fc->key; |
1527 | call->reply[0] = vnode; | 1527 | call->xvnode = vnode; |
1528 | call->expected_version = vnode->status.data_version + 1; | 1528 | call->expected_version = vnode->status.data_version + 1; |
1529 | 1529 | ||
1530 | /* marshall the parameters */ | 1530 | /* marshall the parameters */ |
@@ -1575,7 +1575,7 @@ static int afs_fs_setattr_size(struct afs_fs_cursor *fc, struct iattr *attr) | |||
1575 | return -ENOMEM; | 1575 | return -ENOMEM; |
1576 | 1576 | ||
1577 | call->key = fc->key; | 1577 | call->key = fc->key; |
1578 | call->reply[0] = vnode; | 1578 | call->xvnode = vnode; |
1579 | call->expected_version = vnode->status.data_version + 1; | 1579 | call->expected_version = vnode->status.data_version + 1; |
1580 | 1580 | ||
1581 | /* marshall the parameters */ | 1581 | /* marshall the parameters */ |
@@ -1625,7 +1625,7 @@ int afs_fs_setattr(struct afs_fs_cursor *fc, struct iattr *attr) | |||
1625 | return -ENOMEM; | 1625 | return -ENOMEM; |
1626 | 1626 | ||
1627 | call->key = fc->key; | 1627 | call->key = fc->key; |
1628 | call->reply[0] = vnode; | 1628 | call->xvnode = vnode; |
1629 | call->expected_version = vnode->status.data_version; | 1629 | call->expected_version = vnode->status.data_version; |
1630 | 1630 | ||
1631 | /* marshall the parameters */ | 1631 | /* marshall the parameters */ |
@@ -1669,7 +1669,7 @@ static int afs_deliver_fs_get_volume_status(struct afs_call *call) | |||
1669 | return ret; | 1669 | return ret; |
1670 | 1670 | ||
1671 | bp = call->buffer; | 1671 | bp = call->buffer; |
1672 | xdr_decode_AFSFetchVolumeStatus(&bp, call->reply[1]); | 1672 | xdr_decode_AFSFetchVolumeStatus(&bp, call->out_volstatus); |
1673 | call->unmarshall++; | 1673 | call->unmarshall++; |
1674 | afs_extract_to_tmp(call); | 1674 | afs_extract_to_tmp(call); |
1675 | 1675 | ||
@@ -1685,7 +1685,7 @@ static int afs_deliver_fs_get_volume_status(struct afs_call *call) | |||
1685 | return afs_protocol_error(call, -EBADMSG, | 1685 | return afs_protocol_error(call, -EBADMSG, |
1686 | afs_eproto_volname_len); | 1686 | afs_eproto_volname_len); |
1687 | size = (call->count + 3) & ~3; /* It's padded */ | 1687 | size = (call->count + 3) & ~3; /* It's padded */ |
1688 | afs_extract_begin(call, call->reply[2], size); | 1688 | afs_extract_to_buf(call, size); |
1689 | call->unmarshall++; | 1689 | call->unmarshall++; |
1690 | 1690 | ||
1691 | /* Fall through - and extract the volume name */ | 1691 | /* Fall through - and extract the volume name */ |
@@ -1695,7 +1695,7 @@ static int afs_deliver_fs_get_volume_status(struct afs_call *call) | |||
1695 | if (ret < 0) | 1695 | if (ret < 0) |
1696 | return ret; | 1696 | return ret; |
1697 | 1697 | ||
1698 | p = call->reply[2]; | 1698 | p = call->buffer; |
1699 | p[call->count] = 0; | 1699 | p[call->count] = 0; |
1700 | _debug("volname '%s'", p); | 1700 | _debug("volname '%s'", p); |
1701 | afs_extract_to_tmp(call); | 1701 | afs_extract_to_tmp(call); |
@@ -1713,7 +1713,7 @@ static int afs_deliver_fs_get_volume_status(struct afs_call *call) | |||
1713 | return afs_protocol_error(call, -EBADMSG, | 1713 | return afs_protocol_error(call, -EBADMSG, |
1714 | afs_eproto_offline_msg_len); | 1714 | afs_eproto_offline_msg_len); |
1715 | size = (call->count + 3) & ~3; /* It's padded */ | 1715 | size = (call->count + 3) & ~3; /* It's padded */ |
1716 | afs_extract_begin(call, call->reply[2], size); | 1716 | afs_extract_to_buf(call, size); |
1717 | call->unmarshall++; | 1717 | call->unmarshall++; |
1718 | 1718 | ||
1719 | /* Fall through - and extract the offline message */ | 1719 | /* Fall through - and extract the offline message */ |
@@ -1723,7 +1723,7 @@ static int afs_deliver_fs_get_volume_status(struct afs_call *call) | |||
1723 | if (ret < 0) | 1723 | if (ret < 0) |
1724 | return ret; | 1724 | return ret; |
1725 | 1725 | ||
1726 | p = call->reply[2]; | 1726 | p = call->buffer; |
1727 | p[call->count] = 0; | 1727 | p[call->count] = 0; |
1728 | _debug("offline '%s'", p); | 1728 | _debug("offline '%s'", p); |
1729 | 1729 | ||
@@ -1742,7 +1742,7 @@ static int afs_deliver_fs_get_volume_status(struct afs_call *call) | |||
1742 | return afs_protocol_error(call, -EBADMSG, | 1742 | return afs_protocol_error(call, -EBADMSG, |
1743 | afs_eproto_motd_len); | 1743 | afs_eproto_motd_len); |
1744 | size = (call->count + 3) & ~3; /* It's padded */ | 1744 | size = (call->count + 3) & ~3; /* It's padded */ |
1745 | afs_extract_begin(call, call->reply[2], size); | 1745 | afs_extract_to_buf(call, size); |
1746 | call->unmarshall++; | 1746 | call->unmarshall++; |
1747 | 1747 | ||
1748 | /* Fall through - and extract the message of the day */ | 1748 | /* Fall through - and extract the message of the day */ |
@@ -1752,7 +1752,7 @@ static int afs_deliver_fs_get_volume_status(struct afs_call *call) | |||
1752 | if (ret < 0) | 1752 | if (ret < 0) |
1753 | return ret; | 1753 | return ret; |
1754 | 1754 | ||
1755 | p = call->reply[2]; | 1755 | p = call->buffer; |
1756 | p[call->count] = 0; | 1756 | p[call->count] = 0; |
1757 | _debug("motd '%s'", p); | 1757 | _debug("motd '%s'", p); |
1758 | 1758 | ||
@@ -1767,23 +1767,13 @@ static int afs_deliver_fs_get_volume_status(struct afs_call *call) | |||
1767 | } | 1767 | } |
1768 | 1768 | ||
1769 | /* | 1769 | /* |
1770 | * destroy an FS.GetVolumeStatus call | ||
1771 | */ | ||
1772 | static void afs_get_volume_status_call_destructor(struct afs_call *call) | ||
1773 | { | ||
1774 | kfree(call->reply[2]); | ||
1775 | call->reply[2] = NULL; | ||
1776 | afs_flat_call_destructor(call); | ||
1777 | } | ||
1778 | |||
1779 | /* | ||
1780 | * FS.GetVolumeStatus operation type | 1770 | * FS.GetVolumeStatus operation type |
1781 | */ | 1771 | */ |
1782 | static const struct afs_call_type afs_RXFSGetVolumeStatus = { | 1772 | static const struct afs_call_type afs_RXFSGetVolumeStatus = { |
1783 | .name = "FS.GetVolumeStatus", | 1773 | .name = "FS.GetVolumeStatus", |
1784 | .op = afs_FS_GetVolumeStatus, | 1774 | .op = afs_FS_GetVolumeStatus, |
1785 | .deliver = afs_deliver_fs_get_volume_status, | 1775 | .deliver = afs_deliver_fs_get_volume_status, |
1786 | .destructor = afs_get_volume_status_call_destructor, | 1776 | .destructor = afs_flat_call_destructor, |
1787 | }; | 1777 | }; |
1788 | 1778 | ||
1789 | /* | 1779 | /* |
@@ -1796,27 +1786,19 @@ int afs_fs_get_volume_status(struct afs_fs_cursor *fc, | |||
1796 | struct afs_call *call; | 1786 | struct afs_call *call; |
1797 | struct afs_net *net = afs_v2net(vnode); | 1787 | struct afs_net *net = afs_v2net(vnode); |
1798 | __be32 *bp; | 1788 | __be32 *bp; |
1799 | void *tmpbuf; | ||
1800 | 1789 | ||
1801 | if (test_bit(AFS_SERVER_FL_IS_YFS, &fc->cbi->server->flags)) | 1790 | if (test_bit(AFS_SERVER_FL_IS_YFS, &fc->cbi->server->flags)) |
1802 | return yfs_fs_get_volume_status(fc, vs); | 1791 | return yfs_fs_get_volume_status(fc, vs); |
1803 | 1792 | ||
1804 | _enter(""); | 1793 | _enter(""); |
1805 | 1794 | ||
1806 | tmpbuf = kmalloc(AFSOPAQUEMAX, GFP_KERNEL); | 1795 | call = afs_alloc_flat_call(net, &afs_RXFSGetVolumeStatus, 2 * 4, |
1807 | if (!tmpbuf) | 1796 | max(12 * 4, AFSOPAQUEMAX + 1)); |
1808 | return -ENOMEM; | 1797 | if (!call) |
1809 | |||
1810 | call = afs_alloc_flat_call(net, &afs_RXFSGetVolumeStatus, 2 * 4, 12 * 4); | ||
1811 | if (!call) { | ||
1812 | kfree(tmpbuf); | ||
1813 | return -ENOMEM; | 1798 | return -ENOMEM; |
1814 | } | ||
1815 | 1799 | ||
1816 | call->key = fc->key; | 1800 | call->key = fc->key; |
1817 | call->reply[0] = vnode; | 1801 | call->out_volstatus = vs; |
1818 | call->reply[1] = vs; | ||
1819 | call->reply[2] = tmpbuf; | ||
1820 | 1802 | ||
1821 | /* marshall the parameters */ | 1803 | /* marshall the parameters */ |
1822 | bp = call->request; | 1804 | bp = call->request; |
@@ -1846,7 +1828,7 @@ static int afs_deliver_fs_xxxx_lock(struct afs_call *call) | |||
1846 | 1828 | ||
1847 | /* unmarshall the reply once we've received all of it */ | 1829 | /* unmarshall the reply once we've received all of it */ |
1848 | bp = call->buffer; | 1830 | bp = call->buffer; |
1849 | /* xdr_decode_AFSVolSync(&bp, call->reply[X]); */ | 1831 | xdr_decode_AFSVolSync(&bp, call->out_volsync); |
1850 | 1832 | ||
1851 | _leave(" = 0 [done]"); | 1833 | _leave(" = 0 [done]"); |
1852 | return 0; | 1834 | return 0; |
@@ -1904,7 +1886,7 @@ int afs_fs_set_lock(struct afs_fs_cursor *fc, afs_lock_type_t type) | |||
1904 | return -ENOMEM; | 1886 | return -ENOMEM; |
1905 | 1887 | ||
1906 | call->key = fc->key; | 1888 | call->key = fc->key; |
1907 | call->reply[0] = vnode; | 1889 | call->xvnode = vnode; |
1908 | call->want_reply_time = true; | 1890 | call->want_reply_time = true; |
1909 | 1891 | ||
1910 | /* marshall the parameters */ | 1892 | /* marshall the parameters */ |
@@ -1942,7 +1924,7 @@ int afs_fs_extend_lock(struct afs_fs_cursor *fc) | |||
1942 | return -ENOMEM; | 1924 | return -ENOMEM; |
1943 | 1925 | ||
1944 | call->key = fc->key; | 1926 | call->key = fc->key; |
1945 | call->reply[0] = vnode; | 1927 | call->xvnode = vnode; |
1946 | call->want_reply_time = true; | 1928 | call->want_reply_time = true; |
1947 | 1929 | ||
1948 | /* marshall the parameters */ | 1930 | /* marshall the parameters */ |
@@ -1979,7 +1961,7 @@ int afs_fs_release_lock(struct afs_fs_cursor *fc) | |||
1979 | return -ENOMEM; | 1961 | return -ENOMEM; |
1980 | 1962 | ||
1981 | call->key = fc->key; | 1963 | call->key = fc->key; |
1982 | call->reply[0] = vnode; | 1964 | call->xvnode = vnode; |
1983 | 1965 | ||
1984 | /* marshall the parameters */ | 1966 | /* marshall the parameters */ |
1985 | bp = call->request; | 1967 | bp = call->request; |
@@ -2085,14 +2067,6 @@ static int afs_deliver_fs_get_capabilities(struct afs_call *call) | |||
2085 | return 0; | 2067 | return 0; |
2086 | } | 2068 | } |
2087 | 2069 | ||
2088 | static void afs_destroy_fs_get_capabilities(struct afs_call *call) | ||
2089 | { | ||
2090 | struct afs_server *server = call->reply[0]; | ||
2091 | |||
2092 | afs_put_server(call->net, server); | ||
2093 | afs_flat_call_destructor(call); | ||
2094 | } | ||
2095 | |||
2096 | /* | 2070 | /* |
2097 | * FS.GetCapabilities operation type | 2071 | * FS.GetCapabilities operation type |
2098 | */ | 2072 | */ |
@@ -2101,7 +2075,7 @@ static const struct afs_call_type afs_RXFSGetCapabilities = { | |||
2101 | .op = afs_FS_GetCapabilities, | 2075 | .op = afs_FS_GetCapabilities, |
2102 | .deliver = afs_deliver_fs_get_capabilities, | 2076 | .deliver = afs_deliver_fs_get_capabilities, |
2103 | .done = afs_fileserver_probe_result, | 2077 | .done = afs_fileserver_probe_result, |
2104 | .destructor = afs_destroy_fs_get_capabilities, | 2078 | .destructor = afs_flat_call_destructor, |
2105 | }; | 2079 | }; |
2106 | 2080 | ||
2107 | /* | 2081 | /* |
@@ -2124,8 +2098,8 @@ struct afs_call *afs_fs_get_capabilities(struct afs_net *net, | |||
2124 | return ERR_PTR(-ENOMEM); | 2098 | return ERR_PTR(-ENOMEM); |
2125 | 2099 | ||
2126 | call->key = key; | 2100 | call->key = key; |
2127 | call->reply[0] = afs_get_server(server); | 2101 | call->server = afs_get_server(server); |
2128 | call->reply[1] = (void *)(long)server_index; | 2102 | call->server_index = server_index; |
2129 | call->upgrade = true; | 2103 | call->upgrade = true; |
2130 | call->want_reply_time = true; | 2104 | call->want_reply_time = true; |
2131 | call->async = true; | 2105 | call->async = true; |
@@ -2146,10 +2120,10 @@ struct afs_call *afs_fs_get_capabilities(struct afs_net *net, | |||
2146 | */ | 2120 | */ |
2147 | static int afs_deliver_fs_fetch_status(struct afs_call *call) | 2121 | static int afs_deliver_fs_fetch_status(struct afs_call *call) |
2148 | { | 2122 | { |
2149 | struct afs_file_status *status = call->reply[1]; | 2123 | struct afs_file_status *status = call->out_vnode_status; |
2150 | struct afs_callback *callback = call->reply[2]; | 2124 | struct afs_callback *callback = call->out_cb; |
2151 | struct afs_volsync *volsync = call->reply[3]; | 2125 | struct afs_volsync *volsync = call->out_volsync; |
2152 | struct afs_fid *fid = call->reply[0]; | 2126 | struct afs_fid *fid = call->out_fid; |
2153 | const __be32 *bp; | 2127 | const __be32 *bp; |
2154 | int ret; | 2128 | int ret; |
2155 | 2129 | ||
@@ -2208,10 +2182,10 @@ int afs_fs_fetch_status(struct afs_fs_cursor *fc, | |||
2208 | } | 2182 | } |
2209 | 2183 | ||
2210 | call->key = fc->key; | 2184 | call->key = fc->key; |
2211 | call->reply[0] = fid; | 2185 | call->out_fid = fid; |
2212 | call->reply[1] = status; | 2186 | call->out_vnode_status = status; |
2213 | call->reply[2] = callback; | 2187 | call->out_cb = callback; |
2214 | call->reply[3] = volsync; | 2188 | call->out_volsync = volsync; |
2215 | call->expected_version = 1; /* vnode->status.data_version */ | 2189 | call->expected_version = 1; /* vnode->status.data_version */ |
2216 | call->want_reply_time = true; | 2190 | call->want_reply_time = true; |
2217 | 2191 | ||
@@ -2275,7 +2249,7 @@ static int afs_deliver_fs_inline_bulk_status(struct afs_call *call) | |||
2275 | return ret; | 2249 | return ret; |
2276 | 2250 | ||
2277 | bp = call->buffer; | 2251 | bp = call->buffer; |
2278 | statuses = call->reply[1]; | 2252 | statuses = call->out_extra_status; |
2279 | ret = afs_decode_status(call, &bp, &statuses[call->count], | 2253 | ret = afs_decode_status(call, &bp, &statuses[call->count], |
2280 | NULL, NULL, NULL); | 2254 | NULL, NULL, NULL); |
2281 | if (ret < 0) | 2255 | if (ret < 0) |
@@ -2316,9 +2290,9 @@ static int afs_deliver_fs_inline_bulk_status(struct afs_call *call) | |||
2316 | 2290 | ||
2317 | _debug("unmarshall CB array"); | 2291 | _debug("unmarshall CB array"); |
2318 | bp = call->buffer; | 2292 | bp = call->buffer; |
2319 | callbacks = call->reply[2]; | 2293 | callbacks = call->out_cb; |
2320 | xdr_decode_AFSCallBack_raw(call, &callbacks[call->count], &bp); | 2294 | xdr_decode_AFSCallBack_raw(call, &callbacks[call->count], &bp); |
2321 | statuses = call->reply[1]; | 2295 | statuses = call->out_extra_status; |
2322 | call->count++; | 2296 | call->count++; |
2323 | if (call->count < call->count2) | 2297 | if (call->count < call->count2) |
2324 | goto more_cbs; | 2298 | goto more_cbs; |
@@ -2333,7 +2307,7 @@ static int afs_deliver_fs_inline_bulk_status(struct afs_call *call) | |||
2333 | return ret; | 2307 | return ret; |
2334 | 2308 | ||
2335 | bp = call->buffer; | 2309 | bp = call->buffer; |
2336 | xdr_decode_AFSVolSync(&bp, call->reply[3]); | 2310 | xdr_decode_AFSVolSync(&bp, call->out_volsync); |
2337 | 2311 | ||
2338 | call->unmarshall++; | 2312 | call->unmarshall++; |
2339 | 2313 | ||
@@ -2386,9 +2360,9 @@ int afs_fs_inline_bulk_status(struct afs_fs_cursor *fc, | |||
2386 | } | 2360 | } |
2387 | 2361 | ||
2388 | call->key = fc->key; | 2362 | call->key = fc->key; |
2389 | call->reply[1] = statuses; | 2363 | call->out_extra_status = statuses; |
2390 | call->reply[2] = callbacks; | 2364 | call->out_cb = callbacks; |
2391 | call->reply[3] = volsync; | 2365 | call->out_volsync = volsync; |
2392 | call->count2 = nr_fids; | 2366 | call->count2 = nr_fids; |
2393 | call->want_reply_time = true; | 2367 | call->want_reply_time = true; |
2394 | 2368 | ||
@@ -2415,7 +2389,7 @@ int afs_fs_inline_bulk_status(struct afs_fs_cursor *fc, | |||
2415 | */ | 2389 | */ |
2416 | static int afs_deliver_fs_fetch_acl(struct afs_call *call) | 2390 | static int afs_deliver_fs_fetch_acl(struct afs_call *call) |
2417 | { | 2391 | { |
2418 | struct afs_vnode *vnode = call->reply[1]; | 2392 | struct afs_vnode *vnode = call->xvnode; |
2419 | struct afs_acl *acl; | 2393 | struct afs_acl *acl; |
2420 | const __be32 *bp; | 2394 | const __be32 *bp; |
2421 | unsigned int size; | 2395 | unsigned int size; |
@@ -2440,7 +2414,7 @@ static int afs_deliver_fs_fetch_acl(struct afs_call *call) | |||
2440 | acl = kmalloc(struct_size(acl, data, size), GFP_KERNEL); | 2414 | acl = kmalloc(struct_size(acl, data, size), GFP_KERNEL); |
2441 | if (!acl) | 2415 | if (!acl) |
2442 | return -ENOMEM; | 2416 | return -ENOMEM; |
2443 | call->reply[0] = acl; | 2417 | call->ret_acl = acl; |
2444 | acl->size = call->count2; | 2418 | acl->size = call->count2; |
2445 | afs_extract_begin(call, acl->data, size); | 2419 | afs_extract_begin(call, acl->data, size); |
2446 | call->unmarshall++; | 2420 | call->unmarshall++; |
@@ -2465,7 +2439,7 @@ static int afs_deliver_fs_fetch_acl(struct afs_call *call) | |||
2465 | &vnode->status.data_version, NULL); | 2439 | &vnode->status.data_version, NULL); |
2466 | if (ret < 0) | 2440 | if (ret < 0) |
2467 | return ret; | 2441 | return ret; |
2468 | xdr_decode_AFSVolSync(&bp, call->reply[2]); | 2442 | xdr_decode_AFSVolSync(&bp, call->out_volsync); |
2469 | 2443 | ||
2470 | call->unmarshall++; | 2444 | call->unmarshall++; |
2471 | 2445 | ||
@@ -2479,7 +2453,7 @@ static int afs_deliver_fs_fetch_acl(struct afs_call *call) | |||
2479 | 2453 | ||
2480 | static void afs_destroy_fs_fetch_acl(struct afs_call *call) | 2454 | static void afs_destroy_fs_fetch_acl(struct afs_call *call) |
2481 | { | 2455 | { |
2482 | kfree(call->reply[0]); | 2456 | kfree(call->ret_acl); |
2483 | afs_flat_call_destructor(call); | 2457 | afs_flat_call_destructor(call); |
2484 | } | 2458 | } |
2485 | 2459 | ||
@@ -2513,10 +2487,9 @@ struct afs_acl *afs_fs_fetch_acl(struct afs_fs_cursor *fc) | |||
2513 | } | 2487 | } |
2514 | 2488 | ||
2515 | call->key = fc->key; | 2489 | call->key = fc->key; |
2516 | call->reply[0] = NULL; | 2490 | call->ret_acl = NULL; |
2517 | call->reply[1] = vnode; | 2491 | call->xvnode = vnode; |
2518 | call->reply[2] = NULL; /* volsync */ | 2492 | call->out_volsync = NULL; |
2519 | call->ret_reply0 = true; | ||
2520 | 2493 | ||
2521 | /* marshall the parameters */ | 2494 | /* marshall the parameters */ |
2522 | bp = call->request; | 2495 | bp = call->request; |
@@ -2533,12 +2506,40 @@ struct afs_acl *afs_fs_fetch_acl(struct afs_fs_cursor *fc) | |||
2533 | } | 2506 | } |
2534 | 2507 | ||
2535 | /* | 2508 | /* |
2509 | * Deliver reply data to any operation that returns file status and volume | ||
2510 | * sync. | ||
2511 | */ | ||
2512 | static int afs_deliver_fs_file_status_and_vol(struct afs_call *call) | ||
2513 | { | ||
2514 | struct afs_vnode *vnode = call->xvnode; | ||
2515 | const __be32 *bp; | ||
2516 | int ret; | ||
2517 | |||
2518 | _enter("{%u}", call->unmarshall); | ||
2519 | |||
2520 | ret = afs_transfer_reply(call); | ||
2521 | if (ret < 0) | ||
2522 | return ret; | ||
2523 | |||
2524 | /* unmarshall the reply once we've received all of it */ | ||
2525 | bp = call->buffer; | ||
2526 | ret = afs_decode_status(call, &bp, &vnode->status, vnode, | ||
2527 | &call->expected_version, NULL); | ||
2528 | if (ret < 0) | ||
2529 | return ret; | ||
2530 | xdr_decode_AFSVolSync(&bp, call->out_volsync); | ||
2531 | |||
2532 | _leave(" = 0 [done]"); | ||
2533 | return 0; | ||
2534 | } | ||
2535 | |||
2536 | /* | ||
2536 | * FS.StoreACL operation type | 2537 | * FS.StoreACL operation type |
2537 | */ | 2538 | */ |
2538 | static const struct afs_call_type afs_RXFSStoreACL = { | 2539 | static const struct afs_call_type afs_RXFSStoreACL = { |
2539 | .name = "FS.StoreACL", | 2540 | .name = "FS.StoreACL", |
2540 | .op = afs_FS_StoreACL, | 2541 | .op = afs_FS_StoreACL, |
2541 | .deliver = afs_deliver_fs_status_and_vol, | 2542 | .deliver = afs_deliver_fs_file_status_and_vol, |
2542 | .destructor = afs_flat_call_destructor, | 2543 | .destructor = afs_flat_call_destructor, |
2543 | }; | 2544 | }; |
2544 | 2545 | ||
@@ -2565,8 +2566,8 @@ int afs_fs_store_acl(struct afs_fs_cursor *fc, const struct afs_acl *acl) | |||
2565 | } | 2566 | } |
2566 | 2567 | ||
2567 | call->key = fc->key; | 2568 | call->key = fc->key; |
2568 | call->reply[0] = vnode; | 2569 | call->xvnode = vnode; |
2569 | call->reply[2] = NULL; /* volsync */ | 2570 | call->out_volsync = NULL; |
2570 | 2571 | ||
2571 | /* marshall the parameters */ | 2572 | /* marshall the parameters */ |
2572 | bp = call->request; | 2573 | bp = call->request; |
diff --git a/fs/afs/internal.h b/fs/afs/internal.h index 833fa39ee337..705833eb2d45 100644 --- a/fs/afs/internal.h +++ b/fs/afs/internal.h | |||
@@ -111,8 +111,13 @@ struct afs_call { | |||
111 | struct rxrpc_call *rxcall; /* RxRPC call handle */ | 111 | struct rxrpc_call *rxcall; /* RxRPC call handle */ |
112 | struct key *key; /* security for this call */ | 112 | struct key *key; /* security for this call */ |
113 | struct afs_net *net; /* The network namespace */ | 113 | struct afs_net *net; /* The network namespace */ |
114 | struct afs_server *cm_server; /* Server affected by incoming CM call */ | 114 | union { |
115 | struct afs_server *server; | ||
116 | struct afs_vlserver *vlserver; | ||
117 | }; | ||
115 | struct afs_cb_interest *cbi; /* Callback interest for server used */ | 118 | struct afs_cb_interest *cbi; /* Callback interest for server used */ |
119 | struct afs_vnode *dvnode; /* Directory vnode of call */ | ||
120 | struct afs_vnode *xvnode; /* Other vnode of call */ | ||
116 | void *request; /* request data (first part) */ | 121 | void *request; /* request data (first part) */ |
117 | struct address_space *mapping; /* Pages being written from */ | 122 | struct address_space *mapping; /* Pages being written from */ |
118 | struct iov_iter iter; /* Buffer iterator */ | 123 | struct iov_iter iter; /* Buffer iterator */ |
@@ -122,7 +127,21 @@ struct afs_call { | |||
122 | struct bio_vec bvec[1]; | 127 | struct bio_vec bvec[1]; |
123 | }; | 128 | }; |
124 | void *buffer; /* reply receive buffer */ | 129 | void *buffer; /* reply receive buffer */ |
125 | void *reply[4]; /* Where to put the reply */ | 130 | union { |
131 | long ret0; /* Value to reply with instead of 0 */ | ||
132 | struct afs_addr_list *ret_alist; | ||
133 | struct afs_vldb_entry *ret_vldb; | ||
134 | struct afs_acl *ret_acl; | ||
135 | }; | ||
136 | struct afs_fid *out_fid; | ||
137 | struct afs_file_status *out_vnode_status; | ||
138 | struct afs_file_status *out_extra_status; | ||
139 | struct afs_callback *out_cb; | ||
140 | struct yfs_acl *out_yacl; | ||
141 | struct afs_volsync *out_volsync; | ||
142 | struct afs_volume_status *out_volstatus; | ||
143 | struct afs_read *read_request; | ||
144 | unsigned int server_index; | ||
126 | pgoff_t first; /* first page in mapping to deal with */ | 145 | pgoff_t first; /* first page in mapping to deal with */ |
127 | pgoff_t last; /* last page in mapping to deal with */ | 146 | pgoff_t last; /* last page in mapping to deal with */ |
128 | atomic_t usage; | 147 | atomic_t usage; |
@@ -146,7 +165,6 @@ struct afs_call { | |||
146 | bool send_pages; /* T if data from mapping should be sent */ | 165 | bool send_pages; /* T if data from mapping should be sent */ |
147 | bool need_attention; /* T if RxRPC poked us */ | 166 | bool need_attention; /* T if RxRPC poked us */ |
148 | bool async; /* T if asynchronous */ | 167 | bool async; /* T if asynchronous */ |
149 | bool ret_reply0; /* T if should return reply[0] on success */ | ||
150 | bool upgrade; /* T to request service upgrade */ | 168 | bool upgrade; /* T to request service upgrade */ |
151 | bool want_reply_time; /* T if want reply_time */ | 169 | bool want_reply_time; /* T if want reply_time */ |
152 | bool intr; /* T if interruptible */ | 170 | bool intr; /* T if interruptible */ |
diff --git a/fs/afs/rxrpc.c b/fs/afs/rxrpc.c index 02a39e6adf63..d63e0c9c09e7 100644 --- a/fs/afs/rxrpc.c +++ b/fs/afs/rxrpc.c | |||
@@ -188,7 +188,7 @@ void afs_put_call(struct afs_call *call) | |||
188 | if (call->type->destructor) | 188 | if (call->type->destructor) |
189 | call->type->destructor(call); | 189 | call->type->destructor(call); |
190 | 190 | ||
191 | afs_put_server(call->net, call->cm_server); | 191 | afs_put_server(call->net, call->server); |
192 | afs_put_cb_interest(call->net, call->cbi); | 192 | afs_put_cb_interest(call->net, call->cbi); |
193 | afs_put_addrlist(call->alist); | 193 | afs_put_addrlist(call->alist); |
194 | kfree(call->request); | 194 | kfree(call->request); |
@@ -696,10 +696,9 @@ long afs_wait_for_call_to_complete(struct afs_call *call, | |||
696 | ret = ac->error; | 696 | ret = ac->error; |
697 | switch (ret) { | 697 | switch (ret) { |
698 | case 0: | 698 | case 0: |
699 | if (call->ret_reply0) { | 699 | ret = call->ret0; |
700 | ret = (long)call->reply[0]; | 700 | call->ret0 = 0; |
701 | call->reply[0] = NULL; | 701 | |
702 | } | ||
703 | /* Fall through */ | 702 | /* Fall through */ |
704 | case -ECONNABORTED: | 703 | case -ECONNABORTED: |
705 | ac->responded = true; | 704 | ac->responded = true; |
diff --git a/fs/afs/vl_probe.c b/fs/afs/vl_probe.c index b05e0de04f42..beb991563939 100644 --- a/fs/afs/vl_probe.c +++ b/fs/afs/vl_probe.c | |||
@@ -33,8 +33,8 @@ static bool afs_vl_probe_done(struct afs_vlserver *server) | |||
33 | void afs_vlserver_probe_result(struct afs_call *call) | 33 | void afs_vlserver_probe_result(struct afs_call *call) |
34 | { | 34 | { |
35 | struct afs_addr_list *alist = call->alist; | 35 | struct afs_addr_list *alist = call->alist; |
36 | struct afs_vlserver *server = call->reply[0]; | 36 | struct afs_vlserver *server = call->vlserver; |
37 | unsigned int server_index = (long)call->reply[1]; | 37 | unsigned int server_index = call->server_index; |
38 | unsigned int index = call->addr_ix; | 38 | unsigned int index = call->addr_ix; |
39 | unsigned int rtt = UINT_MAX; | 39 | unsigned int rtt = UINT_MAX; |
40 | bool have_result = false; | 40 | bool have_result = false; |
diff --git a/fs/afs/vlclient.c b/fs/afs/vlclient.c index 7c53768a360b..06d010abee96 100644 --- a/fs/afs/vlclient.c +++ b/fs/afs/vlclient.c | |||
@@ -34,7 +34,7 @@ static int afs_deliver_vl_get_entry_by_name_u(struct afs_call *call) | |||
34 | 34 | ||
35 | /* unmarshall the reply once we've received all of it */ | 35 | /* unmarshall the reply once we've received all of it */ |
36 | uvldb = call->buffer; | 36 | uvldb = call->buffer; |
37 | entry = call->reply[0]; | 37 | entry = call->ret_vldb; |
38 | 38 | ||
39 | nr_servers = ntohl(uvldb->nServers); | 39 | nr_servers = ntohl(uvldb->nServers); |
40 | if (nr_servers > AFS_NMAXNSERVERS) | 40 | if (nr_servers > AFS_NMAXNSERVERS) |
@@ -110,7 +110,7 @@ static int afs_deliver_vl_get_entry_by_name_u(struct afs_call *call) | |||
110 | 110 | ||
111 | static void afs_destroy_vl_get_entry_by_name_u(struct afs_call *call) | 111 | static void afs_destroy_vl_get_entry_by_name_u(struct afs_call *call) |
112 | { | 112 | { |
113 | kfree(call->reply[0]); | 113 | kfree(call->ret_vldb); |
114 | afs_flat_call_destructor(call); | 114 | afs_flat_call_destructor(call); |
115 | } | 115 | } |
116 | 116 | ||
@@ -155,8 +155,7 @@ struct afs_vldb_entry *afs_vl_get_entry_by_name_u(struct afs_vl_cursor *vc, | |||
155 | } | 155 | } |
156 | 156 | ||
157 | call->key = vc->key; | 157 | call->key = vc->key; |
158 | call->reply[0] = entry; | 158 | call->ret_vldb = entry; |
159 | call->ret_reply0 = true; | ||
160 | call->max_lifespan = AFS_VL_MAX_LIFESPAN; | 159 | call->max_lifespan = AFS_VL_MAX_LIFESPAN; |
161 | 160 | ||
162 | /* Marshall the parameters */ | 161 | /* Marshall the parameters */ |
@@ -215,7 +214,7 @@ static int afs_deliver_vl_get_addrs_u(struct afs_call *call) | |||
215 | if (!alist) | 214 | if (!alist) |
216 | return -ENOMEM; | 215 | return -ENOMEM; |
217 | alist->version = uniquifier; | 216 | alist->version = uniquifier; |
218 | call->reply[0] = alist; | 217 | call->ret_alist = alist; |
219 | call->count = count; | 218 | call->count = count; |
220 | call->count2 = nentries; | 219 | call->count2 = nentries; |
221 | call->unmarshall++; | 220 | call->unmarshall++; |
@@ -230,7 +229,7 @@ static int afs_deliver_vl_get_addrs_u(struct afs_call *call) | |||
230 | if (ret < 0) | 229 | if (ret < 0) |
231 | return ret; | 230 | return ret; |
232 | 231 | ||
233 | alist = call->reply[0]; | 232 | alist = call->ret_alist; |
234 | bp = call->buffer; | 233 | bp = call->buffer; |
235 | count = min(call->count, 4U); | 234 | count = min(call->count, 4U); |
236 | for (i = 0; i < count; i++) | 235 | for (i = 0; i < count; i++) |
@@ -250,8 +249,7 @@ static int afs_deliver_vl_get_addrs_u(struct afs_call *call) | |||
250 | 249 | ||
251 | static void afs_vl_get_addrs_u_destructor(struct afs_call *call) | 250 | static void afs_vl_get_addrs_u_destructor(struct afs_call *call) |
252 | { | 251 | { |
253 | afs_put_server(call->net, (struct afs_server *)call->reply[0]); | 252 | afs_put_addrlist(call->ret_alist); |
254 | kfree(call->reply[1]); | ||
255 | return afs_flat_call_destructor(call); | 253 | return afs_flat_call_destructor(call); |
256 | } | 254 | } |
257 | 255 | ||
@@ -288,8 +286,7 @@ struct afs_addr_list *afs_vl_get_addrs_u(struct afs_vl_cursor *vc, | |||
288 | return ERR_PTR(-ENOMEM); | 286 | return ERR_PTR(-ENOMEM); |
289 | 287 | ||
290 | call->key = vc->key; | 288 | call->key = vc->key; |
291 | call->reply[0] = NULL; | 289 | call->ret_alist = NULL; |
292 | call->ret_reply0 = true; | ||
293 | call->max_lifespan = AFS_VL_MAX_LIFESPAN; | 290 | call->max_lifespan = AFS_VL_MAX_LIFESPAN; |
294 | 291 | ||
295 | /* Marshall the parameters */ | 292 | /* Marshall the parameters */ |
@@ -360,9 +357,7 @@ static int afs_deliver_vl_get_capabilities(struct afs_call *call) | |||
360 | 357 | ||
361 | static void afs_destroy_vl_get_capabilities(struct afs_call *call) | 358 | static void afs_destroy_vl_get_capabilities(struct afs_call *call) |
362 | { | 359 | { |
363 | struct afs_vlserver *server = call->reply[0]; | 360 | afs_put_vlserver(call->net, call->vlserver); |
364 | |||
365 | afs_put_vlserver(call->net, server); | ||
366 | afs_flat_call_destructor(call); | 361 | afs_flat_call_destructor(call); |
367 | } | 362 | } |
368 | 363 | ||
@@ -400,8 +395,8 @@ struct afs_call *afs_vl_get_capabilities(struct afs_net *net, | |||
400 | return ERR_PTR(-ENOMEM); | 395 | return ERR_PTR(-ENOMEM); |
401 | 396 | ||
402 | call->key = key; | 397 | call->key = key; |
403 | call->reply[0] = afs_get_vlserver(server); | 398 | call->vlserver = afs_get_vlserver(server); |
404 | call->reply[1] = (void *)(long)server_index; | 399 | call->server_index = server_index; |
405 | call->upgrade = true; | 400 | call->upgrade = true; |
406 | call->want_reply_time = true; | 401 | call->want_reply_time = true; |
407 | call->async = true; | 402 | call->async = true; |
@@ -463,7 +458,7 @@ static int afs_deliver_yfsvl_get_endpoints(struct afs_call *call) | |||
463 | if (!alist) | 458 | if (!alist) |
464 | return -ENOMEM; | 459 | return -ENOMEM; |
465 | alist->version = uniquifier; | 460 | alist->version = uniquifier; |
466 | call->reply[0] = alist; | 461 | call->ret_alist = alist; |
467 | 462 | ||
468 | if (call->count == 0) | 463 | if (call->count == 0) |
469 | goto extract_volendpoints; | 464 | goto extract_volendpoints; |
@@ -491,7 +486,7 @@ static int afs_deliver_yfsvl_get_endpoints(struct afs_call *call) | |||
491 | if (ret < 0) | 486 | if (ret < 0) |
492 | return ret; | 487 | return ret; |
493 | 488 | ||
494 | alist = call->reply[0]; | 489 | alist = call->ret_alist; |
495 | bp = call->buffer; | 490 | bp = call->buffer; |
496 | switch (call->count2) { | 491 | switch (call->count2) { |
497 | case YFS_ENDPOINT_IPV4: | 492 | case YFS_ENDPOINT_IPV4: |
@@ -612,7 +607,6 @@ static int afs_deliver_yfsvl_get_endpoints(struct afs_call *call) | |||
612 | break; | 607 | break; |
613 | } | 608 | } |
614 | 609 | ||
615 | alist = call->reply[0]; | ||
616 | _leave(" = 0 [done]"); | 610 | _leave(" = 0 [done]"); |
617 | return 0; | 611 | return 0; |
618 | } | 612 | } |
@@ -647,8 +641,7 @@ struct afs_addr_list *afs_yfsvl_get_endpoints(struct afs_vl_cursor *vc, | |||
647 | return ERR_PTR(-ENOMEM); | 641 | return ERR_PTR(-ENOMEM); |
648 | 642 | ||
649 | call->key = vc->key; | 643 | call->key = vc->key; |
650 | call->reply[0] = NULL; | 644 | call->ret_alist = NULL; |
651 | call->ret_reply0 = true; | ||
652 | call->max_lifespan = AFS_VL_MAX_LIFESPAN; | 645 | call->max_lifespan = AFS_VL_MAX_LIFESPAN; |
653 | 646 | ||
654 | /* Marshall the parameters */ | 647 | /* Marshall the parameters */ |
diff --git a/fs/afs/yfsclient.c b/fs/afs/yfsclient.c index 3f6d50edf498..a815d22f62f1 100644 --- a/fs/afs/yfsclient.c +++ b/fs/afs/yfsclient.c | |||
@@ -445,7 +445,7 @@ static void xdr_decode_YFSFetchVolumeStatus(const __be32 **_bp, | |||
445 | */ | 445 | */ |
446 | static int yfs_deliver_fs_fetch_status_vnode(struct afs_call *call) | 446 | static int yfs_deliver_fs_fetch_status_vnode(struct afs_call *call) |
447 | { | 447 | { |
448 | struct afs_vnode *vnode = call->reply[0]; | 448 | struct afs_vnode *vnode = call->xvnode; |
449 | const __be32 *bp; | 449 | const __be32 *bp; |
450 | int ret; | 450 | int ret; |
451 | 451 | ||
@@ -462,7 +462,7 @@ static int yfs_deliver_fs_fetch_status_vnode(struct afs_call *call) | |||
462 | if (ret < 0) | 462 | if (ret < 0) |
463 | return ret; | 463 | return ret; |
464 | xdr_decode_YFSCallBack(call, vnode, &bp); | 464 | xdr_decode_YFSCallBack(call, vnode, &bp); |
465 | xdr_decode_YFSVolSync(&bp, call->reply[1]); | 465 | xdr_decode_YFSVolSync(&bp, call->out_volsync); |
466 | 466 | ||
467 | _leave(" = 0 [done]"); | 467 | _leave(" = 0 [done]"); |
468 | return 0; | 468 | return 0; |
@@ -504,8 +504,8 @@ int yfs_fs_fetch_file_status(struct afs_fs_cursor *fc, struct afs_volsync *volsy | |||
504 | } | 504 | } |
505 | 505 | ||
506 | call->key = fc->key; | 506 | call->key = fc->key; |
507 | call->reply[0] = vnode; | 507 | call->xvnode = vnode; |
508 | call->reply[1] = volsync; | 508 | call->out_volsync = volsync; |
509 | call->expected_version = new_inode ? 1 : vnode->status.data_version; | 509 | call->expected_version = new_inode ? 1 : vnode->status.data_version; |
510 | 510 | ||
511 | /* marshall the parameters */ | 511 | /* marshall the parameters */ |
@@ -528,8 +528,8 @@ int yfs_fs_fetch_file_status(struct afs_fs_cursor *fc, struct afs_volsync *volsy | |||
528 | */ | 528 | */ |
529 | static int yfs_deliver_fs_fetch_data64(struct afs_call *call) | 529 | static int yfs_deliver_fs_fetch_data64(struct afs_call *call) |
530 | { | 530 | { |
531 | struct afs_vnode *vnode = call->reply[0]; | 531 | struct afs_vnode *vnode = call->xvnode; |
532 | struct afs_read *req = call->reply[2]; | 532 | struct afs_read *req = call->read_request; |
533 | const __be32 *bp; | 533 | const __be32 *bp; |
534 | unsigned int size; | 534 | unsigned int size; |
535 | int ret; | 535 | int ret; |
@@ -628,7 +628,7 @@ static int yfs_deliver_fs_fetch_data64(struct afs_call *call) | |||
628 | if (ret < 0) | 628 | if (ret < 0) |
629 | return ret; | 629 | return ret; |
630 | xdr_decode_YFSCallBack(call, vnode, &bp); | 630 | xdr_decode_YFSCallBack(call, vnode, &bp); |
631 | xdr_decode_YFSVolSync(&bp, call->reply[1]); | 631 | xdr_decode_YFSVolSync(&bp, call->out_volsync); |
632 | 632 | ||
633 | call->unmarshall++; | 633 | call->unmarshall++; |
634 | 634 | ||
@@ -652,9 +652,7 @@ static int yfs_deliver_fs_fetch_data64(struct afs_call *call) | |||
652 | 652 | ||
653 | static void yfs_fetch_data_destructor(struct afs_call *call) | 653 | static void yfs_fetch_data_destructor(struct afs_call *call) |
654 | { | 654 | { |
655 | struct afs_read *req = call->reply[2]; | 655 | afs_put_read(call->read_request); |
656 | |||
657 | afs_put_read(req); | ||
658 | afs_flat_call_destructor(call); | 656 | afs_flat_call_destructor(call); |
659 | } | 657 | } |
660 | 658 | ||
@@ -693,9 +691,9 @@ int yfs_fs_fetch_data(struct afs_fs_cursor *fc, struct afs_read *req) | |||
693 | return -ENOMEM; | 691 | return -ENOMEM; |
694 | 692 | ||
695 | call->key = fc->key; | 693 | call->key = fc->key; |
696 | call->reply[0] = vnode; | 694 | call->xvnode = vnode; |
697 | call->reply[1] = NULL; /* volsync */ | 695 | call->out_volsync = NULL; |
698 | call->reply[2] = req; | 696 | call->read_request = req; |
699 | call->expected_version = vnode->status.data_version; | 697 | call->expected_version = vnode->status.data_version; |
700 | call->want_reply_time = true; | 698 | call->want_reply_time = true; |
701 | 699 | ||
@@ -722,7 +720,7 @@ int yfs_fs_fetch_data(struct afs_fs_cursor *fc, struct afs_read *req) | |||
722 | */ | 720 | */ |
723 | static int yfs_deliver_fs_create_vnode(struct afs_call *call) | 721 | static int yfs_deliver_fs_create_vnode(struct afs_call *call) |
724 | { | 722 | { |
725 | struct afs_vnode *vnode = call->reply[0]; | 723 | struct afs_vnode *dvnode = call->dvnode; |
726 | const __be32 *bp; | 724 | const __be32 *bp; |
727 | int ret; | 725 | int ret; |
728 | 726 | ||
@@ -734,15 +732,15 @@ static int yfs_deliver_fs_create_vnode(struct afs_call *call) | |||
734 | 732 | ||
735 | /* unmarshall the reply once we've received all of it */ | 733 | /* unmarshall the reply once we've received all of it */ |
736 | bp = call->buffer; | 734 | bp = call->buffer; |
737 | xdr_decode_YFSFid(&bp, call->reply[1]); | 735 | xdr_decode_YFSFid(&bp, call->out_fid); |
738 | ret = yfs_decode_status(call, &bp, call->reply[2], NULL, NULL, NULL); | 736 | ret = yfs_decode_status(call, &bp, call->out_extra_status, NULL, NULL, NULL); |
739 | if (ret < 0) | 737 | if (ret < 0) |
740 | return ret; | 738 | return ret; |
741 | ret = yfs_decode_status(call, &bp, &vnode->status, vnode, | 739 | ret = yfs_decode_status(call, &bp, &dvnode->status, dvnode, |
742 | &call->expected_version, NULL); | 740 | &call->expected_version, NULL); |
743 | if (ret < 0) | 741 | if (ret < 0) |
744 | return ret; | 742 | return ret; |
745 | xdr_decode_YFSCallBack_raw(call, call->reply[3], &bp); | 743 | xdr_decode_YFSCallBack_raw(call, call->out_cb, &bp); |
746 | xdr_decode_YFSVolSync(&bp, NULL); | 744 | xdr_decode_YFSVolSync(&bp, NULL); |
747 | 745 | ||
748 | _leave(" = 0 [done]"); | 746 | _leave(" = 0 [done]"); |
@@ -770,9 +768,9 @@ int yfs_fs_create_file(struct afs_fs_cursor *fc, | |||
770 | struct afs_file_status *newstatus, | 768 | struct afs_file_status *newstatus, |
771 | struct afs_callback *newcb) | 769 | struct afs_callback *newcb) |
772 | { | 770 | { |
773 | struct afs_vnode *vnode = fc->vnode; | 771 | struct afs_vnode *dvnode = fc->vnode; |
774 | struct afs_call *call; | 772 | struct afs_call *call; |
775 | struct afs_net *net = afs_v2net(vnode); | 773 | struct afs_net *net = afs_v2net(dvnode); |
776 | size_t namesz, reqsz, rplsz; | 774 | size_t namesz, reqsz, rplsz; |
777 | __be32 *bp; | 775 | __be32 *bp; |
778 | 776 | ||
@@ -796,24 +794,24 @@ int yfs_fs_create_file(struct afs_fs_cursor *fc, | |||
796 | return -ENOMEM; | 794 | return -ENOMEM; |
797 | 795 | ||
798 | call->key = fc->key; | 796 | call->key = fc->key; |
799 | call->reply[0] = vnode; | 797 | call->dvnode = dvnode; |
800 | call->reply[1] = newfid; | 798 | call->out_fid = newfid; |
801 | call->reply[2] = newstatus; | 799 | call->out_extra_status = newstatus; |
802 | call->reply[3] = newcb; | 800 | call->out_cb = newcb; |
803 | call->expected_version = current_data_version + 1; | 801 | call->expected_version = current_data_version + 1; |
804 | 802 | ||
805 | /* marshall the parameters */ | 803 | /* marshall the parameters */ |
806 | bp = call->request; | 804 | bp = call->request; |
807 | bp = xdr_encode_u32(bp, YFSCREATEFILE); | 805 | bp = xdr_encode_u32(bp, YFSCREATEFILE); |
808 | bp = xdr_encode_u32(bp, 0); /* RPC flags */ | 806 | bp = xdr_encode_u32(bp, 0); /* RPC flags */ |
809 | bp = xdr_encode_YFSFid(bp, &vnode->fid); | 807 | bp = xdr_encode_YFSFid(bp, &dvnode->fid); |
810 | bp = xdr_encode_string(bp, name, namesz); | 808 | bp = xdr_encode_string(bp, name, namesz); |
811 | bp = xdr_encode_YFSStoreStatus_mode(bp, mode); | 809 | bp = xdr_encode_YFSStoreStatus_mode(bp, mode); |
812 | bp = xdr_encode_u32(bp, yfs_LockNone); /* ViceLockType */ | 810 | bp = xdr_encode_u32(bp, yfs_LockNone); /* ViceLockType */ |
813 | yfs_check_req(call, bp); | 811 | yfs_check_req(call, bp); |
814 | 812 | ||
815 | afs_use_fs_server(call, fc->cbi); | 813 | afs_use_fs_server(call, fc->cbi); |
816 | trace_afs_make_fs_call1(call, &vnode->fid, name); | 814 | trace_afs_make_fs_call1(call, &dvnode->fid, name); |
817 | afs_set_fc_call(call, fc); | 815 | afs_set_fc_call(call, fc); |
818 | afs_make_call(&fc->ac, call, GFP_NOFS); | 816 | afs_make_call(&fc->ac, call, GFP_NOFS); |
819 | return afs_wait_for_call_to_complete(call, &fc->ac); | 817 | return afs_wait_for_call_to_complete(call, &fc->ac); |
@@ -837,9 +835,9 @@ int yfs_fs_make_dir(struct afs_fs_cursor *fc, | |||
837 | struct afs_file_status *newstatus, | 835 | struct afs_file_status *newstatus, |
838 | struct afs_callback *newcb) | 836 | struct afs_callback *newcb) |
839 | { | 837 | { |
840 | struct afs_vnode *vnode = fc->vnode; | 838 | struct afs_vnode *dvnode = fc->vnode; |
841 | struct afs_call *call; | 839 | struct afs_call *call; |
842 | struct afs_net *net = afs_v2net(vnode); | 840 | struct afs_net *net = afs_v2net(dvnode); |
843 | size_t namesz, reqsz, rplsz; | 841 | size_t namesz, reqsz, rplsz; |
844 | __be32 *bp; | 842 | __be32 *bp; |
845 | 843 | ||
@@ -862,23 +860,23 @@ int yfs_fs_make_dir(struct afs_fs_cursor *fc, | |||
862 | return -ENOMEM; | 860 | return -ENOMEM; |
863 | 861 | ||
864 | call->key = fc->key; | 862 | call->key = fc->key; |
865 | call->reply[0] = vnode; | 863 | call->dvnode = dvnode; |
866 | call->reply[1] = newfid; | 864 | call->out_fid = newfid; |
867 | call->reply[2] = newstatus; | 865 | call->out_extra_status = newstatus; |
868 | call->reply[3] = newcb; | 866 | call->out_cb = newcb; |
869 | call->expected_version = current_data_version + 1; | 867 | call->expected_version = current_data_version + 1; |
870 | 868 | ||
871 | /* marshall the parameters */ | 869 | /* marshall the parameters */ |
872 | bp = call->request; | 870 | bp = call->request; |
873 | bp = xdr_encode_u32(bp, YFSMAKEDIR); | 871 | bp = xdr_encode_u32(bp, YFSMAKEDIR); |
874 | bp = xdr_encode_u32(bp, 0); /* RPC flags */ | 872 | bp = xdr_encode_u32(bp, 0); /* RPC flags */ |
875 | bp = xdr_encode_YFSFid(bp, &vnode->fid); | 873 | bp = xdr_encode_YFSFid(bp, &dvnode->fid); |
876 | bp = xdr_encode_string(bp, name, namesz); | 874 | bp = xdr_encode_string(bp, name, namesz); |
877 | bp = xdr_encode_YFSStoreStatus_mode(bp, mode); | 875 | bp = xdr_encode_YFSStoreStatus_mode(bp, mode); |
878 | yfs_check_req(call, bp); | 876 | yfs_check_req(call, bp); |
879 | 877 | ||
880 | afs_use_fs_server(call, fc->cbi); | 878 | afs_use_fs_server(call, fc->cbi); |
881 | trace_afs_make_fs_call1(call, &vnode->fid, name); | 879 | trace_afs_make_fs_call1(call, &dvnode->fid, name); |
882 | afs_set_fc_call(call, fc); | 880 | afs_set_fc_call(call, fc); |
883 | afs_make_call(&fc->ac, call, GFP_NOFS); | 881 | afs_make_call(&fc->ac, call, GFP_NOFS); |
884 | return afs_wait_for_call_to_complete(call, &fc->ac); | 882 | return afs_wait_for_call_to_complete(call, &fc->ac); |
@@ -889,8 +887,8 @@ int yfs_fs_make_dir(struct afs_fs_cursor *fc, | |||
889 | */ | 887 | */ |
890 | static int yfs_deliver_fs_remove_file2(struct afs_call *call) | 888 | static int yfs_deliver_fs_remove_file2(struct afs_call *call) |
891 | { | 889 | { |
892 | struct afs_vnode *dvnode = call->reply[0]; | 890 | struct afs_vnode *dvnode = call->dvnode; |
893 | struct afs_vnode *vnode = call->reply[1]; | 891 | struct afs_vnode *vnode = call->xvnode; |
894 | struct afs_fid fid; | 892 | struct afs_fid fid; |
895 | const __be32 *bp; | 893 | const __be32 *bp; |
896 | int ret; | 894 | int ret; |
@@ -957,8 +955,8 @@ int yfs_fs_remove_file2(struct afs_fs_cursor *fc, struct afs_vnode *vnode, | |||
957 | return -ENOMEM; | 955 | return -ENOMEM; |
958 | 956 | ||
959 | call->key = fc->key; | 957 | call->key = fc->key; |
960 | call->reply[0] = dvnode; | 958 | call->dvnode = dvnode; |
961 | call->reply[1] = vnode; | 959 | call->xvnode = vnode; |
962 | call->expected_version = current_data_version + 1; | 960 | call->expected_version = current_data_version + 1; |
963 | 961 | ||
964 | /* marshall the parameters */ | 962 | /* marshall the parameters */ |
@@ -981,7 +979,7 @@ int yfs_fs_remove_file2(struct afs_fs_cursor *fc, struct afs_vnode *vnode, | |||
981 | */ | 979 | */ |
982 | static int yfs_deliver_fs_remove(struct afs_call *call) | 980 | static int yfs_deliver_fs_remove(struct afs_call *call) |
983 | { | 981 | { |
984 | struct afs_vnode *dvnode = call->reply[0]; | 982 | struct afs_vnode *dvnode = call->dvnode; |
985 | const __be32 *bp; | 983 | const __be32 *bp; |
986 | int ret; | 984 | int ret; |
987 | 985 | ||
@@ -1046,8 +1044,8 @@ int yfs_fs_remove(struct afs_fs_cursor *fc, struct afs_vnode *vnode, | |||
1046 | return -ENOMEM; | 1044 | return -ENOMEM; |
1047 | 1045 | ||
1048 | call->key = fc->key; | 1046 | call->key = fc->key; |
1049 | call->reply[0] = dvnode; | 1047 | call->dvnode = dvnode; |
1050 | call->reply[1] = vnode; | 1048 | call->xvnode = vnode; |
1051 | call->expected_version = current_data_version + 1; | 1049 | call->expected_version = current_data_version + 1; |
1052 | 1050 | ||
1053 | /* marshall the parameters */ | 1051 | /* marshall the parameters */ |
@@ -1070,7 +1068,7 @@ int yfs_fs_remove(struct afs_fs_cursor *fc, struct afs_vnode *vnode, | |||
1070 | */ | 1068 | */ |
1071 | static int yfs_deliver_fs_link(struct afs_call *call) | 1069 | static int yfs_deliver_fs_link(struct afs_call *call) |
1072 | { | 1070 | { |
1073 | struct afs_vnode *dvnode = call->reply[0], *vnode = call->reply[1]; | 1071 | struct afs_vnode *dvnode = call->dvnode, *vnode = call->xvnode; |
1074 | const __be32 *bp; | 1072 | const __be32 *bp; |
1075 | int ret; | 1073 | int ret; |
1076 | 1074 | ||
@@ -1132,8 +1130,8 @@ int yfs_fs_link(struct afs_fs_cursor *fc, struct afs_vnode *vnode, | |||
1132 | return -ENOMEM; | 1130 | return -ENOMEM; |
1133 | 1131 | ||
1134 | call->key = fc->key; | 1132 | call->key = fc->key; |
1135 | call->reply[0] = dvnode; | 1133 | call->dvnode = dvnode; |
1136 | call->reply[1] = vnode; | 1134 | call->xvnode = vnode; |
1137 | call->expected_version = current_data_version + 1; | 1135 | call->expected_version = current_data_version + 1; |
1138 | 1136 | ||
1139 | /* marshall the parameters */ | 1137 | /* marshall the parameters */ |
@@ -1157,7 +1155,7 @@ int yfs_fs_link(struct afs_fs_cursor *fc, struct afs_vnode *vnode, | |||
1157 | */ | 1155 | */ |
1158 | static int yfs_deliver_fs_symlink(struct afs_call *call) | 1156 | static int yfs_deliver_fs_symlink(struct afs_call *call) |
1159 | { | 1157 | { |
1160 | struct afs_vnode *vnode = call->reply[0]; | 1158 | struct afs_vnode *dvnode = call->dvnode; |
1161 | const __be32 *bp; | 1159 | const __be32 *bp; |
1162 | int ret; | 1160 | int ret; |
1163 | 1161 | ||
@@ -1169,11 +1167,11 @@ static int yfs_deliver_fs_symlink(struct afs_call *call) | |||
1169 | 1167 | ||
1170 | /* unmarshall the reply once we've received all of it */ | 1168 | /* unmarshall the reply once we've received all of it */ |
1171 | bp = call->buffer; | 1169 | bp = call->buffer; |
1172 | xdr_decode_YFSFid(&bp, call->reply[1]); | 1170 | xdr_decode_YFSFid(&bp, call->out_fid); |
1173 | ret = yfs_decode_status(call, &bp, call->reply[2], NULL, NULL, NULL); | 1171 | ret = yfs_decode_status(call, &bp, call->out_extra_status, NULL, NULL, NULL); |
1174 | if (ret < 0) | 1172 | if (ret < 0) |
1175 | return ret; | 1173 | return ret; |
1176 | ret = yfs_decode_status(call, &bp, &vnode->status, vnode, | 1174 | ret = yfs_decode_status(call, &bp, &dvnode->status, dvnode, |
1177 | &call->expected_version, NULL); | 1175 | &call->expected_version, NULL); |
1178 | if (ret < 0) | 1176 | if (ret < 0) |
1179 | return ret; | 1177 | return ret; |
@@ -1228,9 +1226,9 @@ int yfs_fs_symlink(struct afs_fs_cursor *fc, | |||
1228 | return -ENOMEM; | 1226 | return -ENOMEM; |
1229 | 1227 | ||
1230 | call->key = fc->key; | 1228 | call->key = fc->key; |
1231 | call->reply[0] = dvnode; | 1229 | call->dvnode = dvnode; |
1232 | call->reply[1] = newfid; | 1230 | call->out_fid = newfid; |
1233 | call->reply[2] = newstatus; | 1231 | call->out_extra_status = newstatus; |
1234 | call->expected_version = current_data_version + 1; | 1232 | call->expected_version = current_data_version + 1; |
1235 | 1233 | ||
1236 | /* marshall the parameters */ | 1234 | /* marshall the parameters */ |
@@ -1255,8 +1253,8 @@ int yfs_fs_symlink(struct afs_fs_cursor *fc, | |||
1255 | */ | 1253 | */ |
1256 | static int yfs_deliver_fs_rename(struct afs_call *call) | 1254 | static int yfs_deliver_fs_rename(struct afs_call *call) |
1257 | { | 1255 | { |
1258 | struct afs_vnode *orig_dvnode = call->reply[0]; | 1256 | struct afs_vnode *orig_dvnode = call->dvnode; |
1259 | struct afs_vnode *new_dvnode = call->reply[1]; | 1257 | struct afs_vnode *new_dvnode = call->xvnode; |
1260 | const __be32 *bp; | 1258 | const __be32 *bp; |
1261 | int ret; | 1259 | int ret; |
1262 | 1260 | ||
@@ -1328,8 +1326,8 @@ int yfs_fs_rename(struct afs_fs_cursor *fc, | |||
1328 | return -ENOMEM; | 1326 | return -ENOMEM; |
1329 | 1327 | ||
1330 | call->key = fc->key; | 1328 | call->key = fc->key; |
1331 | call->reply[0] = orig_dvnode; | 1329 | call->dvnode = orig_dvnode; |
1332 | call->reply[1] = new_dvnode; | 1330 | call->xvnode = new_dvnode; |
1333 | call->expected_version = current_orig_data_version + 1; | 1331 | call->expected_version = current_orig_data_version + 1; |
1334 | call->expected_version_2 = current_new_data_version + 1; | 1332 | call->expected_version_2 = current_new_data_version + 1; |
1335 | 1333 | ||
@@ -1355,7 +1353,7 @@ int yfs_fs_rename(struct afs_fs_cursor *fc, | |||
1355 | */ | 1353 | */ |
1356 | static int yfs_deliver_fs_store_data(struct afs_call *call) | 1354 | static int yfs_deliver_fs_store_data(struct afs_call *call) |
1357 | { | 1355 | { |
1358 | struct afs_vnode *vnode = call->reply[0]; | 1356 | struct afs_vnode *vnode = call->xvnode; |
1359 | const __be32 *bp; | 1357 | const __be32 *bp; |
1360 | int ret; | 1358 | int ret; |
1361 | 1359 | ||
@@ -1432,7 +1430,7 @@ int yfs_fs_store_data(struct afs_fs_cursor *fc, struct address_space *mapping, | |||
1432 | 1430 | ||
1433 | call->key = fc->key; | 1431 | call->key = fc->key; |
1434 | call->mapping = mapping; | 1432 | call->mapping = mapping; |
1435 | call->reply[0] = vnode; | 1433 | call->xvnode = vnode; |
1436 | call->first = first; | 1434 | call->first = first; |
1437 | call->last = last; | 1435 | call->last = last; |
1438 | call->first_offset = offset; | 1436 | call->first_offset = offset; |
@@ -1463,7 +1461,7 @@ int yfs_fs_store_data(struct afs_fs_cursor *fc, struct address_space *mapping, | |||
1463 | */ | 1461 | */ |
1464 | static int yfs_deliver_fs_store_status(struct afs_call *call) | 1462 | static int yfs_deliver_fs_store_status(struct afs_call *call) |
1465 | { | 1463 | { |
1466 | struct afs_vnode *vnode = call->reply[0]; | 1464 | struct afs_vnode *vnode = call->xvnode; |
1467 | const __be32 *bp; | 1465 | const __be32 *bp; |
1468 | int ret; | 1466 | int ret; |
1469 | 1467 | ||
@@ -1527,7 +1525,7 @@ static int yfs_fs_setattr_size(struct afs_fs_cursor *fc, struct iattr *attr) | |||
1527 | return -ENOMEM; | 1525 | return -ENOMEM; |
1528 | 1526 | ||
1529 | call->key = fc->key; | 1527 | call->key = fc->key; |
1530 | call->reply[0] = vnode; | 1528 | call->xvnode = vnode; |
1531 | call->expected_version = vnode->status.data_version + 1; | 1529 | call->expected_version = vnode->status.data_version + 1; |
1532 | 1530 | ||
1533 | /* marshall the parameters */ | 1531 | /* marshall the parameters */ |
@@ -1575,7 +1573,7 @@ int yfs_fs_setattr(struct afs_fs_cursor *fc, struct iattr *attr) | |||
1575 | return -ENOMEM; | 1573 | return -ENOMEM; |
1576 | 1574 | ||
1577 | call->key = fc->key; | 1575 | call->key = fc->key; |
1578 | call->reply[0] = vnode; | 1576 | call->xvnode = vnode; |
1579 | call->expected_version = vnode->status.data_version; | 1577 | call->expected_version = vnode->status.data_version; |
1580 | 1578 | ||
1581 | /* marshall the parameters */ | 1579 | /* marshall the parameters */ |
@@ -1618,7 +1616,7 @@ static int yfs_deliver_fs_get_volume_status(struct afs_call *call) | |||
1618 | return ret; | 1616 | return ret; |
1619 | 1617 | ||
1620 | bp = call->buffer; | 1618 | bp = call->buffer; |
1621 | xdr_decode_YFSFetchVolumeStatus(&bp, call->reply[1]); | 1619 | xdr_decode_YFSFetchVolumeStatus(&bp, call->out_volstatus); |
1622 | call->unmarshall++; | 1620 | call->unmarshall++; |
1623 | afs_extract_to_tmp(call); | 1621 | afs_extract_to_tmp(call); |
1624 | 1622 | ||
@@ -1634,7 +1632,7 @@ static int yfs_deliver_fs_get_volume_status(struct afs_call *call) | |||
1634 | return afs_protocol_error(call, -EBADMSG, | 1632 | return afs_protocol_error(call, -EBADMSG, |
1635 | afs_eproto_volname_len); | 1633 | afs_eproto_volname_len); |
1636 | size = (call->count + 3) & ~3; /* It's padded */ | 1634 | size = (call->count + 3) & ~3; /* It's padded */ |
1637 | afs_extract_begin(call, call->reply[2], size); | 1635 | afs_extract_to_buf(call, size); |
1638 | call->unmarshall++; | 1636 | call->unmarshall++; |
1639 | 1637 | ||
1640 | /* Fall through - and extract the volume name */ | 1638 | /* Fall through - and extract the volume name */ |
@@ -1644,7 +1642,7 @@ static int yfs_deliver_fs_get_volume_status(struct afs_call *call) | |||
1644 | if (ret < 0) | 1642 | if (ret < 0) |
1645 | return ret; | 1643 | return ret; |
1646 | 1644 | ||
1647 | p = call->reply[2]; | 1645 | p = call->buffer; |
1648 | p[call->count] = 0; | 1646 | p[call->count] = 0; |
1649 | _debug("volname '%s'", p); | 1647 | _debug("volname '%s'", p); |
1650 | afs_extract_to_tmp(call); | 1648 | afs_extract_to_tmp(call); |
@@ -1662,7 +1660,7 @@ static int yfs_deliver_fs_get_volume_status(struct afs_call *call) | |||
1662 | return afs_protocol_error(call, -EBADMSG, | 1660 | return afs_protocol_error(call, -EBADMSG, |
1663 | afs_eproto_offline_msg_len); | 1661 | afs_eproto_offline_msg_len); |
1664 | size = (call->count + 3) & ~3; /* It's padded */ | 1662 | size = (call->count + 3) & ~3; /* It's padded */ |
1665 | afs_extract_begin(call, call->reply[2], size); | 1663 | afs_extract_to_buf(call, size); |
1666 | call->unmarshall++; | 1664 | call->unmarshall++; |
1667 | 1665 | ||
1668 | /* Fall through - and extract the offline message */ | 1666 | /* Fall through - and extract the offline message */ |
@@ -1672,7 +1670,7 @@ static int yfs_deliver_fs_get_volume_status(struct afs_call *call) | |||
1672 | if (ret < 0) | 1670 | if (ret < 0) |
1673 | return ret; | 1671 | return ret; |
1674 | 1672 | ||
1675 | p = call->reply[2]; | 1673 | p = call->buffer; |
1676 | p[call->count] = 0; | 1674 | p[call->count] = 0; |
1677 | _debug("offline '%s'", p); | 1675 | _debug("offline '%s'", p); |
1678 | 1676 | ||
@@ -1691,7 +1689,7 @@ static int yfs_deliver_fs_get_volume_status(struct afs_call *call) | |||
1691 | return afs_protocol_error(call, -EBADMSG, | 1689 | return afs_protocol_error(call, -EBADMSG, |
1692 | afs_eproto_motd_len); | 1690 | afs_eproto_motd_len); |
1693 | size = (call->count + 3) & ~3; /* It's padded */ | 1691 | size = (call->count + 3) & ~3; /* It's padded */ |
1694 | afs_extract_begin(call, call->reply[2], size); | 1692 | afs_extract_to_buf(call, size); |
1695 | call->unmarshall++; | 1693 | call->unmarshall++; |
1696 | 1694 | ||
1697 | /* Fall through - and extract the message of the day */ | 1695 | /* Fall through - and extract the message of the day */ |
@@ -1701,7 +1699,7 @@ static int yfs_deliver_fs_get_volume_status(struct afs_call *call) | |||
1701 | if (ret < 0) | 1699 | if (ret < 0) |
1702 | return ret; | 1700 | return ret; |
1703 | 1701 | ||
1704 | p = call->reply[2]; | 1702 | p = call->buffer; |
1705 | p[call->count] = 0; | 1703 | p[call->count] = 0; |
1706 | _debug("motd '%s'", p); | 1704 | _debug("motd '%s'", p); |
1707 | 1705 | ||
@@ -1717,23 +1715,13 @@ static int yfs_deliver_fs_get_volume_status(struct afs_call *call) | |||
1717 | } | 1715 | } |
1718 | 1716 | ||
1719 | /* | 1717 | /* |
1720 | * Destroy a YFS.GetVolumeStatus call. | ||
1721 | */ | ||
1722 | static void yfs_get_volume_status_call_destructor(struct afs_call *call) | ||
1723 | { | ||
1724 | kfree(call->reply[2]); | ||
1725 | call->reply[2] = NULL; | ||
1726 | afs_flat_call_destructor(call); | ||
1727 | } | ||
1728 | |||
1729 | /* | ||
1730 | * YFS.GetVolumeStatus operation type | 1718 | * YFS.GetVolumeStatus operation type |
1731 | */ | 1719 | */ |
1732 | static const struct afs_call_type yfs_RXYFSGetVolumeStatus = { | 1720 | static const struct afs_call_type yfs_RXYFSGetVolumeStatus = { |
1733 | .name = "YFS.GetVolumeStatus", | 1721 | .name = "YFS.GetVolumeStatus", |
1734 | .op = yfs_FS_GetVolumeStatus, | 1722 | .op = yfs_FS_GetVolumeStatus, |
1735 | .deliver = yfs_deliver_fs_get_volume_status, | 1723 | .deliver = yfs_deliver_fs_get_volume_status, |
1736 | .destructor = yfs_get_volume_status_call_destructor, | 1724 | .destructor = afs_flat_call_destructor, |
1737 | }; | 1725 | }; |
1738 | 1726 | ||
1739 | /* | 1727 | /* |
@@ -1746,28 +1734,21 @@ int yfs_fs_get_volume_status(struct afs_fs_cursor *fc, | |||
1746 | struct afs_call *call; | 1734 | struct afs_call *call; |
1747 | struct afs_net *net = afs_v2net(vnode); | 1735 | struct afs_net *net = afs_v2net(vnode); |
1748 | __be32 *bp; | 1736 | __be32 *bp; |
1749 | void *tmpbuf; | ||
1750 | 1737 | ||
1751 | _enter(""); | 1738 | _enter(""); |
1752 | 1739 | ||
1753 | tmpbuf = kmalloc(AFSOPAQUEMAX, GFP_KERNEL); | ||
1754 | if (!tmpbuf) | ||
1755 | return -ENOMEM; | ||
1756 | |||
1757 | call = afs_alloc_flat_call(net, &yfs_RXYFSGetVolumeStatus, | 1740 | call = afs_alloc_flat_call(net, &yfs_RXYFSGetVolumeStatus, |
1758 | sizeof(__be32) * 2 + | 1741 | sizeof(__be32) * 2 + |
1759 | sizeof(struct yfs_xdr_u64), | 1742 | sizeof(struct yfs_xdr_u64), |
1760 | sizeof(struct yfs_xdr_YFSFetchVolumeStatus) + | 1743 | max_t(size_t, |
1761 | sizeof(__be32)); | 1744 | sizeof(struct yfs_xdr_YFSFetchVolumeStatus) + |
1762 | if (!call) { | 1745 | sizeof(__be32), |
1763 | kfree(tmpbuf); | 1746 | AFSOPAQUEMAX + 1)); |
1747 | if (!call) | ||
1764 | return -ENOMEM; | 1748 | return -ENOMEM; |
1765 | } | ||
1766 | 1749 | ||
1767 | call->key = fc->key; | 1750 | call->key = fc->key; |
1768 | call->reply[0] = vnode; | 1751 | call->out_volstatus = vs; |
1769 | call->reply[1] = vs; | ||
1770 | call->reply[2] = tmpbuf; | ||
1771 | 1752 | ||
1772 | /* marshall the parameters */ | 1753 | /* marshall the parameters */ |
1773 | bp = call->request; | 1754 | bp = call->request; |
@@ -1789,7 +1770,7 @@ int yfs_fs_get_volume_status(struct afs_fs_cursor *fc, | |||
1789 | */ | 1770 | */ |
1790 | static int yfs_deliver_status_and_volsync(struct afs_call *call) | 1771 | static int yfs_deliver_status_and_volsync(struct afs_call *call) |
1791 | { | 1772 | { |
1792 | struct afs_vnode *vnode = call->reply[0]; | 1773 | struct afs_vnode *vnode = call->xvnode; |
1793 | const __be32 *bp; | 1774 | const __be32 *bp; |
1794 | int ret; | 1775 | int ret; |
1795 | 1776 | ||
@@ -1865,7 +1846,7 @@ int yfs_fs_set_lock(struct afs_fs_cursor *fc, afs_lock_type_t type) | |||
1865 | return -ENOMEM; | 1846 | return -ENOMEM; |
1866 | 1847 | ||
1867 | call->key = fc->key; | 1848 | call->key = fc->key; |
1868 | call->reply[0] = vnode; | 1849 | call->xvnode = vnode; |
1869 | call->want_reply_time = true; | 1850 | call->want_reply_time = true; |
1870 | 1851 | ||
1871 | /* marshall the parameters */ | 1852 | /* marshall the parameters */ |
@@ -1904,7 +1885,7 @@ int yfs_fs_extend_lock(struct afs_fs_cursor *fc) | |||
1904 | return -ENOMEM; | 1885 | return -ENOMEM; |
1905 | 1886 | ||
1906 | call->key = fc->key; | 1887 | call->key = fc->key; |
1907 | call->reply[0] = vnode; | 1888 | call->xvnode = vnode; |
1908 | call->want_reply_time = true; | 1889 | call->want_reply_time = true; |
1909 | 1890 | ||
1910 | /* marshall the parameters */ | 1891 | /* marshall the parameters */ |
@@ -1942,7 +1923,7 @@ int yfs_fs_release_lock(struct afs_fs_cursor *fc) | |||
1942 | return -ENOMEM; | 1923 | return -ENOMEM; |
1943 | 1924 | ||
1944 | call->key = fc->key; | 1925 | call->key = fc->key; |
1945 | call->reply[0] = vnode; | 1926 | call->xvnode = vnode; |
1946 | 1927 | ||
1947 | /* marshall the parameters */ | 1928 | /* marshall the parameters */ |
1948 | bp = call->request; | 1929 | bp = call->request; |
@@ -1963,10 +1944,9 @@ int yfs_fs_release_lock(struct afs_fs_cursor *fc) | |||
1963 | */ | 1944 | */ |
1964 | static int yfs_deliver_fs_fetch_status(struct afs_call *call) | 1945 | static int yfs_deliver_fs_fetch_status(struct afs_call *call) |
1965 | { | 1946 | { |
1966 | struct afs_file_status *status = call->reply[1]; | 1947 | struct afs_file_status *status = call->out_extra_status; |
1967 | struct afs_callback *callback = call->reply[2]; | 1948 | struct afs_callback *callback = call->out_cb; |
1968 | struct afs_volsync *volsync = call->reply[3]; | 1949 | struct afs_volsync *volsync = call->out_volsync; |
1969 | struct afs_vnode *vnode = call->reply[0]; | ||
1970 | const __be32 *bp; | 1950 | const __be32 *bp; |
1971 | int ret; | 1951 | int ret; |
1972 | 1952 | ||
@@ -1974,11 +1954,11 @@ static int yfs_deliver_fs_fetch_status(struct afs_call *call) | |||
1974 | if (ret < 0) | 1954 | if (ret < 0) |
1975 | return ret; | 1955 | return ret; |
1976 | 1956 | ||
1977 | _enter("{%llx:%llu}", vnode->fid.vid, vnode->fid.vnode); | 1957 | _enter(""); |
1978 | 1958 | ||
1979 | /* unmarshall the reply once we've received all of it */ | 1959 | /* unmarshall the reply once we've received all of it */ |
1980 | bp = call->buffer; | 1960 | bp = call->buffer; |
1981 | ret = yfs_decode_status(call, &bp, status, vnode, | 1961 | ret = yfs_decode_status(call, &bp, status, NULL, |
1982 | &call->expected_version, NULL); | 1962 | &call->expected_version, NULL); |
1983 | if (ret < 0) | 1963 | if (ret < 0) |
1984 | return ret; | 1964 | return ret; |
@@ -2027,10 +2007,9 @@ int yfs_fs_fetch_status(struct afs_fs_cursor *fc, | |||
2027 | } | 2007 | } |
2028 | 2008 | ||
2029 | call->key = fc->key; | 2009 | call->key = fc->key; |
2030 | call->reply[0] = NULL; /* vnode for fid[0] */ | 2010 | call->out_extra_status = status; |
2031 | call->reply[1] = status; | 2011 | call->out_cb = callback; |
2032 | call->reply[2] = callback; | 2012 | call->out_volsync = volsync; |
2033 | call->reply[3] = volsync; | ||
2034 | call->expected_version = 1; /* vnode->status.data_version */ | 2013 | call->expected_version = 1; /* vnode->status.data_version */ |
2035 | 2014 | ||
2036 | /* marshall the parameters */ | 2015 | /* marshall the parameters */ |
@@ -2093,7 +2072,7 @@ static int yfs_deliver_fs_inline_bulk_status(struct afs_call *call) | |||
2093 | return ret; | 2072 | return ret; |
2094 | 2073 | ||
2095 | bp = call->buffer; | 2074 | bp = call->buffer; |
2096 | statuses = call->reply[1]; | 2075 | statuses = call->out_extra_status; |
2097 | ret = yfs_decode_status(call, &bp, &statuses[call->count], | 2076 | ret = yfs_decode_status(call, &bp, &statuses[call->count], |
2098 | NULL, NULL, NULL); | 2077 | NULL, NULL, NULL); |
2099 | if (ret < 0) | 2078 | if (ret < 0) |
@@ -2134,7 +2113,7 @@ static int yfs_deliver_fs_inline_bulk_status(struct afs_call *call) | |||
2134 | 2113 | ||
2135 | _debug("unmarshall CB array"); | 2114 | _debug("unmarshall CB array"); |
2136 | bp = call->buffer; | 2115 | bp = call->buffer; |
2137 | callbacks = call->reply[2]; | 2116 | callbacks = call->out_cb; |
2138 | xdr_decode_YFSCallBack_raw(call, &callbacks[call->count], &bp); | 2117 | xdr_decode_YFSCallBack_raw(call, &callbacks[call->count], &bp); |
2139 | call->count++; | 2118 | call->count++; |
2140 | if (call->count < call->count2) | 2119 | if (call->count < call->count2) |
@@ -2150,7 +2129,7 @@ static int yfs_deliver_fs_inline_bulk_status(struct afs_call *call) | |||
2150 | return ret; | 2129 | return ret; |
2151 | 2130 | ||
2152 | bp = call->buffer; | 2131 | bp = call->buffer; |
2153 | xdr_decode_YFSVolSync(&bp, call->reply[3]); | 2132 | xdr_decode_YFSVolSync(&bp, call->out_volsync); |
2154 | 2133 | ||
2155 | call->unmarshall++; | 2134 | call->unmarshall++; |
2156 | 2135 | ||
@@ -2203,9 +2182,9 @@ int yfs_fs_inline_bulk_status(struct afs_fs_cursor *fc, | |||
2203 | } | 2182 | } |
2204 | 2183 | ||
2205 | call->key = fc->key; | 2184 | call->key = fc->key; |
2206 | call->reply[1] = statuses; | 2185 | call->out_extra_status = statuses; |
2207 | call->reply[2] = callbacks; | 2186 | call->out_cb = callbacks; |
2208 | call->reply[3] = volsync; | 2187 | call->out_volsync = volsync; |
2209 | call->count2 = nr_fids; | 2188 | call->count2 = nr_fids; |
2210 | 2189 | ||
2211 | /* marshall the parameters */ | 2190 | /* marshall the parameters */ |
@@ -2230,9 +2209,9 @@ int yfs_fs_inline_bulk_status(struct afs_fs_cursor *fc, | |||
2230 | */ | 2209 | */ |
2231 | static int yfs_deliver_fs_fetch_opaque_acl(struct afs_call *call) | 2210 | static int yfs_deliver_fs_fetch_opaque_acl(struct afs_call *call) |
2232 | { | 2211 | { |
2233 | struct afs_volsync *volsync = call->reply[2]; | 2212 | struct afs_volsync *volsync = call->out_volsync; |
2234 | struct afs_vnode *vnode = call->reply[1]; | 2213 | struct afs_vnode *vnode = call->xvnode; |
2235 | struct yfs_acl *yacl = call->reply[0]; | 2214 | struct yfs_acl *yacl = call->out_yacl; |
2236 | struct afs_acl *acl; | 2215 | struct afs_acl *acl; |
2237 | const __be32 *bp; | 2216 | const __be32 *bp; |
2238 | unsigned int size; | 2217 | unsigned int size; |
@@ -2378,9 +2357,9 @@ struct yfs_acl *yfs_fs_fetch_opaque_acl(struct afs_fs_cursor *fc, | |||
2378 | } | 2357 | } |
2379 | 2358 | ||
2380 | call->key = fc->key; | 2359 | call->key = fc->key; |
2381 | call->reply[0] = yacl; | 2360 | call->out_yacl = yacl; |
2382 | call->reply[1] = vnode; | 2361 | call->xvnode = vnode; |
2383 | call->reply[2] = NULL; /* volsync */ | 2362 | call->out_volsync = NULL; /* volsync */ |
2384 | 2363 | ||
2385 | /* marshall the parameters */ | 2364 | /* marshall the parameters */ |
2386 | bp = call->request; | 2365 | bp = call->request; |
@@ -2433,8 +2412,8 @@ int yfs_fs_store_opaque_acl2(struct afs_fs_cursor *fc, const struct afs_acl *acl | |||
2433 | } | 2412 | } |
2434 | 2413 | ||
2435 | call->key = fc->key; | 2414 | call->key = fc->key; |
2436 | call->reply[0] = vnode; | 2415 | call->xvnode = vnode; |
2437 | call->reply[2] = NULL; /* volsync */ | 2416 | call->out_volsync = NULL; |
2438 | 2417 | ||
2439 | /* marshall the parameters */ | 2418 | /* marshall the parameters */ |
2440 | bp = call->request; | 2419 | bp = call->request; |