1 /* AFS File Server client stubs
3 * Copyright (C) 2002, 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
12 #include <linux/init.h>
13 #include <linux/slab.h>
14 #include <linux/sched.h>
15 #include <linux/circ_buf.h>
16 #include <linux/iversion.h>
20 #include "protocol_yfs.h"
22 static const struct afs_fid afs_zero_fid;
24 static inline void afs_use_fs_server(struct afs_call *call, struct afs_cb_interest *cbi)
26 call->cbi = afs_get_cb_interest(cbi);
30 * decode an AFSFid block
32 static void xdr_decode_AFSFid(const __be32 **_bp, struct afs_fid *fid)
34 const __be32 *bp = *_bp;
36 fid->vid = ntohl(*bp++);
37 fid->vnode = ntohl(*bp++);
38 fid->unique = ntohl(*bp++);
43 * Dump a bad file status record.
45 static void xdr_dump_bad(const __be32 *bp)
50 pr_notice("AFS XDR: Bad status record\n");
51 for (i = 0; i < 5 * 4 * 4; i += 16) {
54 pr_notice("%03x: %08x %08x %08x %08x\n",
55 i, ntohl(x[0]), ntohl(x[1]), ntohl(x[2]), ntohl(x[3]));
59 pr_notice("0x50: %08x\n", ntohl(x[0]));
63 * Update the core inode struct from a returned status record.
65 void afs_update_inode_from_status(struct afs_vnode *vnode,
66 struct afs_file_status *status,
67 const afs_dataversion_t *expected_version,
73 t = status->mtime_client;
74 vnode->vfs_inode.i_ctime = t;
75 vnode->vfs_inode.i_mtime = t;
76 vnode->vfs_inode.i_atime = t;
78 if (flags & (AFS_VNODE_META_CHANGED | AFS_VNODE_NOT_YET_SET)) {
79 vnode->vfs_inode.i_uid = make_kuid(&init_user_ns, status->owner);
80 vnode->vfs_inode.i_gid = make_kgid(&init_user_ns, status->group);
81 set_nlink(&vnode->vfs_inode, status->nlink);
83 mode = vnode->vfs_inode.i_mode;
87 vnode->vfs_inode.i_mode = mode;
90 if (!(flags & AFS_VNODE_NOT_YET_SET)) {
91 if (expected_version &&
92 *expected_version != status->data_version) {
93 _debug("vnode modified %llx on {%llx:%llu} [exp %llx]",
94 (unsigned long long) status->data_version,
95 vnode->fid.vid, vnode->fid.vnode,
96 (unsigned long long) *expected_version);
97 vnode->invalid_before = status->data_version;
98 if (vnode->status.type == AFS_FTYPE_DIR) {
99 if (test_and_clear_bit(AFS_VNODE_DIR_VALID, &vnode->flags))
100 afs_stat_v(vnode, n_inval);
102 set_bit(AFS_VNODE_ZAP_DATA, &vnode->flags);
104 } else if (vnode->status.type == AFS_FTYPE_DIR) {
105 /* Expected directory change is handled elsewhere so
106 * that we can locally edit the directory and save on a
109 if (test_bit(AFS_VNODE_DIR_VALID, &vnode->flags))
110 flags &= ~AFS_VNODE_DATA_CHANGED;
114 if (flags & (AFS_VNODE_DATA_CHANGED | AFS_VNODE_NOT_YET_SET)) {
115 inode_set_iversion_raw(&vnode->vfs_inode, status->data_version);
116 i_size_write(&vnode->vfs_inode, status->size);
121 * decode an AFSFetchStatus block
123 static int xdr_decode_AFSFetchStatus(struct afs_call *call,
125 struct afs_file_status *status,
126 struct afs_vnode *vnode,
127 const afs_dataversion_t *expected_version,
128 struct afs_read *read_req)
130 const struct afs_xdr_AFSFetchStatus *xdr = (const void *)*_bp;
131 bool inline_error = (call->operation_ID == afs_FS_InlineBulkStatus);
132 u64 data_version, size;
133 u32 type, abort_code;
136 abort_code = ntohl(xdr->abort_code);
138 if (xdr->if_version != htonl(AFS_FSTATUS_VERSION)) {
139 if (xdr->if_version == htonl(0) &&
142 /* The OpenAFS fileserver has a bug in FS.InlineBulkStatus
143 * whereby it doesn't set the interface version in the error
146 status->abort_code = abort_code;
150 pr_warn("Unknown AFSFetchStatus version %u\n", ntohl(xdr->if_version));
154 if (abort_code != 0 && inline_error) {
155 status->abort_code = abort_code;
159 type = ntohl(xdr->type);
163 case AFS_FTYPE_SYMLINK:
164 if (type != status->type &&
166 !test_bit(AFS_VNODE_UNSET, &vnode->flags)) {
167 pr_warning("Vnode %llx:%llx:%x changed type %u to %u\n",
180 #define EXTRACT_M(FIELD) \
182 u32 x = ntohl(xdr->FIELD); \
183 if (status->FIELD != x) { \
184 flags |= AFS_VNODE_META_CHANGED; \
192 EXTRACT_M(caller_access); /* call ticket dependent */
193 EXTRACT_M(anon_access);
197 status->mtime_client.tv_sec = ntohl(xdr->mtime_client);
198 status->mtime_client.tv_nsec = 0;
199 status->mtime_server.tv_sec = ntohl(xdr->mtime_server);
200 status->mtime_server.tv_nsec = 0;
201 status->lock_count = ntohl(xdr->lock_count);
203 size = (u64)ntohl(xdr->size_lo);
204 size |= (u64)ntohl(xdr->size_hi) << 32;
207 data_version = (u64)ntohl(xdr->data_version_lo);
208 data_version |= (u64)ntohl(xdr->data_version_hi) << 32;
209 if (data_version != status->data_version) {
210 status->data_version = data_version;
211 flags |= AFS_VNODE_DATA_CHANGED;
215 read_req->data_version = data_version;
216 read_req->file_size = size;
219 *_bp = (const void *)*_bp + sizeof(*xdr);
222 if (test_bit(AFS_VNODE_UNSET, &vnode->flags))
223 flags |= AFS_VNODE_NOT_YET_SET;
224 afs_update_inode_from_status(vnode, status, expected_version,
232 return afs_protocol_error(call, -EBADMSG, afs_eproto_bad_status);
236 * Decode the file status. We need to lock the target vnode if we're going to
237 * update its status so that stat() sees the attributes update atomically.
239 static int afs_decode_status(struct afs_call *call,
241 struct afs_file_status *status,
242 struct afs_vnode *vnode,
243 const afs_dataversion_t *expected_version,
244 struct afs_read *read_req)
249 return xdr_decode_AFSFetchStatus(call, _bp, status, vnode,
250 expected_version, read_req);
252 write_seqlock(&vnode->cb_lock);
253 ret = xdr_decode_AFSFetchStatus(call, _bp, status, vnode,
254 expected_version, read_req);
255 write_sequnlock(&vnode->cb_lock);
260 * decode an AFSCallBack block
262 static void xdr_decode_AFSCallBack(struct afs_call *call,
263 struct afs_vnode *vnode,
266 struct afs_cb_interest *old, *cbi = call->cbi;
267 const __be32 *bp = *_bp;
270 write_seqlock(&vnode->cb_lock);
272 if (!afs_cb_is_broken(call->cb_break, vnode, cbi)) {
273 vnode->cb_version = ntohl(*bp++);
274 cb_expiry = ntohl(*bp++);
275 vnode->cb_type = ntohl(*bp++);
276 vnode->cb_expires_at = cb_expiry + ktime_get_real_seconds();
277 old = vnode->cb_interest;
278 if (old != call->cbi) {
279 vnode->cb_interest = cbi;
282 set_bit(AFS_VNODE_CB_PROMISED, &vnode->flags);
287 write_sequnlock(&vnode->cb_lock);
292 static ktime_t xdr_decode_expiry(struct afs_call *call, u32 expiry)
294 return ktime_add_ns(call->reply_time, expiry * NSEC_PER_SEC);
297 static void xdr_decode_AFSCallBack_raw(struct afs_call *call,
299 struct afs_callback *cb)
301 const __be32 *bp = *_bp;
303 cb->version = ntohl(*bp++);
304 cb->expires_at = xdr_decode_expiry(call, ntohl(*bp++));
305 cb->type = ntohl(*bp++);
310 * decode an AFSVolSync block
312 static void xdr_decode_AFSVolSync(const __be32 **_bp,
313 struct afs_volsync *volsync)
315 const __be32 *bp = *_bp;
318 creation = ntohl(*bp++);
327 volsync->creation = creation;
331 * encode the requested attributes into an AFSStoreStatus block
333 static void xdr_encode_AFS_StoreStatus(__be32 **_bp, struct iattr *attr)
336 u32 mask = 0, mtime = 0, owner = 0, group = 0, mode = 0;
339 if (attr->ia_valid & ATTR_MTIME) {
340 mask |= AFS_SET_MTIME;
341 mtime = attr->ia_mtime.tv_sec;
344 if (attr->ia_valid & ATTR_UID) {
345 mask |= AFS_SET_OWNER;
346 owner = from_kuid(&init_user_ns, attr->ia_uid);
349 if (attr->ia_valid & ATTR_GID) {
350 mask |= AFS_SET_GROUP;
351 group = from_kgid(&init_user_ns, attr->ia_gid);
354 if (attr->ia_valid & ATTR_MODE) {
355 mask |= AFS_SET_MODE;
356 mode = attr->ia_mode & S_IALLUGO;
360 *bp++ = htonl(mtime);
361 *bp++ = htonl(owner);
362 *bp++ = htonl(group);
364 *bp++ = 0; /* segment size */
369 * decode an AFSFetchVolumeStatus block
371 static void xdr_decode_AFSFetchVolumeStatus(const __be32 **_bp,
372 struct afs_volume_status *vs)
374 const __be32 *bp = *_bp;
376 vs->vid = ntohl(*bp++);
377 vs->parent_id = ntohl(*bp++);
378 vs->online = ntohl(*bp++);
379 vs->in_service = ntohl(*bp++);
380 vs->blessed = ntohl(*bp++);
381 vs->needs_salvage = ntohl(*bp++);
382 vs->type = ntohl(*bp++);
383 vs->min_quota = ntohl(*bp++);
384 vs->max_quota = ntohl(*bp++);
385 vs->blocks_in_use = ntohl(*bp++);
386 vs->part_blocks_avail = ntohl(*bp++);
387 vs->part_max_blocks = ntohl(*bp++);
388 vs->vol_copy_date = 0;
389 vs->vol_backup_date = 0;
394 * deliver reply data to an FS.FetchStatus
396 static int afs_deliver_fs_fetch_status_vnode(struct afs_call *call)
398 struct afs_vnode *vnode = call->reply[0];
402 ret = afs_transfer_reply(call);
406 _enter("{%llx:%llu}", vnode->fid.vid, vnode->fid.vnode);
408 /* unmarshall the reply once we've received all of it */
410 ret = afs_decode_status(call, &bp, &vnode->status, vnode,
411 &call->expected_version, NULL);
414 xdr_decode_AFSCallBack(call, vnode, &bp);
415 xdr_decode_AFSVolSync(&bp, call->reply[1]);
417 _leave(" = 0 [done]");
422 * FS.FetchStatus operation type
424 static const struct afs_call_type afs_RXFSFetchStatus_vnode = {
425 .name = "FS.FetchStatus(vnode)",
426 .op = afs_FS_FetchStatus,
427 .deliver = afs_deliver_fs_fetch_status_vnode,
428 .destructor = afs_flat_call_destructor,
432 * fetch the status information for a file
434 int afs_fs_fetch_file_status(struct afs_fs_cursor *fc, struct afs_volsync *volsync,
437 struct afs_vnode *vnode = fc->vnode;
438 struct afs_call *call;
439 struct afs_net *net = afs_v2net(vnode);
442 if (test_bit(AFS_SERVER_FL_IS_YFS, &fc->cbi->server->flags))
443 return yfs_fs_fetch_file_status(fc, volsync, new_inode);
445 _enter(",%x,{%llx:%llu},,",
446 key_serial(fc->key), vnode->fid.vid, vnode->fid.vnode);
448 call = afs_alloc_flat_call(net, &afs_RXFSFetchStatus_vnode,
449 16, (21 + 3 + 6) * 4);
451 fc->ac.error = -ENOMEM;
456 call->reply[0] = vnode;
457 call->reply[1] = volsync;
458 call->expected_version = new_inode ? 1 : vnode->status.data_version;
459 call->want_reply_time = true;
461 /* marshall the parameters */
463 bp[0] = htonl(FSFETCHSTATUS);
464 bp[1] = htonl(vnode->fid.vid);
465 bp[2] = htonl(vnode->fid.vnode);
466 bp[3] = htonl(vnode->fid.unique);
468 call->cb_break = fc->cb_break;
469 afs_use_fs_server(call, fc->cbi);
470 trace_afs_make_fs_call(call, &vnode->fid);
472 afs_make_call(&fc->ac, call, GFP_NOFS);
473 return afs_wait_for_call_to_complete(call, &fc->ac);
477 * deliver reply data to an FS.FetchData
479 static int afs_deliver_fs_fetch_data(struct afs_call *call)
481 struct afs_vnode *vnode = call->reply[0];
482 struct afs_read *req = call->reply[2];
487 _enter("{%u,%zu/%llu}",
488 call->unmarshall, iov_iter_count(&call->iter), req->actual_len);
490 switch (call->unmarshall) {
494 req->offset = req->pos & (PAGE_SIZE - 1);
496 if (call->operation_ID == FSFETCHDATA64) {
497 afs_extract_to_tmp64(call);
499 call->tmp_u = htonl(0);
500 afs_extract_to_tmp(call);
503 /* Fall through - and extract the returned data length */
505 _debug("extract data length");
506 ret = afs_extract_data(call, true);
510 req->actual_len = be64_to_cpu(call->tmp64);
511 _debug("DATA length: %llu", req->actual_len);
512 req->remain = min(req->len, req->actual_len);
513 if (req->remain == 0)
519 ASSERTCMP(req->index, <, req->nr_pages);
520 if (req->remain > PAGE_SIZE - req->offset)
521 size = PAGE_SIZE - req->offset;
524 call->bvec[0].bv_len = size;
525 call->bvec[0].bv_offset = req->offset;
526 call->bvec[0].bv_page = req->pages[req->index];
527 iov_iter_bvec(&call->iter, READ, call->bvec, 1, size);
528 ASSERTCMP(size, <=, PAGE_SIZE);
530 /* Fall through - and extract the returned data */
532 _debug("extract data %zu/%llu",
533 iov_iter_count(&call->iter), req->remain);
535 ret = afs_extract_data(call, true);
538 req->remain -= call->bvec[0].bv_len;
539 req->offset += call->bvec[0].bv_len;
540 ASSERTCMP(req->offset, <=, PAGE_SIZE);
541 if (req->offset == PAGE_SIZE) {
544 req->page_done(call, req);
550 ASSERTCMP(req->remain, ==, 0);
551 if (req->actual_len <= req->len)
554 /* Discard any excess data the server gave us */
555 iov_iter_discard(&call->iter, READ, req->actual_len - req->len);
556 call->unmarshall = 3;
560 _debug("extract discard %zu/%llu",
561 iov_iter_count(&call->iter), req->actual_len - req->len);
563 ret = afs_extract_data(call, true);
568 call->unmarshall = 4;
569 afs_extract_to_buf(call, (21 + 3 + 6) * 4);
571 /* Fall through - and extract the metadata */
573 ret = afs_extract_data(call, false);
578 ret = afs_decode_status(call, &bp, &vnode->status, vnode,
579 &vnode->status.data_version, req);
582 xdr_decode_AFSCallBack(call, vnode, &bp);
583 xdr_decode_AFSVolSync(&bp, call->reply[1]);
591 for (; req->index < req->nr_pages; req->index++) {
592 if (req->offset < PAGE_SIZE)
593 zero_user_segment(req->pages[req->index],
594 req->offset, PAGE_SIZE);
596 req->page_done(call, req);
600 _leave(" = 0 [done]");
604 static void afs_fetch_data_destructor(struct afs_call *call)
606 struct afs_read *req = call->reply[2];
609 afs_flat_call_destructor(call);
613 * FS.FetchData operation type
615 static const struct afs_call_type afs_RXFSFetchData = {
616 .name = "FS.FetchData",
617 .op = afs_FS_FetchData,
618 .deliver = afs_deliver_fs_fetch_data,
619 .destructor = afs_fetch_data_destructor,
622 static const struct afs_call_type afs_RXFSFetchData64 = {
623 .name = "FS.FetchData64",
624 .op = afs_FS_FetchData64,
625 .deliver = afs_deliver_fs_fetch_data,
626 .destructor = afs_fetch_data_destructor,
630 * fetch data from a very large file
632 static int afs_fs_fetch_data64(struct afs_fs_cursor *fc, struct afs_read *req)
634 struct afs_vnode *vnode = fc->vnode;
635 struct afs_call *call;
636 struct afs_net *net = afs_v2net(vnode);
641 call = afs_alloc_flat_call(net, &afs_RXFSFetchData64, 32, (21 + 3 + 6) * 4);
646 call->reply[0] = vnode;
647 call->reply[1] = NULL; /* volsync */
648 call->reply[2] = req;
649 call->expected_version = vnode->status.data_version;
650 call->want_reply_time = true;
652 /* marshall the parameters */
654 bp[0] = htonl(FSFETCHDATA64);
655 bp[1] = htonl(vnode->fid.vid);
656 bp[2] = htonl(vnode->fid.vnode);
657 bp[3] = htonl(vnode->fid.unique);
658 bp[4] = htonl(upper_32_bits(req->pos));
659 bp[5] = htonl(lower_32_bits(req->pos));
661 bp[7] = htonl(lower_32_bits(req->len));
663 refcount_inc(&req->usage);
664 call->cb_break = fc->cb_break;
665 afs_use_fs_server(call, fc->cbi);
666 trace_afs_make_fs_call(call, &vnode->fid);
667 afs_make_call(&fc->ac, call, GFP_NOFS);
668 return afs_wait_for_call_to_complete(call, &fc->ac);
672 * fetch data from a file
674 int afs_fs_fetch_data(struct afs_fs_cursor *fc, struct afs_read *req)
676 struct afs_vnode *vnode = fc->vnode;
677 struct afs_call *call;
678 struct afs_net *net = afs_v2net(vnode);
681 if (test_bit(AFS_SERVER_FL_IS_YFS, &fc->cbi->server->flags))
682 return yfs_fs_fetch_data(fc, req);
684 if (upper_32_bits(req->pos) ||
685 upper_32_bits(req->len) ||
686 upper_32_bits(req->pos + req->len))
687 return afs_fs_fetch_data64(fc, req);
691 call = afs_alloc_flat_call(net, &afs_RXFSFetchData, 24, (21 + 3 + 6) * 4);
696 call->reply[0] = vnode;
697 call->reply[1] = NULL; /* volsync */
698 call->reply[2] = req;
699 call->expected_version = vnode->status.data_version;
700 call->want_reply_time = true;
702 /* marshall the parameters */
704 bp[0] = htonl(FSFETCHDATA);
705 bp[1] = htonl(vnode->fid.vid);
706 bp[2] = htonl(vnode->fid.vnode);
707 bp[3] = htonl(vnode->fid.unique);
708 bp[4] = htonl(lower_32_bits(req->pos));
709 bp[5] = htonl(lower_32_bits(req->len));
711 refcount_inc(&req->usage);
712 call->cb_break = fc->cb_break;
713 afs_use_fs_server(call, fc->cbi);
714 trace_afs_make_fs_call(call, &vnode->fid);
715 afs_make_call(&fc->ac, call, GFP_NOFS);
716 return afs_wait_for_call_to_complete(call, &fc->ac);
720 * deliver reply data to an FS.CreateFile or an FS.MakeDir
722 static int afs_deliver_fs_create_vnode(struct afs_call *call)
724 struct afs_vnode *vnode = call->reply[0];
728 _enter("{%u}", call->unmarshall);
730 ret = afs_transfer_reply(call);
734 /* unmarshall the reply once we've received all of it */
736 xdr_decode_AFSFid(&bp, call->reply[1]);
737 ret = afs_decode_status(call, &bp, call->reply[2], NULL, NULL, NULL);
740 ret = afs_decode_status(call, &bp, &vnode->status, vnode,
741 &call->expected_version, NULL);
744 xdr_decode_AFSCallBack_raw(call, &bp, call->reply[3]);
745 /* xdr_decode_AFSVolSync(&bp, call->reply[X]); */
747 _leave(" = 0 [done]");
752 * FS.CreateFile and FS.MakeDir operation type
754 static const struct afs_call_type afs_RXFSCreateFile = {
755 .name = "FS.CreateFile",
756 .op = afs_FS_CreateFile,
757 .deliver = afs_deliver_fs_create_vnode,
758 .destructor = afs_flat_call_destructor,
761 static const struct afs_call_type afs_RXFSMakeDir = {
762 .name = "FS.MakeDir",
763 .op = afs_FS_MakeDir,
764 .deliver = afs_deliver_fs_create_vnode,
765 .destructor = afs_flat_call_destructor,
769 * create a file or make a directory
771 int afs_fs_create(struct afs_fs_cursor *fc,
774 u64 current_data_version,
775 struct afs_fid *newfid,
776 struct afs_file_status *newstatus,
777 struct afs_callback *newcb)
779 struct afs_vnode *vnode = fc->vnode;
780 struct afs_call *call;
781 struct afs_net *net = afs_v2net(vnode);
782 size_t namesz, reqsz, padsz;
785 if (test_bit(AFS_SERVER_FL_IS_YFS, &fc->cbi->server->flags)){
787 return yfs_fs_make_dir(fc, name, mode, current_data_version,
788 newfid, newstatus, newcb);
790 return yfs_fs_create_file(fc, name, mode, current_data_version,
791 newfid, newstatus, newcb);
796 namesz = strlen(name);
797 padsz = (4 - (namesz & 3)) & 3;
798 reqsz = (5 * 4) + namesz + padsz + (6 * 4);
800 call = afs_alloc_flat_call(
801 net, S_ISDIR(mode) ? &afs_RXFSMakeDir : &afs_RXFSCreateFile,
802 reqsz, (3 + 21 + 21 + 3 + 6) * 4);
807 call->reply[0] = vnode;
808 call->reply[1] = newfid;
809 call->reply[2] = newstatus;
810 call->reply[3] = newcb;
811 call->expected_version = current_data_version + 1;
812 call->want_reply_time = true;
814 /* marshall the parameters */
816 *bp++ = htonl(S_ISDIR(mode) ? FSMAKEDIR : FSCREATEFILE);
817 *bp++ = htonl(vnode->fid.vid);
818 *bp++ = htonl(vnode->fid.vnode);
819 *bp++ = htonl(vnode->fid.unique);
820 *bp++ = htonl(namesz);
821 memcpy(bp, name, namesz);
822 bp = (void *) bp + namesz;
824 memset(bp, 0, padsz);
825 bp = (void *) bp + padsz;
827 *bp++ = htonl(AFS_SET_MODE | AFS_SET_MTIME);
828 *bp++ = htonl(vnode->vfs_inode.i_mtime.tv_sec); /* mtime */
829 *bp++ = 0; /* owner */
830 *bp++ = 0; /* group */
831 *bp++ = htonl(mode & S_IALLUGO); /* unix mode */
832 *bp++ = 0; /* segment size */
834 afs_use_fs_server(call, fc->cbi);
835 trace_afs_make_fs_call1(call, &vnode->fid, name);
836 afs_make_call(&fc->ac, call, GFP_NOFS);
837 return afs_wait_for_call_to_complete(call, &fc->ac);
841 * Deliver reply data to any operation that returns file status and volume
844 static int afs_deliver_fs_status_and_vol(struct afs_call *call)
846 struct afs_vnode *vnode = call->reply[0];
850 _enter("{%u}", call->unmarshall);
852 ret = afs_transfer_reply(call);
856 /* unmarshall the reply once we've received all of it */
858 ret = afs_decode_status(call, &bp, &vnode->status, vnode,
859 &call->expected_version, NULL);
862 /* xdr_decode_AFSVolSync(&bp, call->reply[X]); */
864 _leave(" = 0 [done]");
869 * FS.RemoveDir/FS.RemoveFile operation type
871 static const struct afs_call_type afs_RXFSRemoveFile = {
872 .name = "FS.RemoveFile",
873 .op = afs_FS_RemoveFile,
874 .deliver = afs_deliver_fs_status_and_vol,
875 .destructor = afs_flat_call_destructor,
878 static const struct afs_call_type afs_RXFSRemoveDir = {
879 .name = "FS.RemoveDir",
880 .op = afs_FS_RemoveDir,
881 .deliver = afs_deliver_fs_status_and_vol,
882 .destructor = afs_flat_call_destructor,
886 * remove a file or directory
888 int afs_fs_remove(struct afs_fs_cursor *fc, struct afs_vnode *vnode,
889 const char *name, bool isdir, u64 current_data_version)
891 struct afs_vnode *dvnode = fc->vnode;
892 struct afs_call *call;
893 struct afs_net *net = afs_v2net(dvnode);
894 size_t namesz, reqsz, padsz;
897 if (test_bit(AFS_SERVER_FL_IS_YFS, &fc->cbi->server->flags))
898 return yfs_fs_remove(fc, vnode, name, isdir, current_data_version);
902 namesz = strlen(name);
903 padsz = (4 - (namesz & 3)) & 3;
904 reqsz = (5 * 4) + namesz + padsz;
906 call = afs_alloc_flat_call(
907 net, isdir ? &afs_RXFSRemoveDir : &afs_RXFSRemoveFile,
908 reqsz, (21 + 6) * 4);
913 call->reply[0] = dvnode;
914 call->reply[1] = vnode;
915 call->expected_version = current_data_version + 1;
917 /* marshall the parameters */
919 *bp++ = htonl(isdir ? FSREMOVEDIR : FSREMOVEFILE);
920 *bp++ = htonl(dvnode->fid.vid);
921 *bp++ = htonl(dvnode->fid.vnode);
922 *bp++ = htonl(dvnode->fid.unique);
923 *bp++ = htonl(namesz);
924 memcpy(bp, name, namesz);
925 bp = (void *) bp + namesz;
927 memset(bp, 0, padsz);
928 bp = (void *) bp + padsz;
931 afs_use_fs_server(call, fc->cbi);
932 trace_afs_make_fs_call1(call, &dvnode->fid, name);
933 afs_make_call(&fc->ac, call, GFP_NOFS);
934 return afs_wait_for_call_to_complete(call, &fc->ac);
938 * deliver reply data to an FS.Link
940 static int afs_deliver_fs_link(struct afs_call *call)
942 struct afs_vnode *dvnode = call->reply[0], *vnode = call->reply[1];
946 _enter("{%u}", call->unmarshall);
948 ret = afs_transfer_reply(call);
952 /* unmarshall the reply once we've received all of it */
954 ret = afs_decode_status(call, &bp, &vnode->status, vnode, NULL, NULL);
957 ret = afs_decode_status(call, &bp, &dvnode->status, dvnode,
958 &call->expected_version, NULL);
961 /* xdr_decode_AFSVolSync(&bp, call->reply[X]); */
963 _leave(" = 0 [done]");
968 * FS.Link operation type
970 static const struct afs_call_type afs_RXFSLink = {
973 .deliver = afs_deliver_fs_link,
974 .destructor = afs_flat_call_destructor,
980 int afs_fs_link(struct afs_fs_cursor *fc, struct afs_vnode *vnode,
981 const char *name, u64 current_data_version)
983 struct afs_vnode *dvnode = fc->vnode;
984 struct afs_call *call;
985 struct afs_net *net = afs_v2net(vnode);
986 size_t namesz, reqsz, padsz;
989 if (test_bit(AFS_SERVER_FL_IS_YFS, &fc->cbi->server->flags))
990 return yfs_fs_link(fc, vnode, name, current_data_version);
994 namesz = strlen(name);
995 padsz = (4 - (namesz & 3)) & 3;
996 reqsz = (5 * 4) + namesz + padsz + (3 * 4);
998 call = afs_alloc_flat_call(net, &afs_RXFSLink, reqsz, (21 + 21 + 6) * 4);
1002 call->key = fc->key;
1003 call->reply[0] = dvnode;
1004 call->reply[1] = vnode;
1005 call->expected_version = current_data_version + 1;
1007 /* marshall the parameters */
1009 *bp++ = htonl(FSLINK);
1010 *bp++ = htonl(dvnode->fid.vid);
1011 *bp++ = htonl(dvnode->fid.vnode);
1012 *bp++ = htonl(dvnode->fid.unique);
1013 *bp++ = htonl(namesz);
1014 memcpy(bp, name, namesz);
1015 bp = (void *) bp + namesz;
1017 memset(bp, 0, padsz);
1018 bp = (void *) bp + padsz;
1020 *bp++ = htonl(vnode->fid.vid);
1021 *bp++ = htonl(vnode->fid.vnode);
1022 *bp++ = htonl(vnode->fid.unique);
1024 afs_use_fs_server(call, fc->cbi);
1025 trace_afs_make_fs_call1(call, &vnode->fid, name);
1026 afs_make_call(&fc->ac, call, GFP_NOFS);
1027 return afs_wait_for_call_to_complete(call, &fc->ac);
1031 * deliver reply data to an FS.Symlink
1033 static int afs_deliver_fs_symlink(struct afs_call *call)
1035 struct afs_vnode *vnode = call->reply[0];
1039 _enter("{%u}", call->unmarshall);
1041 ret = afs_transfer_reply(call);
1045 /* unmarshall the reply once we've received all of it */
1047 xdr_decode_AFSFid(&bp, call->reply[1]);
1048 ret = afs_decode_status(call, &bp, call->reply[2], NULL, NULL, NULL);
1051 ret = afs_decode_status(call, &bp, &vnode->status, vnode,
1052 &call->expected_version, NULL);
1055 /* xdr_decode_AFSVolSync(&bp, call->reply[X]); */
1057 _leave(" = 0 [done]");
1062 * FS.Symlink operation type
1064 static const struct afs_call_type afs_RXFSSymlink = {
1065 .name = "FS.Symlink",
1066 .op = afs_FS_Symlink,
1067 .deliver = afs_deliver_fs_symlink,
1068 .destructor = afs_flat_call_destructor,
1072 * create a symbolic link
1074 int afs_fs_symlink(struct afs_fs_cursor *fc,
1076 const char *contents,
1077 u64 current_data_version,
1078 struct afs_fid *newfid,
1079 struct afs_file_status *newstatus)
1081 struct afs_vnode *vnode = fc->vnode;
1082 struct afs_call *call;
1083 struct afs_net *net = afs_v2net(vnode);
1084 size_t namesz, reqsz, padsz, c_namesz, c_padsz;
1087 if (test_bit(AFS_SERVER_FL_IS_YFS, &fc->cbi->server->flags))
1088 return yfs_fs_symlink(fc, name, contents, current_data_version,
1093 namesz = strlen(name);
1094 padsz = (4 - (namesz & 3)) & 3;
1096 c_namesz = strlen(contents);
1097 c_padsz = (4 - (c_namesz & 3)) & 3;
1099 reqsz = (6 * 4) + namesz + padsz + c_namesz + c_padsz + (6 * 4);
1101 call = afs_alloc_flat_call(net, &afs_RXFSSymlink, reqsz,
1102 (3 + 21 + 21 + 6) * 4);
1106 call->key = fc->key;
1107 call->reply[0] = vnode;
1108 call->reply[1] = newfid;
1109 call->reply[2] = newstatus;
1110 call->expected_version = current_data_version + 1;
1112 /* marshall the parameters */
1114 *bp++ = htonl(FSSYMLINK);
1115 *bp++ = htonl(vnode->fid.vid);
1116 *bp++ = htonl(vnode->fid.vnode);
1117 *bp++ = htonl(vnode->fid.unique);
1118 *bp++ = htonl(namesz);
1119 memcpy(bp, name, namesz);
1120 bp = (void *) bp + namesz;
1122 memset(bp, 0, padsz);
1123 bp = (void *) bp + padsz;
1125 *bp++ = htonl(c_namesz);
1126 memcpy(bp, contents, c_namesz);
1127 bp = (void *) bp + c_namesz;
1129 memset(bp, 0, c_padsz);
1130 bp = (void *) bp + c_padsz;
1132 *bp++ = htonl(AFS_SET_MODE | AFS_SET_MTIME);
1133 *bp++ = htonl(vnode->vfs_inode.i_mtime.tv_sec); /* mtime */
1134 *bp++ = 0; /* owner */
1135 *bp++ = 0; /* group */
1136 *bp++ = htonl(S_IRWXUGO); /* unix mode */
1137 *bp++ = 0; /* segment size */
1139 afs_use_fs_server(call, fc->cbi);
1140 trace_afs_make_fs_call1(call, &vnode->fid, name);
1141 afs_make_call(&fc->ac, call, GFP_NOFS);
1142 return afs_wait_for_call_to_complete(call, &fc->ac);
1146 * deliver reply data to an FS.Rename
1148 static int afs_deliver_fs_rename(struct afs_call *call)
1150 struct afs_vnode *orig_dvnode = call->reply[0], *new_dvnode = call->reply[1];
1154 _enter("{%u}", call->unmarshall);
1156 ret = afs_transfer_reply(call);
1160 /* unmarshall the reply once we've received all of it */
1162 ret = afs_decode_status(call, &bp, &orig_dvnode->status, orig_dvnode,
1163 &call->expected_version, NULL);
1166 if (new_dvnode != orig_dvnode) {
1167 ret = afs_decode_status(call, &bp, &new_dvnode->status, new_dvnode,
1168 &call->expected_version_2, NULL);
1172 /* xdr_decode_AFSVolSync(&bp, call->reply[X]); */
1174 _leave(" = 0 [done]");
1179 * FS.Rename operation type
1181 static const struct afs_call_type afs_RXFSRename = {
1182 .name = "FS.Rename",
1183 .op = afs_FS_Rename,
1184 .deliver = afs_deliver_fs_rename,
1185 .destructor = afs_flat_call_destructor,
1189 * create a symbolic link
1191 int afs_fs_rename(struct afs_fs_cursor *fc,
1192 const char *orig_name,
1193 struct afs_vnode *new_dvnode,
1194 const char *new_name,
1195 u64 current_orig_data_version,
1196 u64 current_new_data_version)
1198 struct afs_vnode *orig_dvnode = fc->vnode;
1199 struct afs_call *call;
1200 struct afs_net *net = afs_v2net(orig_dvnode);
1201 size_t reqsz, o_namesz, o_padsz, n_namesz, n_padsz;
1204 if (test_bit(AFS_SERVER_FL_IS_YFS, &fc->cbi->server->flags))
1205 return yfs_fs_rename(fc, orig_name,
1206 new_dvnode, new_name,
1207 current_orig_data_version,
1208 current_new_data_version);
1212 o_namesz = strlen(orig_name);
1213 o_padsz = (4 - (o_namesz & 3)) & 3;
1215 n_namesz = strlen(new_name);
1216 n_padsz = (4 - (n_namesz & 3)) & 3;
1219 4 + o_namesz + o_padsz +
1221 4 + n_namesz + n_padsz;
1223 call = afs_alloc_flat_call(net, &afs_RXFSRename, reqsz, (21 + 21 + 6) * 4);
1227 call->key = fc->key;
1228 call->reply[0] = orig_dvnode;
1229 call->reply[1] = new_dvnode;
1230 call->expected_version = current_orig_data_version + 1;
1231 call->expected_version_2 = current_new_data_version + 1;
1233 /* marshall the parameters */
1235 *bp++ = htonl(FSRENAME);
1236 *bp++ = htonl(orig_dvnode->fid.vid);
1237 *bp++ = htonl(orig_dvnode->fid.vnode);
1238 *bp++ = htonl(orig_dvnode->fid.unique);
1239 *bp++ = htonl(o_namesz);
1240 memcpy(bp, orig_name, o_namesz);
1241 bp = (void *) bp + o_namesz;
1243 memset(bp, 0, o_padsz);
1244 bp = (void *) bp + o_padsz;
1247 *bp++ = htonl(new_dvnode->fid.vid);
1248 *bp++ = htonl(new_dvnode->fid.vnode);
1249 *bp++ = htonl(new_dvnode->fid.unique);
1250 *bp++ = htonl(n_namesz);
1251 memcpy(bp, new_name, n_namesz);
1252 bp = (void *) bp + n_namesz;
1254 memset(bp, 0, n_padsz);
1255 bp = (void *) bp + n_padsz;
1258 afs_use_fs_server(call, fc->cbi);
1259 trace_afs_make_fs_call2(call, &orig_dvnode->fid, orig_name, new_name);
1260 afs_make_call(&fc->ac, call, GFP_NOFS);
1261 return afs_wait_for_call_to_complete(call, &fc->ac);
1265 * deliver reply data to an FS.StoreData
1267 static int afs_deliver_fs_store_data(struct afs_call *call)
1269 struct afs_vnode *vnode = call->reply[0];
1275 ret = afs_transfer_reply(call);
1279 /* unmarshall the reply once we've received all of it */
1281 ret = afs_decode_status(call, &bp, &vnode->status, vnode,
1282 &call->expected_version, NULL);
1285 /* xdr_decode_AFSVolSync(&bp, call->reply[X]); */
1287 afs_pages_written_back(vnode, call);
1289 _leave(" = 0 [done]");
1294 * FS.StoreData operation type
1296 static const struct afs_call_type afs_RXFSStoreData = {
1297 .name = "FS.StoreData",
1298 .op = afs_FS_StoreData,
1299 .deliver = afs_deliver_fs_store_data,
1300 .destructor = afs_flat_call_destructor,
1303 static const struct afs_call_type afs_RXFSStoreData64 = {
1304 .name = "FS.StoreData64",
1305 .op = afs_FS_StoreData64,
1306 .deliver = afs_deliver_fs_store_data,
1307 .destructor = afs_flat_call_destructor,
1311 * store a set of pages to a very large file
1313 static int afs_fs_store_data64(struct afs_fs_cursor *fc,
1314 struct address_space *mapping,
1315 pgoff_t first, pgoff_t last,
1316 unsigned offset, unsigned to,
1317 loff_t size, loff_t pos, loff_t i_size)
1319 struct afs_vnode *vnode = fc->vnode;
1320 struct afs_call *call;
1321 struct afs_net *net = afs_v2net(vnode);
1324 _enter(",%x,{%llx:%llu},,",
1325 key_serial(fc->key), vnode->fid.vid, vnode->fid.vnode);
1327 call = afs_alloc_flat_call(net, &afs_RXFSStoreData64,
1328 (4 + 6 + 3 * 2) * 4,
1333 call->key = fc->key;
1334 call->mapping = mapping;
1335 call->reply[0] = vnode;
1336 call->first = first;
1338 call->first_offset = offset;
1340 call->send_pages = true;
1341 call->expected_version = vnode->status.data_version + 1;
1343 /* marshall the parameters */
1345 *bp++ = htonl(FSSTOREDATA64);
1346 *bp++ = htonl(vnode->fid.vid);
1347 *bp++ = htonl(vnode->fid.vnode);
1348 *bp++ = htonl(vnode->fid.unique);
1350 *bp++ = htonl(AFS_SET_MTIME); /* mask */
1351 *bp++ = htonl(vnode->vfs_inode.i_mtime.tv_sec); /* mtime */
1352 *bp++ = 0; /* owner */
1353 *bp++ = 0; /* group */
1354 *bp++ = 0; /* unix mode */
1355 *bp++ = 0; /* segment size */
1357 *bp++ = htonl(pos >> 32);
1358 *bp++ = htonl((u32) pos);
1359 *bp++ = htonl(size >> 32);
1360 *bp++ = htonl((u32) size);
1361 *bp++ = htonl(i_size >> 32);
1362 *bp++ = htonl((u32) i_size);
1364 trace_afs_make_fs_call(call, &vnode->fid);
1365 afs_make_call(&fc->ac, call, GFP_NOFS);
1366 return afs_wait_for_call_to_complete(call, &fc->ac);
1370 * store a set of pages
1372 int afs_fs_store_data(struct afs_fs_cursor *fc, struct address_space *mapping,
1373 pgoff_t first, pgoff_t last,
1374 unsigned offset, unsigned to)
1376 struct afs_vnode *vnode = fc->vnode;
1377 struct afs_call *call;
1378 struct afs_net *net = afs_v2net(vnode);
1379 loff_t size, pos, i_size;
1382 if (test_bit(AFS_SERVER_FL_IS_YFS, &fc->cbi->server->flags))
1383 return yfs_fs_store_data(fc, mapping, first, last, offset, to);
1385 _enter(",%x,{%llx:%llu},,",
1386 key_serial(fc->key), vnode->fid.vid, vnode->fid.vnode);
1388 size = (loff_t)to - (loff_t)offset;
1390 size += (loff_t)(last - first) << PAGE_SHIFT;
1391 pos = (loff_t)first << PAGE_SHIFT;
1394 i_size = i_size_read(&vnode->vfs_inode);
1395 if (pos + size > i_size)
1396 i_size = size + pos;
1398 _debug("size %llx, at %llx, i_size %llx",
1399 (unsigned long long) size, (unsigned long long) pos,
1400 (unsigned long long) i_size);
1402 if (pos >> 32 || i_size >> 32 || size >> 32 || (pos + size) >> 32)
1403 return afs_fs_store_data64(fc, mapping, first, last, offset, to,
1406 call = afs_alloc_flat_call(net, &afs_RXFSStoreData,
1412 call->key = fc->key;
1413 call->mapping = mapping;
1414 call->reply[0] = vnode;
1415 call->first = first;
1417 call->first_offset = offset;
1419 call->send_pages = true;
1420 call->expected_version = vnode->status.data_version + 1;
1422 /* marshall the parameters */
1424 *bp++ = htonl(FSSTOREDATA);
1425 *bp++ = htonl(vnode->fid.vid);
1426 *bp++ = htonl(vnode->fid.vnode);
1427 *bp++ = htonl(vnode->fid.unique);
1429 *bp++ = htonl(AFS_SET_MTIME); /* mask */
1430 *bp++ = htonl(vnode->vfs_inode.i_mtime.tv_sec); /* mtime */
1431 *bp++ = 0; /* owner */
1432 *bp++ = 0; /* group */
1433 *bp++ = 0; /* unix mode */
1434 *bp++ = 0; /* segment size */
1437 *bp++ = htonl(size);
1438 *bp++ = htonl(i_size);
1440 afs_use_fs_server(call, fc->cbi);
1441 trace_afs_make_fs_call(call, &vnode->fid);
1442 afs_make_call(&fc->ac, call, GFP_NOFS);
1443 return afs_wait_for_call_to_complete(call, &fc->ac);
1447 * deliver reply data to an FS.StoreStatus
1449 static int afs_deliver_fs_store_status(struct afs_call *call)
1451 struct afs_vnode *vnode = call->reply[0];
1457 ret = afs_transfer_reply(call);
1461 /* unmarshall the reply once we've received all of it */
1463 ret = afs_decode_status(call, &bp, &vnode->status, vnode,
1464 &call->expected_version, NULL);
1467 /* xdr_decode_AFSVolSync(&bp, call->reply[X]); */
1469 _leave(" = 0 [done]");
1474 * FS.StoreStatus operation type
1476 static const struct afs_call_type afs_RXFSStoreStatus = {
1477 .name = "FS.StoreStatus",
1478 .op = afs_FS_StoreStatus,
1479 .deliver = afs_deliver_fs_store_status,
1480 .destructor = afs_flat_call_destructor,
1483 static const struct afs_call_type afs_RXFSStoreData_as_Status = {
1484 .name = "FS.StoreData",
1485 .op = afs_FS_StoreData,
1486 .deliver = afs_deliver_fs_store_status,
1487 .destructor = afs_flat_call_destructor,
1490 static const struct afs_call_type afs_RXFSStoreData64_as_Status = {
1491 .name = "FS.StoreData64",
1492 .op = afs_FS_StoreData64,
1493 .deliver = afs_deliver_fs_store_status,
1494 .destructor = afs_flat_call_destructor,
1498 * set the attributes on a very large file, using FS.StoreData rather than
1499 * FS.StoreStatus so as to alter the file size also
1501 static int afs_fs_setattr_size64(struct afs_fs_cursor *fc, struct iattr *attr)
1503 struct afs_vnode *vnode = fc->vnode;
1504 struct afs_call *call;
1505 struct afs_net *net = afs_v2net(vnode);
1508 _enter(",%x,{%llx:%llu},,",
1509 key_serial(fc->key), vnode->fid.vid, vnode->fid.vnode);
1511 ASSERT(attr->ia_valid & ATTR_SIZE);
1513 call = afs_alloc_flat_call(net, &afs_RXFSStoreData64_as_Status,
1514 (4 + 6 + 3 * 2) * 4,
1519 call->key = fc->key;
1520 call->reply[0] = vnode;
1521 call->expected_version = vnode->status.data_version + 1;
1523 /* marshall the parameters */
1525 *bp++ = htonl(FSSTOREDATA64);
1526 *bp++ = htonl(vnode->fid.vid);
1527 *bp++ = htonl(vnode->fid.vnode);
1528 *bp++ = htonl(vnode->fid.unique);
1530 xdr_encode_AFS_StoreStatus(&bp, attr);
1532 *bp++ = htonl(attr->ia_size >> 32); /* position of start of write */
1533 *bp++ = htonl((u32) attr->ia_size);
1534 *bp++ = 0; /* size of write */
1536 *bp++ = htonl(attr->ia_size >> 32); /* new file length */
1537 *bp++ = htonl((u32) attr->ia_size);
1539 afs_use_fs_server(call, fc->cbi);
1540 trace_afs_make_fs_call(call, &vnode->fid);
1541 afs_make_call(&fc->ac, call, GFP_NOFS);
1542 return afs_wait_for_call_to_complete(call, &fc->ac);
1546 * set the attributes on a file, using FS.StoreData rather than FS.StoreStatus
1547 * so as to alter the file size also
1549 static int afs_fs_setattr_size(struct afs_fs_cursor *fc, struct iattr *attr)
1551 struct afs_vnode *vnode = fc->vnode;
1552 struct afs_call *call;
1553 struct afs_net *net = afs_v2net(vnode);
1556 _enter(",%x,{%llx:%llu},,",
1557 key_serial(fc->key), vnode->fid.vid, vnode->fid.vnode);
1559 ASSERT(attr->ia_valid & ATTR_SIZE);
1560 if (attr->ia_size >> 32)
1561 return afs_fs_setattr_size64(fc, attr);
1563 call = afs_alloc_flat_call(net, &afs_RXFSStoreData_as_Status,
1569 call->key = fc->key;
1570 call->reply[0] = vnode;
1571 call->expected_version = vnode->status.data_version + 1;
1573 /* marshall the parameters */
1575 *bp++ = htonl(FSSTOREDATA);
1576 *bp++ = htonl(vnode->fid.vid);
1577 *bp++ = htonl(vnode->fid.vnode);
1578 *bp++ = htonl(vnode->fid.unique);
1580 xdr_encode_AFS_StoreStatus(&bp, attr);
1582 *bp++ = htonl(attr->ia_size); /* position of start of write */
1583 *bp++ = 0; /* size of write */
1584 *bp++ = htonl(attr->ia_size); /* new file length */
1586 afs_use_fs_server(call, fc->cbi);
1587 trace_afs_make_fs_call(call, &vnode->fid);
1588 afs_make_call(&fc->ac, call, GFP_NOFS);
1589 return afs_wait_for_call_to_complete(call, &fc->ac);
1593 * set the attributes on a file, using FS.StoreData if there's a change in file
1594 * size, and FS.StoreStatus otherwise
1596 int afs_fs_setattr(struct afs_fs_cursor *fc, struct iattr *attr)
1598 struct afs_vnode *vnode = fc->vnode;
1599 struct afs_call *call;
1600 struct afs_net *net = afs_v2net(vnode);
1603 if (test_bit(AFS_SERVER_FL_IS_YFS, &fc->cbi->server->flags))
1604 return yfs_fs_setattr(fc, attr);
1606 if (attr->ia_valid & ATTR_SIZE)
1607 return afs_fs_setattr_size(fc, attr);
1609 _enter(",%x,{%llx:%llu},,",
1610 key_serial(fc->key), vnode->fid.vid, vnode->fid.vnode);
1612 call = afs_alloc_flat_call(net, &afs_RXFSStoreStatus,
1618 call->key = fc->key;
1619 call->reply[0] = vnode;
1620 call->expected_version = vnode->status.data_version;
1622 /* marshall the parameters */
1624 *bp++ = htonl(FSSTORESTATUS);
1625 *bp++ = htonl(vnode->fid.vid);
1626 *bp++ = htonl(vnode->fid.vnode);
1627 *bp++ = htonl(vnode->fid.unique);
1629 xdr_encode_AFS_StoreStatus(&bp, attr);
1631 afs_use_fs_server(call, fc->cbi);
1632 trace_afs_make_fs_call(call, &vnode->fid);
1633 afs_make_call(&fc->ac, call, GFP_NOFS);
1634 return afs_wait_for_call_to_complete(call, &fc->ac);
1638 * deliver reply data to an FS.GetVolumeStatus
1640 static int afs_deliver_fs_get_volume_status(struct afs_call *call)
1647 _enter("{%u}", call->unmarshall);
1649 switch (call->unmarshall) {
1652 afs_extract_to_buf(call, 12 * 4);
1654 /* Fall through - and extract the returned status record */
1656 _debug("extract status");
1657 ret = afs_extract_data(call, true);
1662 xdr_decode_AFSFetchVolumeStatus(&bp, call->reply[1]);
1664 afs_extract_to_tmp(call);
1666 /* Fall through - and extract the volume name length */
1668 ret = afs_extract_data(call, true);
1672 call->count = ntohl(call->tmp);
1673 _debug("volname length: %u", call->count);
1674 if (call->count >= AFSNAMEMAX)
1675 return afs_protocol_error(call, -EBADMSG,
1676 afs_eproto_volname_len);
1677 size = (call->count + 3) & ~3; /* It's padded */
1678 afs_extract_begin(call, call->reply[2], size);
1681 /* Fall through - and extract the volume name */
1683 _debug("extract volname");
1684 ret = afs_extract_data(call, true);
1690 _debug("volname '%s'", p);
1691 afs_extract_to_tmp(call);
1694 /* Fall through - and extract the offline message length */
1696 ret = afs_extract_data(call, true);
1700 call->count = ntohl(call->tmp);
1701 _debug("offline msg length: %u", call->count);
1702 if (call->count >= AFSNAMEMAX)
1703 return afs_protocol_error(call, -EBADMSG,
1704 afs_eproto_offline_msg_len);
1705 size = (call->count + 3) & ~3; /* It's padded */
1706 afs_extract_begin(call, call->reply[2], size);
1709 /* Fall through - and extract the offline message */
1711 _debug("extract offline");
1712 ret = afs_extract_data(call, true);
1718 _debug("offline '%s'", p);
1720 afs_extract_to_tmp(call);
1723 /* Fall through - and extract the message of the day length */
1725 ret = afs_extract_data(call, true);
1729 call->count = ntohl(call->tmp);
1730 _debug("motd length: %u", call->count);
1731 if (call->count >= AFSNAMEMAX)
1732 return afs_protocol_error(call, -EBADMSG,
1733 afs_eproto_motd_len);
1734 size = (call->count + 3) & ~3; /* It's padded */
1735 afs_extract_begin(call, call->reply[2], size);
1738 /* Fall through - and extract the message of the day */
1740 _debug("extract motd");
1741 ret = afs_extract_data(call, false);
1747 _debug("motd '%s'", p);
1755 _leave(" = 0 [done]");
1760 * destroy an FS.GetVolumeStatus call
1762 static void afs_get_volume_status_call_destructor(struct afs_call *call)
1764 kfree(call->reply[2]);
1765 call->reply[2] = NULL;
1766 afs_flat_call_destructor(call);
1770 * FS.GetVolumeStatus operation type
1772 static const struct afs_call_type afs_RXFSGetVolumeStatus = {
1773 .name = "FS.GetVolumeStatus",
1774 .op = afs_FS_GetVolumeStatus,
1775 .deliver = afs_deliver_fs_get_volume_status,
1776 .destructor = afs_get_volume_status_call_destructor,
1780 * fetch the status of a volume
1782 int afs_fs_get_volume_status(struct afs_fs_cursor *fc,
1783 struct afs_volume_status *vs)
1785 struct afs_vnode *vnode = fc->vnode;
1786 struct afs_call *call;
1787 struct afs_net *net = afs_v2net(vnode);
1791 if (test_bit(AFS_SERVER_FL_IS_YFS, &fc->cbi->server->flags))
1792 return yfs_fs_get_volume_status(fc, vs);
1796 tmpbuf = kmalloc(AFSOPAQUEMAX, GFP_KERNEL);
1800 call = afs_alloc_flat_call(net, &afs_RXFSGetVolumeStatus, 2 * 4, 12 * 4);
1806 call->key = fc->key;
1807 call->reply[0] = vnode;
1808 call->reply[1] = vs;
1809 call->reply[2] = tmpbuf;
1811 /* marshall the parameters */
1813 bp[0] = htonl(FSGETVOLUMESTATUS);
1814 bp[1] = htonl(vnode->fid.vid);
1816 afs_use_fs_server(call, fc->cbi);
1817 trace_afs_make_fs_call(call, &vnode->fid);
1818 afs_make_call(&fc->ac, call, GFP_NOFS);
1819 return afs_wait_for_call_to_complete(call, &fc->ac);
1823 * deliver reply data to an FS.SetLock, FS.ExtendLock or FS.ReleaseLock
1825 static int afs_deliver_fs_xxxx_lock(struct afs_call *call)
1830 _enter("{%u}", call->unmarshall);
1832 ret = afs_transfer_reply(call);
1836 /* unmarshall the reply once we've received all of it */
1838 /* xdr_decode_AFSVolSync(&bp, call->reply[X]); */
1840 _leave(" = 0 [done]");
1845 * FS.SetLock operation type
1847 static const struct afs_call_type afs_RXFSSetLock = {
1848 .name = "FS.SetLock",
1849 .op = afs_FS_SetLock,
1850 .deliver = afs_deliver_fs_xxxx_lock,
1851 .done = afs_lock_op_done,
1852 .destructor = afs_flat_call_destructor,
1856 * FS.ExtendLock operation type
1858 static const struct afs_call_type afs_RXFSExtendLock = {
1859 .name = "FS.ExtendLock",
1860 .op = afs_FS_ExtendLock,
1861 .deliver = afs_deliver_fs_xxxx_lock,
1862 .done = afs_lock_op_done,
1863 .destructor = afs_flat_call_destructor,
1867 * FS.ReleaseLock operation type
1869 static const struct afs_call_type afs_RXFSReleaseLock = {
1870 .name = "FS.ReleaseLock",
1871 .op = afs_FS_ReleaseLock,
1872 .deliver = afs_deliver_fs_xxxx_lock,
1873 .destructor = afs_flat_call_destructor,
1877 * Set a lock on a file
1879 int afs_fs_set_lock(struct afs_fs_cursor *fc, afs_lock_type_t type)
1881 struct afs_vnode *vnode = fc->vnode;
1882 struct afs_call *call;
1883 struct afs_net *net = afs_v2net(vnode);
1886 if (test_bit(AFS_SERVER_FL_IS_YFS, &fc->cbi->server->flags))
1887 return yfs_fs_set_lock(fc, type);
1891 call = afs_alloc_flat_call(net, &afs_RXFSSetLock, 5 * 4, 6 * 4);
1895 call->key = fc->key;
1896 call->reply[0] = vnode;
1897 call->want_reply_time = true;
1899 /* marshall the parameters */
1901 *bp++ = htonl(FSSETLOCK);
1902 *bp++ = htonl(vnode->fid.vid);
1903 *bp++ = htonl(vnode->fid.vnode);
1904 *bp++ = htonl(vnode->fid.unique);
1905 *bp++ = htonl(type);
1907 afs_use_fs_server(call, fc->cbi);
1908 trace_afs_make_fs_calli(call, &vnode->fid, type);
1909 afs_make_call(&fc->ac, call, GFP_NOFS);
1910 return afs_wait_for_call_to_complete(call, &fc->ac);
1914 * extend a lock on a file
1916 int afs_fs_extend_lock(struct afs_fs_cursor *fc)
1918 struct afs_vnode *vnode = fc->vnode;
1919 struct afs_call *call;
1920 struct afs_net *net = afs_v2net(vnode);
1923 if (test_bit(AFS_SERVER_FL_IS_YFS, &fc->cbi->server->flags))
1924 return yfs_fs_extend_lock(fc);
1928 call = afs_alloc_flat_call(net, &afs_RXFSExtendLock, 4 * 4, 6 * 4);
1932 call->key = fc->key;
1933 call->reply[0] = vnode;
1934 call->want_reply_time = true;
1936 /* marshall the parameters */
1938 *bp++ = htonl(FSEXTENDLOCK);
1939 *bp++ = htonl(vnode->fid.vid);
1940 *bp++ = htonl(vnode->fid.vnode);
1941 *bp++ = htonl(vnode->fid.unique);
1943 afs_use_fs_server(call, fc->cbi);
1944 trace_afs_make_fs_call(call, &vnode->fid);
1945 afs_make_call(&fc->ac, call, GFP_NOFS);
1946 return afs_wait_for_call_to_complete(call, &fc->ac);
1950 * release a lock on a file
1952 int afs_fs_release_lock(struct afs_fs_cursor *fc)
1954 struct afs_vnode *vnode = fc->vnode;
1955 struct afs_call *call;
1956 struct afs_net *net = afs_v2net(vnode);
1959 if (test_bit(AFS_SERVER_FL_IS_YFS, &fc->cbi->server->flags))
1960 return yfs_fs_release_lock(fc);
1964 call = afs_alloc_flat_call(net, &afs_RXFSReleaseLock, 4 * 4, 6 * 4);
1968 call->key = fc->key;
1969 call->reply[0] = vnode;
1971 /* marshall the parameters */
1973 *bp++ = htonl(FSRELEASELOCK);
1974 *bp++ = htonl(vnode->fid.vid);
1975 *bp++ = htonl(vnode->fid.vnode);
1976 *bp++ = htonl(vnode->fid.unique);
1978 afs_use_fs_server(call, fc->cbi);
1979 trace_afs_make_fs_call(call, &vnode->fid);
1980 afs_make_call(&fc->ac, call, GFP_NOFS);
1981 return afs_wait_for_call_to_complete(call, &fc->ac);
1985 * Deliver reply data to an FS.GiveUpAllCallBacks operation.
1987 static int afs_deliver_fs_give_up_all_callbacks(struct afs_call *call)
1989 return afs_transfer_reply(call);
1993 * FS.GiveUpAllCallBacks operation type
1995 static const struct afs_call_type afs_RXFSGiveUpAllCallBacks = {
1996 .name = "FS.GiveUpAllCallBacks",
1997 .op = afs_FS_GiveUpAllCallBacks,
1998 .deliver = afs_deliver_fs_give_up_all_callbacks,
1999 .destructor = afs_flat_call_destructor,
2003 * Flush all the callbacks we have on a server.
2005 int afs_fs_give_up_all_callbacks(struct afs_net *net,
2006 struct afs_server *server,
2007 struct afs_addr_cursor *ac,
2010 struct afs_call *call;
2015 call = afs_alloc_flat_call(net, &afs_RXFSGiveUpAllCallBacks, 1 * 4, 0);
2021 /* marshall the parameters */
2023 *bp++ = htonl(FSGIVEUPALLCALLBACKS);
2025 /* Can't take a ref on server */
2026 afs_make_call(ac, call, GFP_NOFS);
2027 return afs_wait_for_call_to_complete(call, ac);
2031 * Deliver reply data to an FS.GetCapabilities operation.
2033 static int afs_deliver_fs_get_capabilities(struct afs_call *call)
2038 _enter("{%u,%zu}", call->unmarshall, iov_iter_count(&call->iter));
2040 switch (call->unmarshall) {
2042 afs_extract_to_tmp(call);
2045 /* Fall through - and extract the capabilities word count */
2047 ret = afs_extract_data(call, true);
2051 count = ntohl(call->tmp);
2053 call->count = count;
2054 call->count2 = count;
2055 iov_iter_discard(&call->iter, READ, count * sizeof(__be32));
2058 /* Fall through - and extract capabilities words */
2060 ret = afs_extract_data(call, false);
2064 /* TODO: Examine capabilities */
2070 _leave(" = 0 [done]");
2074 static void afs_destroy_fs_get_capabilities(struct afs_call *call)
2076 struct afs_server *server = call->reply[0];
2078 afs_put_server(call->net, server);
2079 afs_flat_call_destructor(call);
2083 * FS.GetCapabilities operation type
2085 static const struct afs_call_type afs_RXFSGetCapabilities = {
2086 .name = "FS.GetCapabilities",
2087 .op = afs_FS_GetCapabilities,
2088 .deliver = afs_deliver_fs_get_capabilities,
2089 .done = afs_fileserver_probe_result,
2090 .destructor = afs_destroy_fs_get_capabilities,
2094 * Probe a fileserver for the capabilities that it supports. This can
2095 * return up to 196 words.
2097 struct afs_call *afs_fs_get_capabilities(struct afs_net *net,
2098 struct afs_server *server,
2099 struct afs_addr_cursor *ac,
2101 unsigned int server_index)
2103 struct afs_call *call;
2108 call = afs_alloc_flat_call(net, &afs_RXFSGetCapabilities, 1 * 4, 16 * 4);
2110 return ERR_PTR(-ENOMEM);
2113 call->reply[0] = afs_get_server(server);
2114 call->reply[1] = (void *)(long)server_index;
2115 call->upgrade = true;
2116 call->want_reply_time = true;
2119 /* marshall the parameters */
2121 *bp++ = htonl(FSGETCAPABILITIES);
2123 /* Can't take a ref on server */
2124 trace_afs_make_fs_call(call, NULL);
2125 afs_make_call(ac, call, GFP_NOFS);
2130 * Deliver reply data to an FS.FetchStatus with no vnode.
2132 static int afs_deliver_fs_fetch_status(struct afs_call *call)
2134 struct afs_file_status *status = call->reply[1];
2135 struct afs_callback *callback = call->reply[2];
2136 struct afs_volsync *volsync = call->reply[3];
2137 struct afs_fid *fid = call->reply[0];
2141 ret = afs_transfer_reply(call);
2145 _enter("{%llx:%llu}", fid->vid, fid->vnode);
2147 /* unmarshall the reply once we've received all of it */
2149 ret = afs_decode_status(call, &bp, status, NULL,
2150 &call->expected_version, NULL);
2153 xdr_decode_AFSCallBack_raw(call, &bp, callback);
2154 xdr_decode_AFSVolSync(&bp, volsync);
2156 _leave(" = 0 [done]");
2161 * FS.FetchStatus operation type
2163 static const struct afs_call_type afs_RXFSFetchStatus = {
2164 .name = "FS.FetchStatus",
2165 .op = afs_FS_FetchStatus,
2166 .deliver = afs_deliver_fs_fetch_status,
2167 .destructor = afs_flat_call_destructor,
2171 * Fetch the status information for a fid without needing a vnode handle.
2173 int afs_fs_fetch_status(struct afs_fs_cursor *fc,
2174 struct afs_net *net,
2175 struct afs_fid *fid,
2176 struct afs_file_status *status,
2177 struct afs_callback *callback,
2178 struct afs_volsync *volsync)
2180 struct afs_call *call;
2183 if (test_bit(AFS_SERVER_FL_IS_YFS, &fc->cbi->server->flags))
2184 return yfs_fs_fetch_status(fc, net, fid, status, callback, volsync);
2186 _enter(",%x,{%llx:%llu},,",
2187 key_serial(fc->key), fid->vid, fid->vnode);
2189 call = afs_alloc_flat_call(net, &afs_RXFSFetchStatus, 16, (21 + 3 + 6) * 4);
2191 fc->ac.error = -ENOMEM;
2195 call->key = fc->key;
2196 call->reply[0] = fid;
2197 call->reply[1] = status;
2198 call->reply[2] = callback;
2199 call->reply[3] = volsync;
2200 call->expected_version = 1; /* vnode->status.data_version */
2201 call->want_reply_time = true;
2203 /* marshall the parameters */
2205 bp[0] = htonl(FSFETCHSTATUS);
2206 bp[1] = htonl(fid->vid);
2207 bp[2] = htonl(fid->vnode);
2208 bp[3] = htonl(fid->unique);
2210 call->cb_break = fc->cb_break;
2211 afs_use_fs_server(call, fc->cbi);
2212 trace_afs_make_fs_call(call, fid);
2213 afs_make_call(&fc->ac, call, GFP_NOFS);
2214 return afs_wait_for_call_to_complete(call, &fc->ac);
2218 * Deliver reply data to an FS.InlineBulkStatus call
2220 static int afs_deliver_fs_inline_bulk_status(struct afs_call *call)
2222 struct afs_file_status *statuses;
2223 struct afs_callback *callbacks;
2224 struct afs_vnode *vnode = call->reply[0];
2229 _enter("{%u}", call->unmarshall);
2231 switch (call->unmarshall) {
2233 afs_extract_to_tmp(call);
2236 /* Extract the file status count and array in two steps */
2239 _debug("extract status count");
2240 ret = afs_extract_data(call, true);
2244 tmp = ntohl(call->tmp);
2245 _debug("status count: %u/%u", tmp, call->count2);
2246 if (tmp != call->count2)
2247 return afs_protocol_error(call, -EBADMSG,
2248 afs_eproto_ibulkst_count);
2253 afs_extract_to_buf(call, 21 * sizeof(__be32));
2257 _debug("extract status array %u", call->count);
2258 ret = afs_extract_data(call, true);
2263 statuses = call->reply[1];
2264 ret = afs_decode_status(call, &bp, &statuses[call->count],
2265 call->count == 0 ? vnode : NULL,
2271 if (call->count < call->count2)
2276 afs_extract_to_tmp(call);
2278 /* Extract the callback count and array in two steps */
2281 _debug("extract CB count");
2282 ret = afs_extract_data(call, true);
2286 tmp = ntohl(call->tmp);
2287 _debug("CB count: %u", tmp);
2288 if (tmp != call->count2)
2289 return afs_protocol_error(call, -EBADMSG,
2290 afs_eproto_ibulkst_cb_count);
2294 afs_extract_to_buf(call, 3 * sizeof(__be32));
2298 _debug("extract CB array");
2299 ret = afs_extract_data(call, true);
2303 _debug("unmarshall CB array");
2305 callbacks = call->reply[2];
2306 callbacks[call->count].version = ntohl(bp[0]);
2307 callbacks[call->count].expires_at = xdr_decode_expiry(call, ntohl(bp[1]));
2308 callbacks[call->count].type = ntohl(bp[2]);
2309 statuses = call->reply[1];
2310 if (call->count == 0 && vnode && statuses[0].abort_code == 0)
2311 xdr_decode_AFSCallBack(call, vnode, &bp);
2313 if (call->count < call->count2)
2316 afs_extract_to_buf(call, 6 * sizeof(__be32));
2321 ret = afs_extract_data(call, false);
2326 xdr_decode_AFSVolSync(&bp, call->reply[3]);
2334 _leave(" = 0 [done]");
2339 * FS.InlineBulkStatus operation type
2341 static const struct afs_call_type afs_RXFSInlineBulkStatus = {
2342 .name = "FS.InlineBulkStatus",
2343 .op = afs_FS_InlineBulkStatus,
2344 .deliver = afs_deliver_fs_inline_bulk_status,
2345 .destructor = afs_flat_call_destructor,
2349 * Fetch the status information for up to 50 files
2351 int afs_fs_inline_bulk_status(struct afs_fs_cursor *fc,
2352 struct afs_net *net,
2353 struct afs_fid *fids,
2354 struct afs_file_status *statuses,
2355 struct afs_callback *callbacks,
2356 unsigned int nr_fids,
2357 struct afs_volsync *volsync)
2359 struct afs_call *call;
2363 if (test_bit(AFS_SERVER_FL_IS_YFS, &fc->cbi->server->flags))
2364 return yfs_fs_inline_bulk_status(fc, net, fids, statuses, callbacks,
2367 _enter(",%x,{%llx:%llu},%u",
2368 key_serial(fc->key), fids[0].vid, fids[1].vnode, nr_fids);
2370 call = afs_alloc_flat_call(net, &afs_RXFSInlineBulkStatus,
2371 (2 + nr_fids * 3) * 4,
2374 fc->ac.error = -ENOMEM;
2378 call->key = fc->key;
2379 call->reply[0] = NULL; /* vnode for fid[0] */
2380 call->reply[1] = statuses;
2381 call->reply[2] = callbacks;
2382 call->reply[3] = volsync;
2383 call->count2 = nr_fids;
2384 call->want_reply_time = true;
2386 /* marshall the parameters */
2388 *bp++ = htonl(FSINLINEBULKSTATUS);
2389 *bp++ = htonl(nr_fids);
2390 for (i = 0; i < nr_fids; i++) {
2391 *bp++ = htonl(fids[i].vid);
2392 *bp++ = htonl(fids[i].vnode);
2393 *bp++ = htonl(fids[i].unique);
2396 call->cb_break = fc->cb_break;
2397 afs_use_fs_server(call, fc->cbi);
2398 trace_afs_make_fs_call(call, &fids[0]);
2399 afs_make_call(&fc->ac, call, GFP_NOFS);
2400 return afs_wait_for_call_to_complete(call, &fc->ac);
2404 * deliver reply data to an FS.FetchACL
2406 static int afs_deliver_fs_fetch_acl(struct afs_call *call)
2408 struct afs_vnode *vnode = call->reply[1];
2409 struct afs_acl *acl;
2414 _enter("{%u}", call->unmarshall);
2416 switch (call->unmarshall) {
2418 afs_extract_to_tmp(call);
2421 /* extract the returned data length */
2423 ret = afs_extract_data(call, true);
2427 size = call->count2 = ntohl(call->tmp);
2428 size = round_up(size, 4);
2430 acl = kmalloc(struct_size(acl, data, size), GFP_KERNEL);
2433 call->reply[0] = acl;
2434 acl->size = call->count2;
2435 afs_extract_begin(call, acl->data, size);
2438 /* extract the returned data */
2440 ret = afs_extract_data(call, true);
2444 afs_extract_to_buf(call, (21 + 6) * 4);
2447 /* extract the metadata */
2449 ret = afs_extract_data(call, false);
2454 ret = afs_decode_status(call, &bp, &vnode->status, vnode,
2455 &vnode->status.data_version, NULL);
2458 xdr_decode_AFSVolSync(&bp, call->reply[2]);
2466 _leave(" = 0 [done]");
2470 static void afs_destroy_fs_fetch_acl(struct afs_call *call)
2472 kfree(call->reply[0]);
2473 afs_flat_call_destructor(call);
2477 * FS.FetchACL operation type
2479 static const struct afs_call_type afs_RXFSFetchACL = {
2480 .name = "FS.FetchACL",
2481 .op = afs_FS_FetchACL,
2482 .deliver = afs_deliver_fs_fetch_acl,
2483 .destructor = afs_destroy_fs_fetch_acl,
2487 * Fetch the ACL for a file.
2489 struct afs_acl *afs_fs_fetch_acl(struct afs_fs_cursor *fc)
2491 struct afs_vnode *vnode = fc->vnode;
2492 struct afs_call *call;
2493 struct afs_net *net = afs_v2net(vnode);
2496 _enter(",%x,{%llx:%llu},,",
2497 key_serial(fc->key), vnode->fid.vid, vnode->fid.vnode);
2499 call = afs_alloc_flat_call(net, &afs_RXFSFetchACL, 16, (21 + 6) * 4);
2501 fc->ac.error = -ENOMEM;
2502 return ERR_PTR(-ENOMEM);
2505 call->key = fc->key;
2506 call->reply[0] = NULL;
2507 call->reply[1] = vnode;
2508 call->reply[2] = NULL; /* volsync */
2509 call->ret_reply0 = true;
2511 /* marshall the parameters */
2513 bp[0] = htonl(FSFETCHACL);
2514 bp[1] = htonl(vnode->fid.vid);
2515 bp[2] = htonl(vnode->fid.vnode);
2516 bp[3] = htonl(vnode->fid.unique);
2518 call->cb_break = fc->cb_break;
2519 afs_use_fs_server(call, fc->cbi);
2520 trace_afs_make_fs_call(call, &vnode->fid);
2521 afs_make_call(&fc->ac, call, GFP_KERNEL);
2522 return (struct afs_acl *)afs_wait_for_call_to_complete(call, &fc->ac);
2526 * FS.StoreACL operation type
2528 static const struct afs_call_type afs_RXFSStoreACL = {
2529 .name = "FS.StoreACL",
2530 .op = afs_FS_StoreACL,
2531 .deliver = afs_deliver_fs_status_and_vol,
2532 .destructor = afs_flat_call_destructor,
2536 * Fetch the ACL for a file.
2538 int afs_fs_store_acl(struct afs_fs_cursor *fc, const struct afs_acl *acl)
2540 struct afs_vnode *vnode = fc->vnode;
2541 struct afs_call *call;
2542 struct afs_net *net = afs_v2net(vnode);
2546 _enter(",%x,{%llx:%llu},,",
2547 key_serial(fc->key), vnode->fid.vid, vnode->fid.vnode);
2549 size = round_up(acl->size, 4);
2550 call = afs_alloc_flat_call(net, &afs_RXFSStoreACL,
2551 5 * 4 + size, (21 + 6) * 4);
2553 fc->ac.error = -ENOMEM;
2557 call->key = fc->key;
2558 call->reply[0] = vnode;
2559 call->reply[2] = NULL; /* volsync */
2561 /* marshall the parameters */
2563 bp[0] = htonl(FSSTOREACL);
2564 bp[1] = htonl(vnode->fid.vid);
2565 bp[2] = htonl(vnode->fid.vnode);
2566 bp[3] = htonl(vnode->fid.unique);
2567 bp[4] = htonl(acl->size);
2568 memcpy(&bp[5], acl->data, acl->size);
2569 if (acl->size != size)
2570 memset((void *)&bp[5] + acl->size, 0, size - acl->size);
2572 trace_afs_make_fs_call(call, &vnode->fid);
2573 afs_make_call(&fc->ac, call, GFP_KERNEL);
2574 return afs_wait_for_call_to_complete(call, &fc->ac);