1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /* AFS File Server client stubs
4 * Copyright (C) 2002, 2007 Red Hat, Inc. All Rights Reserved.
5 * Written by David Howells (dhowells@redhat.com)
8 #include <linux/init.h>
9 #include <linux/slab.h>
10 #include <linux/sched.h>
11 #include <linux/circ_buf.h>
12 #include <linux/iversion.h>
16 #include "protocol_yfs.h"
18 static inline void afs_use_fs_server(struct afs_call
*call
, struct afs_cb_interest
*cbi
)
20 call
->cbi
= afs_get_cb_interest(cbi
);
24 * decode an AFSFid block
26 static void xdr_decode_AFSFid(const __be32
**_bp
, struct afs_fid
*fid
)
28 const __be32
*bp
= *_bp
;
30 fid
->vid
= ntohl(*bp
++);
31 fid
->vnode
= ntohl(*bp
++);
32 fid
->unique
= ntohl(*bp
++);
37 * Dump a bad file status record.
39 static void xdr_dump_bad(const __be32
*bp
)
44 pr_notice("AFS XDR: Bad status record\n");
45 for (i
= 0; i
< 5 * 4 * 4; i
+= 16) {
48 pr_notice("%03x: %08x %08x %08x %08x\n",
49 i
, ntohl(x
[0]), ntohl(x
[1]), ntohl(x
[2]), ntohl(x
[3]));
53 pr_notice("0x50: %08x\n", ntohl(x
[0]));
57 * decode an AFSFetchStatus block
59 static int xdr_decode_AFSFetchStatus(const __be32
**_bp
,
60 struct afs_call
*call
,
61 struct afs_status_cb
*scb
)
63 const struct afs_xdr_AFSFetchStatus
*xdr
= (const void *)*_bp
;
64 struct afs_file_status
*status
= &scb
->status
;
65 bool inline_error
= (call
->operation_ID
== afs_FS_InlineBulkStatus
);
66 u64 data_version
, size
;
70 abort_code
= ntohl(xdr
->abort_code
);
72 if (xdr
->if_version
!= htonl(AFS_FSTATUS_VERSION
)) {
73 if (xdr
->if_version
== htonl(0) &&
76 /* The OpenAFS fileserver has a bug in FS.InlineBulkStatus
77 * whereby it doesn't set the interface version in the error
80 status
->abort_code
= abort_code
;
81 scb
->have_error
= true;
85 pr_warn("Unknown AFSFetchStatus version %u\n", ntohl(xdr
->if_version
));
89 if (abort_code
!= 0 && inline_error
) {
90 status
->abort_code
= abort_code
;
91 scb
->have_error
= true;
95 type
= ntohl(xdr
->type
);
99 case AFS_FTYPE_SYMLINK
:
106 status
->nlink
= ntohl(xdr
->nlink
);
107 status
->author
= ntohl(xdr
->author
);
108 status
->owner
= ntohl(xdr
->owner
);
109 status
->caller_access
= ntohl(xdr
->caller_access
); /* Ticket dependent */
110 status
->anon_access
= ntohl(xdr
->anon_access
);
111 status
->mode
= ntohl(xdr
->mode
) & S_IALLUGO
;
112 status
->group
= ntohl(xdr
->group
);
113 status
->lock_count
= ntohl(xdr
->lock_count
);
115 status
->mtime_client
.tv_sec
= ntohl(xdr
->mtime_client
);
116 status
->mtime_client
.tv_nsec
= 0;
117 status
->mtime_server
.tv_sec
= ntohl(xdr
->mtime_server
);
118 status
->mtime_server
.tv_nsec
= 0;
120 size
= (u64
)ntohl(xdr
->size_lo
);
121 size
|= (u64
)ntohl(xdr
->size_hi
) << 32;
124 data_version
= (u64
)ntohl(xdr
->data_version_lo
);
125 data_version
|= (u64
)ntohl(xdr
->data_version_hi
) << 32;
126 status
->data_version
= data_version
;
127 scb
->have_status
= true;
131 *_bp
= (const void *)*_bp
+ sizeof(*xdr
);
136 ret
= afs_protocol_error(call
, -EBADMSG
, afs_eproto_bad_status
);
140 static time64_t
xdr_decode_expiry(struct afs_call
*call
, u32 expiry
)
142 return ktime_divns(call
->reply_time
, NSEC_PER_SEC
) + expiry
;
145 static void xdr_decode_AFSCallBack(const __be32
**_bp
,
146 struct afs_call
*call
,
147 struct afs_status_cb
*scb
)
149 struct afs_callback
*cb
= &scb
->callback
;
150 const __be32
*bp
= *_bp
;
153 cb
->expires_at
= xdr_decode_expiry(call
, ntohl(*bp
++));
160 * decode an AFSVolSync block
162 static void xdr_decode_AFSVolSync(const __be32
**_bp
,
163 struct afs_volsync
*volsync
)
165 const __be32
*bp
= *_bp
;
168 creation
= ntohl(*bp
++);
177 volsync
->creation
= creation
;
181 * encode the requested attributes into an AFSStoreStatus block
183 static void xdr_encode_AFS_StoreStatus(__be32
**_bp
, struct iattr
*attr
)
186 u32 mask
= 0, mtime
= 0, owner
= 0, group
= 0, mode
= 0;
189 if (attr
->ia_valid
& ATTR_MTIME
) {
190 mask
|= AFS_SET_MTIME
;
191 mtime
= attr
->ia_mtime
.tv_sec
;
194 if (attr
->ia_valid
& ATTR_UID
) {
195 mask
|= AFS_SET_OWNER
;
196 owner
= from_kuid(&init_user_ns
, attr
->ia_uid
);
199 if (attr
->ia_valid
& ATTR_GID
) {
200 mask
|= AFS_SET_GROUP
;
201 group
= from_kgid(&init_user_ns
, attr
->ia_gid
);
204 if (attr
->ia_valid
& ATTR_MODE
) {
205 mask
|= AFS_SET_MODE
;
206 mode
= attr
->ia_mode
& S_IALLUGO
;
210 *bp
++ = htonl(mtime
);
211 *bp
++ = htonl(owner
);
212 *bp
++ = htonl(group
);
214 *bp
++ = 0; /* segment size */
219 * decode an AFSFetchVolumeStatus block
221 static void xdr_decode_AFSFetchVolumeStatus(const __be32
**_bp
,
222 struct afs_volume_status
*vs
)
224 const __be32
*bp
= *_bp
;
226 vs
->vid
= ntohl(*bp
++);
227 vs
->parent_id
= ntohl(*bp
++);
228 vs
->online
= ntohl(*bp
++);
229 vs
->in_service
= ntohl(*bp
++);
230 vs
->blessed
= ntohl(*bp
++);
231 vs
->needs_salvage
= ntohl(*bp
++);
232 vs
->type
= ntohl(*bp
++);
233 vs
->min_quota
= ntohl(*bp
++);
234 vs
->max_quota
= ntohl(*bp
++);
235 vs
->blocks_in_use
= ntohl(*bp
++);
236 vs
->part_blocks_avail
= ntohl(*bp
++);
237 vs
->part_max_blocks
= ntohl(*bp
++);
238 vs
->vol_copy_date
= 0;
239 vs
->vol_backup_date
= 0;
244 * deliver reply data to an FS.FetchStatus
246 static int afs_deliver_fs_fetch_status_vnode(struct afs_call
*call
)
251 ret
= afs_transfer_reply(call
);
255 /* unmarshall the reply once we've received all of it */
257 ret
= xdr_decode_AFSFetchStatus(&bp
, call
, call
->out_scb
);
260 xdr_decode_AFSCallBack(&bp
, call
, call
->out_scb
);
261 xdr_decode_AFSVolSync(&bp
, call
->out_volsync
);
263 _leave(" = 0 [done]");
268 * FS.FetchStatus operation type
270 static const struct afs_call_type afs_RXFSFetchStatus_vnode
= {
271 .name
= "FS.FetchStatus(vnode)",
272 .op
= afs_FS_FetchStatus
,
273 .deliver
= afs_deliver_fs_fetch_status_vnode
,
274 .destructor
= afs_flat_call_destructor
,
278 * fetch the status information for a file
280 int afs_fs_fetch_file_status(struct afs_fs_cursor
*fc
, struct afs_status_cb
*scb
,
281 struct afs_volsync
*volsync
)
283 struct afs_vnode
*vnode
= fc
->vnode
;
284 struct afs_call
*call
;
285 struct afs_net
*net
= afs_v2net(vnode
);
288 if (test_bit(AFS_SERVER_FL_IS_YFS
, &fc
->cbi
->server
->flags
))
289 return yfs_fs_fetch_file_status(fc
, scb
, volsync
);
291 _enter(",%x,{%llx:%llu},,",
292 key_serial(fc
->key
), vnode
->fid
.vid
, vnode
->fid
.vnode
);
294 call
= afs_alloc_flat_call(net
, &afs_RXFSFetchStatus_vnode
,
295 16, (21 + 3 + 6) * 4);
297 fc
->ac
.error
= -ENOMEM
;
303 call
->out_volsync
= volsync
;
305 /* marshall the parameters */
307 bp
[0] = htonl(FSFETCHSTATUS
);
308 bp
[1] = htonl(vnode
->fid
.vid
);
309 bp
[2] = htonl(vnode
->fid
.vnode
);
310 bp
[3] = htonl(vnode
->fid
.unique
);
312 afs_use_fs_server(call
, fc
->cbi
);
313 trace_afs_make_fs_call(call
, &vnode
->fid
);
315 afs_set_fc_call(call
, fc
);
316 afs_make_call(&fc
->ac
, call
, GFP_NOFS
);
317 return afs_wait_for_call_to_complete(call
, &fc
->ac
);
321 * deliver reply data to an FS.FetchData
323 static int afs_deliver_fs_fetch_data(struct afs_call
*call
)
325 struct afs_read
*req
= call
->read_request
;
330 _enter("{%u,%zu/%llu}",
331 call
->unmarshall
, iov_iter_count(call
->iter
), req
->actual_len
);
333 switch (call
->unmarshall
) {
337 req
->offset
= req
->pos
& (PAGE_SIZE
- 1);
339 if (call
->operation_ID
== FSFETCHDATA64
) {
340 afs_extract_to_tmp64(call
);
342 call
->tmp_u
= htonl(0);
343 afs_extract_to_tmp(call
);
347 /* extract the returned data length */
349 _debug("extract data length");
350 ret
= afs_extract_data(call
, true);
354 req
->actual_len
= be64_to_cpu(call
->tmp64
);
355 _debug("DATA length: %llu", req
->actual_len
);
356 req
->remain
= min(req
->len
, req
->actual_len
);
357 if (req
->remain
== 0)
363 ASSERTCMP(req
->index
, <, req
->nr_pages
);
364 if (req
->remain
> PAGE_SIZE
- req
->offset
)
365 size
= PAGE_SIZE
- req
->offset
;
368 call
->bvec
[0].bv_len
= size
;
369 call
->bvec
[0].bv_offset
= req
->offset
;
370 call
->bvec
[0].bv_page
= req
->pages
[req
->index
];
371 iov_iter_bvec(&call
->def_iter
, READ
, call
->bvec
, 1, size
);
372 ASSERTCMP(size
, <=, PAGE_SIZE
);
375 /* extract the returned data */
377 _debug("extract data %zu/%llu",
378 iov_iter_count(call
->iter
), req
->remain
);
380 ret
= afs_extract_data(call
, true);
383 req
->remain
-= call
->bvec
[0].bv_len
;
384 req
->offset
+= call
->bvec
[0].bv_len
;
385 ASSERTCMP(req
->offset
, <=, PAGE_SIZE
);
386 if (req
->offset
== PAGE_SIZE
) {
395 ASSERTCMP(req
->remain
, ==, 0);
396 if (req
->actual_len
<= req
->len
)
399 /* Discard any excess data the server gave us */
400 afs_extract_discard(call
, req
->actual_len
- req
->len
);
401 call
->unmarshall
= 3;
405 _debug("extract discard %zu/%llu",
406 iov_iter_count(call
->iter
), req
->actual_len
- req
->len
);
408 ret
= afs_extract_data(call
, true);
413 call
->unmarshall
= 4;
414 afs_extract_to_buf(call
, (21 + 3 + 6) * 4);
417 /* extract the metadata */
419 ret
= afs_extract_data(call
, false);
424 ret
= xdr_decode_AFSFetchStatus(&bp
, call
, call
->out_scb
);
427 xdr_decode_AFSCallBack(&bp
, call
, call
->out_scb
);
428 xdr_decode_AFSVolSync(&bp
, call
->out_volsync
);
430 req
->data_version
= call
->out_scb
->status
.data_version
;
431 req
->file_size
= call
->out_scb
->status
.size
;
439 for (; req
->index
< req
->nr_pages
; req
->index
++) {
440 if (req
->offset
< PAGE_SIZE
)
441 zero_user_segment(req
->pages
[req
->index
],
442 req
->offset
, PAGE_SIZE
);
448 _leave(" = 0 [done]");
452 static void afs_fetch_data_destructor(struct afs_call
*call
)
454 struct afs_read
*req
= call
->read_request
;
457 afs_flat_call_destructor(call
);
461 * FS.FetchData operation type
463 static const struct afs_call_type afs_RXFSFetchData
= {
464 .name
= "FS.FetchData",
465 .op
= afs_FS_FetchData
,
466 .deliver
= afs_deliver_fs_fetch_data
,
467 .destructor
= afs_fetch_data_destructor
,
470 static const struct afs_call_type afs_RXFSFetchData64
= {
471 .name
= "FS.FetchData64",
472 .op
= afs_FS_FetchData64
,
473 .deliver
= afs_deliver_fs_fetch_data
,
474 .destructor
= afs_fetch_data_destructor
,
478 * fetch data from a very large file
480 static int afs_fs_fetch_data64(struct afs_fs_cursor
*fc
,
481 struct afs_status_cb
*scb
,
482 struct afs_read
*req
)
484 struct afs_vnode
*vnode
= fc
->vnode
;
485 struct afs_call
*call
;
486 struct afs_net
*net
= afs_v2net(vnode
);
491 call
= afs_alloc_flat_call(net
, &afs_RXFSFetchData64
, 32, (21 + 3 + 6) * 4);
497 call
->out_volsync
= NULL
;
498 call
->read_request
= afs_get_read(req
);
500 /* marshall the parameters */
502 bp
[0] = htonl(FSFETCHDATA64
);
503 bp
[1] = htonl(vnode
->fid
.vid
);
504 bp
[2] = htonl(vnode
->fid
.vnode
);
505 bp
[3] = htonl(vnode
->fid
.unique
);
506 bp
[4] = htonl(upper_32_bits(req
->pos
));
507 bp
[5] = htonl(lower_32_bits(req
->pos
));
509 bp
[7] = htonl(lower_32_bits(req
->len
));
511 afs_use_fs_server(call
, fc
->cbi
);
512 trace_afs_make_fs_call(call
, &vnode
->fid
);
513 afs_set_fc_call(call
, fc
);
514 afs_make_call(&fc
->ac
, call
, GFP_NOFS
);
515 return afs_wait_for_call_to_complete(call
, &fc
->ac
);
519 * fetch data from a file
521 int afs_fs_fetch_data(struct afs_fs_cursor
*fc
,
522 struct afs_status_cb
*scb
,
523 struct afs_read
*req
)
525 struct afs_vnode
*vnode
= fc
->vnode
;
526 struct afs_call
*call
;
527 struct afs_net
*net
= afs_v2net(vnode
);
530 if (test_bit(AFS_SERVER_FL_IS_YFS
, &fc
->cbi
->server
->flags
))
531 return yfs_fs_fetch_data(fc
, scb
, req
);
533 if (upper_32_bits(req
->pos
) ||
534 upper_32_bits(req
->len
) ||
535 upper_32_bits(req
->pos
+ req
->len
))
536 return afs_fs_fetch_data64(fc
, scb
, req
);
540 call
= afs_alloc_flat_call(net
, &afs_RXFSFetchData
, 24, (21 + 3 + 6) * 4);
546 call
->out_volsync
= NULL
;
547 call
->read_request
= afs_get_read(req
);
549 /* marshall the parameters */
551 bp
[0] = htonl(FSFETCHDATA
);
552 bp
[1] = htonl(vnode
->fid
.vid
);
553 bp
[2] = htonl(vnode
->fid
.vnode
);
554 bp
[3] = htonl(vnode
->fid
.unique
);
555 bp
[4] = htonl(lower_32_bits(req
->pos
));
556 bp
[5] = htonl(lower_32_bits(req
->len
));
558 afs_use_fs_server(call
, fc
->cbi
);
559 trace_afs_make_fs_call(call
, &vnode
->fid
);
560 afs_set_fc_call(call
, fc
);
561 afs_make_call(&fc
->ac
, call
, GFP_NOFS
);
562 return afs_wait_for_call_to_complete(call
, &fc
->ac
);
566 * deliver reply data to an FS.CreateFile or an FS.MakeDir
568 static int afs_deliver_fs_create_vnode(struct afs_call
*call
)
573 ret
= afs_transfer_reply(call
);
577 /* unmarshall the reply once we've received all of it */
579 xdr_decode_AFSFid(&bp
, call
->out_fid
);
580 ret
= xdr_decode_AFSFetchStatus(&bp
, call
, call
->out_scb
);
583 ret
= xdr_decode_AFSFetchStatus(&bp
, call
, call
->out_dir_scb
);
586 xdr_decode_AFSCallBack(&bp
, call
, call
->out_scb
);
587 xdr_decode_AFSVolSync(&bp
, call
->out_volsync
);
589 _leave(" = 0 [done]");
594 * FS.CreateFile and FS.MakeDir operation type
596 static const struct afs_call_type afs_RXFSCreateFile
= {
597 .name
= "FS.CreateFile",
598 .op
= afs_FS_CreateFile
,
599 .deliver
= afs_deliver_fs_create_vnode
,
600 .destructor
= afs_flat_call_destructor
,
603 static const struct afs_call_type afs_RXFSMakeDir
= {
604 .name
= "FS.MakeDir",
605 .op
= afs_FS_MakeDir
,
606 .deliver
= afs_deliver_fs_create_vnode
,
607 .destructor
= afs_flat_call_destructor
,
611 * create a file or make a directory
613 int afs_fs_create(struct afs_fs_cursor
*fc
,
616 struct afs_status_cb
*dvnode_scb
,
617 struct afs_fid
*newfid
,
618 struct afs_status_cb
*new_scb
)
620 struct afs_vnode
*dvnode
= fc
->vnode
;
621 struct afs_call
*call
;
622 struct afs_net
*net
= afs_v2net(dvnode
);
623 size_t namesz
, reqsz
, padsz
;
626 if (test_bit(AFS_SERVER_FL_IS_YFS
, &fc
->cbi
->server
->flags
)){
628 return yfs_fs_make_dir(fc
, name
, mode
, dvnode_scb
,
631 return yfs_fs_create_file(fc
, name
, mode
, dvnode_scb
,
637 namesz
= strlen(name
);
638 padsz
= (4 - (namesz
& 3)) & 3;
639 reqsz
= (5 * 4) + namesz
+ padsz
+ (6 * 4);
641 call
= afs_alloc_flat_call(
642 net
, S_ISDIR(mode
) ? &afs_RXFSMakeDir
: &afs_RXFSCreateFile
,
643 reqsz
, (3 + 21 + 21 + 3 + 6) * 4);
648 call
->out_dir_scb
= dvnode_scb
;
649 call
->out_fid
= newfid
;
650 call
->out_scb
= new_scb
;
652 /* marshall the parameters */
654 *bp
++ = htonl(S_ISDIR(mode
) ? FSMAKEDIR
: FSCREATEFILE
);
655 *bp
++ = htonl(dvnode
->fid
.vid
);
656 *bp
++ = htonl(dvnode
->fid
.vnode
);
657 *bp
++ = htonl(dvnode
->fid
.unique
);
658 *bp
++ = htonl(namesz
);
659 memcpy(bp
, name
, namesz
);
660 bp
= (void *) bp
+ namesz
;
662 memset(bp
, 0, padsz
);
663 bp
= (void *) bp
+ padsz
;
665 *bp
++ = htonl(AFS_SET_MODE
| AFS_SET_MTIME
);
666 *bp
++ = htonl(dvnode
->vfs_inode
.i_mtime
.tv_sec
); /* mtime */
667 *bp
++ = 0; /* owner */
668 *bp
++ = 0; /* group */
669 *bp
++ = htonl(mode
& S_IALLUGO
); /* unix mode */
670 *bp
++ = 0; /* segment size */
672 afs_use_fs_server(call
, fc
->cbi
);
673 trace_afs_make_fs_call1(call
, &dvnode
->fid
, name
);
674 afs_set_fc_call(call
, fc
);
675 afs_make_call(&fc
->ac
, call
, GFP_NOFS
);
676 return afs_wait_for_call_to_complete(call
, &fc
->ac
);
680 * Deliver reply data to any operation that returns directory status and volume
683 static int afs_deliver_fs_dir_status_and_vol(struct afs_call
*call
)
688 ret
= afs_transfer_reply(call
);
692 /* unmarshall the reply once we've received all of it */
694 ret
= xdr_decode_AFSFetchStatus(&bp
, call
, call
->out_dir_scb
);
697 xdr_decode_AFSVolSync(&bp
, call
->out_volsync
);
699 _leave(" = 0 [done]");
704 * FS.RemoveDir/FS.RemoveFile operation type
706 static const struct afs_call_type afs_RXFSRemoveFile
= {
707 .name
= "FS.RemoveFile",
708 .op
= afs_FS_RemoveFile
,
709 .deliver
= afs_deliver_fs_dir_status_and_vol
,
710 .destructor
= afs_flat_call_destructor
,
713 static const struct afs_call_type afs_RXFSRemoveDir
= {
714 .name
= "FS.RemoveDir",
715 .op
= afs_FS_RemoveDir
,
716 .deliver
= afs_deliver_fs_dir_status_and_vol
,
717 .destructor
= afs_flat_call_destructor
,
721 * remove a file or directory
723 int afs_fs_remove(struct afs_fs_cursor
*fc
, struct afs_vnode
*vnode
,
724 const char *name
, bool isdir
, struct afs_status_cb
*dvnode_scb
)
726 struct afs_vnode
*dvnode
= fc
->vnode
;
727 struct afs_call
*call
;
728 struct afs_net
*net
= afs_v2net(dvnode
);
729 size_t namesz
, reqsz
, padsz
;
732 if (test_bit(AFS_SERVER_FL_IS_YFS
, &fc
->cbi
->server
->flags
))
733 return yfs_fs_remove(fc
, vnode
, name
, isdir
, dvnode_scb
);
737 namesz
= strlen(name
);
738 padsz
= (4 - (namesz
& 3)) & 3;
739 reqsz
= (5 * 4) + namesz
+ padsz
;
741 call
= afs_alloc_flat_call(
742 net
, isdir
? &afs_RXFSRemoveDir
: &afs_RXFSRemoveFile
,
743 reqsz
, (21 + 6) * 4);
748 call
->out_dir_scb
= dvnode_scb
;
750 /* marshall the parameters */
752 *bp
++ = htonl(isdir
? FSREMOVEDIR
: FSREMOVEFILE
);
753 *bp
++ = htonl(dvnode
->fid
.vid
);
754 *bp
++ = htonl(dvnode
->fid
.vnode
);
755 *bp
++ = htonl(dvnode
->fid
.unique
);
756 *bp
++ = htonl(namesz
);
757 memcpy(bp
, name
, namesz
);
758 bp
= (void *) bp
+ namesz
;
760 memset(bp
, 0, padsz
);
761 bp
= (void *) bp
+ padsz
;
764 afs_use_fs_server(call
, fc
->cbi
);
765 trace_afs_make_fs_call1(call
, &dvnode
->fid
, name
);
766 afs_set_fc_call(call
, fc
);
767 afs_make_call(&fc
->ac
, call
, GFP_NOFS
);
768 return afs_wait_for_call_to_complete(call
, &fc
->ac
);
772 * deliver reply data to an FS.Link
774 static int afs_deliver_fs_link(struct afs_call
*call
)
779 _enter("{%u}", call
->unmarshall
);
781 ret
= afs_transfer_reply(call
);
785 /* unmarshall the reply once we've received all of it */
787 ret
= xdr_decode_AFSFetchStatus(&bp
, call
, call
->out_scb
);
790 ret
= xdr_decode_AFSFetchStatus(&bp
, call
, call
->out_dir_scb
);
793 xdr_decode_AFSVolSync(&bp
, call
->out_volsync
);
795 _leave(" = 0 [done]");
800 * FS.Link operation type
802 static const struct afs_call_type afs_RXFSLink
= {
805 .deliver
= afs_deliver_fs_link
,
806 .destructor
= afs_flat_call_destructor
,
812 int afs_fs_link(struct afs_fs_cursor
*fc
, struct afs_vnode
*vnode
,
814 struct afs_status_cb
*dvnode_scb
,
815 struct afs_status_cb
*vnode_scb
)
817 struct afs_vnode
*dvnode
= fc
->vnode
;
818 struct afs_call
*call
;
819 struct afs_net
*net
= afs_v2net(vnode
);
820 size_t namesz
, reqsz
, padsz
;
823 if (test_bit(AFS_SERVER_FL_IS_YFS
, &fc
->cbi
->server
->flags
))
824 return yfs_fs_link(fc
, vnode
, name
, dvnode_scb
, vnode_scb
);
828 namesz
= strlen(name
);
829 padsz
= (4 - (namesz
& 3)) & 3;
830 reqsz
= (5 * 4) + namesz
+ padsz
+ (3 * 4);
832 call
= afs_alloc_flat_call(net
, &afs_RXFSLink
, reqsz
, (21 + 21 + 6) * 4);
837 call
->out_dir_scb
= dvnode_scb
;
838 call
->out_scb
= vnode_scb
;
840 /* marshall the parameters */
842 *bp
++ = htonl(FSLINK
);
843 *bp
++ = htonl(dvnode
->fid
.vid
);
844 *bp
++ = htonl(dvnode
->fid
.vnode
);
845 *bp
++ = htonl(dvnode
->fid
.unique
);
846 *bp
++ = htonl(namesz
);
847 memcpy(bp
, name
, namesz
);
848 bp
= (void *) bp
+ namesz
;
850 memset(bp
, 0, padsz
);
851 bp
= (void *) bp
+ padsz
;
853 *bp
++ = htonl(vnode
->fid
.vid
);
854 *bp
++ = htonl(vnode
->fid
.vnode
);
855 *bp
++ = htonl(vnode
->fid
.unique
);
857 afs_use_fs_server(call
, fc
->cbi
);
858 trace_afs_make_fs_call1(call
, &vnode
->fid
, name
);
859 afs_set_fc_call(call
, fc
);
860 afs_make_call(&fc
->ac
, call
, GFP_NOFS
);
861 return afs_wait_for_call_to_complete(call
, &fc
->ac
);
865 * deliver reply data to an FS.Symlink
867 static int afs_deliver_fs_symlink(struct afs_call
*call
)
872 _enter("{%u}", call
->unmarshall
);
874 ret
= afs_transfer_reply(call
);
878 /* unmarshall the reply once we've received all of it */
880 xdr_decode_AFSFid(&bp
, call
->out_fid
);
881 ret
= xdr_decode_AFSFetchStatus(&bp
, call
, call
->out_scb
);
884 ret
= xdr_decode_AFSFetchStatus(&bp
, call
, call
->out_dir_scb
);
887 xdr_decode_AFSVolSync(&bp
, call
->out_volsync
);
889 _leave(" = 0 [done]");
894 * FS.Symlink operation type
896 static const struct afs_call_type afs_RXFSSymlink
= {
897 .name
= "FS.Symlink",
898 .op
= afs_FS_Symlink
,
899 .deliver
= afs_deliver_fs_symlink
,
900 .destructor
= afs_flat_call_destructor
,
904 * create a symbolic link
906 int afs_fs_symlink(struct afs_fs_cursor
*fc
,
908 const char *contents
,
909 struct afs_status_cb
*dvnode_scb
,
910 struct afs_fid
*newfid
,
911 struct afs_status_cb
*new_scb
)
913 struct afs_vnode
*dvnode
= fc
->vnode
;
914 struct afs_call
*call
;
915 struct afs_net
*net
= afs_v2net(dvnode
);
916 size_t namesz
, reqsz
, padsz
, c_namesz
, c_padsz
;
919 if (test_bit(AFS_SERVER_FL_IS_YFS
, &fc
->cbi
->server
->flags
))
920 return yfs_fs_symlink(fc
, name
, contents
, dvnode_scb
,
925 namesz
= strlen(name
);
926 padsz
= (4 - (namesz
& 3)) & 3;
928 c_namesz
= strlen(contents
);
929 c_padsz
= (4 - (c_namesz
& 3)) & 3;
931 reqsz
= (6 * 4) + namesz
+ padsz
+ c_namesz
+ c_padsz
+ (6 * 4);
933 call
= afs_alloc_flat_call(net
, &afs_RXFSSymlink
, reqsz
,
934 (3 + 21 + 21 + 6) * 4);
939 call
->out_dir_scb
= dvnode_scb
;
940 call
->out_fid
= newfid
;
941 call
->out_scb
= new_scb
;
943 /* marshall the parameters */
945 *bp
++ = htonl(FSSYMLINK
);
946 *bp
++ = htonl(dvnode
->fid
.vid
);
947 *bp
++ = htonl(dvnode
->fid
.vnode
);
948 *bp
++ = htonl(dvnode
->fid
.unique
);
949 *bp
++ = htonl(namesz
);
950 memcpy(bp
, name
, namesz
);
951 bp
= (void *) bp
+ namesz
;
953 memset(bp
, 0, padsz
);
954 bp
= (void *) bp
+ padsz
;
956 *bp
++ = htonl(c_namesz
);
957 memcpy(bp
, contents
, c_namesz
);
958 bp
= (void *) bp
+ c_namesz
;
960 memset(bp
, 0, c_padsz
);
961 bp
= (void *) bp
+ c_padsz
;
963 *bp
++ = htonl(AFS_SET_MODE
| AFS_SET_MTIME
);
964 *bp
++ = htonl(dvnode
->vfs_inode
.i_mtime
.tv_sec
); /* mtime */
965 *bp
++ = 0; /* owner */
966 *bp
++ = 0; /* group */
967 *bp
++ = htonl(S_IRWXUGO
); /* unix mode */
968 *bp
++ = 0; /* segment size */
970 afs_use_fs_server(call
, fc
->cbi
);
971 trace_afs_make_fs_call1(call
, &dvnode
->fid
, name
);
972 afs_set_fc_call(call
, fc
);
973 afs_make_call(&fc
->ac
, call
, GFP_NOFS
);
974 return afs_wait_for_call_to_complete(call
, &fc
->ac
);
978 * deliver reply data to an FS.Rename
980 static int afs_deliver_fs_rename(struct afs_call
*call
)
985 ret
= afs_transfer_reply(call
);
989 /* If the two dirs are the same, we have two copies of the same status
990 * report, so we just decode it twice.
993 ret
= xdr_decode_AFSFetchStatus(&bp
, call
, call
->out_dir_scb
);
996 ret
= xdr_decode_AFSFetchStatus(&bp
, call
, call
->out_scb
);
999 xdr_decode_AFSVolSync(&bp
, call
->out_volsync
);
1001 _leave(" = 0 [done]");
1006 * FS.Rename operation type
1008 static const struct afs_call_type afs_RXFSRename
= {
1009 .name
= "FS.Rename",
1010 .op
= afs_FS_Rename
,
1011 .deliver
= afs_deliver_fs_rename
,
1012 .destructor
= afs_flat_call_destructor
,
1016 * Rename/move a file or directory.
1018 int afs_fs_rename(struct afs_fs_cursor
*fc
,
1019 const char *orig_name
,
1020 struct afs_vnode
*new_dvnode
,
1021 const char *new_name
,
1022 struct afs_status_cb
*orig_dvnode_scb
,
1023 struct afs_status_cb
*new_dvnode_scb
)
1025 struct afs_vnode
*orig_dvnode
= fc
->vnode
;
1026 struct afs_call
*call
;
1027 struct afs_net
*net
= afs_v2net(orig_dvnode
);
1028 size_t reqsz
, o_namesz
, o_padsz
, n_namesz
, n_padsz
;
1031 if (test_bit(AFS_SERVER_FL_IS_YFS
, &fc
->cbi
->server
->flags
))
1032 return yfs_fs_rename(fc
, orig_name
,
1033 new_dvnode
, new_name
,
1039 o_namesz
= strlen(orig_name
);
1040 o_padsz
= (4 - (o_namesz
& 3)) & 3;
1042 n_namesz
= strlen(new_name
);
1043 n_padsz
= (4 - (n_namesz
& 3)) & 3;
1046 4 + o_namesz
+ o_padsz
+
1048 4 + n_namesz
+ n_padsz
;
1050 call
= afs_alloc_flat_call(net
, &afs_RXFSRename
, reqsz
, (21 + 21 + 6) * 4);
1054 call
->key
= fc
->key
;
1055 call
->out_dir_scb
= orig_dvnode_scb
;
1056 call
->out_scb
= new_dvnode_scb
;
1058 /* marshall the parameters */
1060 *bp
++ = htonl(FSRENAME
);
1061 *bp
++ = htonl(orig_dvnode
->fid
.vid
);
1062 *bp
++ = htonl(orig_dvnode
->fid
.vnode
);
1063 *bp
++ = htonl(orig_dvnode
->fid
.unique
);
1064 *bp
++ = htonl(o_namesz
);
1065 memcpy(bp
, orig_name
, o_namesz
);
1066 bp
= (void *) bp
+ o_namesz
;
1068 memset(bp
, 0, o_padsz
);
1069 bp
= (void *) bp
+ o_padsz
;
1072 *bp
++ = htonl(new_dvnode
->fid
.vid
);
1073 *bp
++ = htonl(new_dvnode
->fid
.vnode
);
1074 *bp
++ = htonl(new_dvnode
->fid
.unique
);
1075 *bp
++ = htonl(n_namesz
);
1076 memcpy(bp
, new_name
, n_namesz
);
1077 bp
= (void *) bp
+ n_namesz
;
1079 memset(bp
, 0, n_padsz
);
1080 bp
= (void *) bp
+ n_padsz
;
1083 afs_use_fs_server(call
, fc
->cbi
);
1084 trace_afs_make_fs_call2(call
, &orig_dvnode
->fid
, orig_name
, new_name
);
1085 afs_set_fc_call(call
, fc
);
1086 afs_make_call(&fc
->ac
, call
, GFP_NOFS
);
1087 return afs_wait_for_call_to_complete(call
, &fc
->ac
);
1091 * deliver reply data to an FS.StoreData
1093 static int afs_deliver_fs_store_data(struct afs_call
*call
)
1100 ret
= afs_transfer_reply(call
);
1104 /* unmarshall the reply once we've received all of it */
1106 ret
= xdr_decode_AFSFetchStatus(&bp
, call
, call
->out_scb
);
1109 xdr_decode_AFSVolSync(&bp
, call
->out_volsync
);
1111 _leave(" = 0 [done]");
1116 * FS.StoreData operation type
1118 static const struct afs_call_type afs_RXFSStoreData
= {
1119 .name
= "FS.StoreData",
1120 .op
= afs_FS_StoreData
,
1121 .deliver
= afs_deliver_fs_store_data
,
1122 .destructor
= afs_flat_call_destructor
,
1125 static const struct afs_call_type afs_RXFSStoreData64
= {
1126 .name
= "FS.StoreData64",
1127 .op
= afs_FS_StoreData64
,
1128 .deliver
= afs_deliver_fs_store_data
,
1129 .destructor
= afs_flat_call_destructor
,
1133 * store a set of pages to a very large file
1135 static int afs_fs_store_data64(struct afs_fs_cursor
*fc
,
1136 struct address_space
*mapping
,
1137 pgoff_t first
, pgoff_t last
,
1138 unsigned offset
, unsigned to
,
1139 loff_t size
, loff_t pos
, loff_t i_size
,
1140 struct afs_status_cb
*scb
)
1142 struct afs_vnode
*vnode
= fc
->vnode
;
1143 struct afs_call
*call
;
1144 struct afs_net
*net
= afs_v2net(vnode
);
1147 _enter(",%x,{%llx:%llu},,",
1148 key_serial(fc
->key
), vnode
->fid
.vid
, vnode
->fid
.vnode
);
1150 call
= afs_alloc_flat_call(net
, &afs_RXFSStoreData64
,
1151 (4 + 6 + 3 * 2) * 4,
1156 call
->key
= fc
->key
;
1157 call
->mapping
= mapping
;
1158 call
->first
= first
;
1160 call
->first_offset
= offset
;
1162 call
->send_pages
= true;
1163 call
->out_scb
= scb
;
1165 /* marshall the parameters */
1167 *bp
++ = htonl(FSSTOREDATA64
);
1168 *bp
++ = htonl(vnode
->fid
.vid
);
1169 *bp
++ = htonl(vnode
->fid
.vnode
);
1170 *bp
++ = htonl(vnode
->fid
.unique
);
1172 *bp
++ = htonl(AFS_SET_MTIME
); /* mask */
1173 *bp
++ = htonl(vnode
->vfs_inode
.i_mtime
.tv_sec
); /* mtime */
1174 *bp
++ = 0; /* owner */
1175 *bp
++ = 0; /* group */
1176 *bp
++ = 0; /* unix mode */
1177 *bp
++ = 0; /* segment size */
1179 *bp
++ = htonl(pos
>> 32);
1180 *bp
++ = htonl((u32
) pos
);
1181 *bp
++ = htonl(size
>> 32);
1182 *bp
++ = htonl((u32
) size
);
1183 *bp
++ = htonl(i_size
>> 32);
1184 *bp
++ = htonl((u32
) i_size
);
1186 trace_afs_make_fs_call(call
, &vnode
->fid
);
1187 afs_set_fc_call(call
, fc
);
1188 afs_make_call(&fc
->ac
, call
, GFP_NOFS
);
1189 return afs_wait_for_call_to_complete(call
, &fc
->ac
);
1193 * store a set of pages
1195 int afs_fs_store_data(struct afs_fs_cursor
*fc
, struct address_space
*mapping
,
1196 pgoff_t first
, pgoff_t last
,
1197 unsigned offset
, unsigned to
,
1198 struct afs_status_cb
*scb
)
1200 struct afs_vnode
*vnode
= fc
->vnode
;
1201 struct afs_call
*call
;
1202 struct afs_net
*net
= afs_v2net(vnode
);
1203 loff_t size
, pos
, i_size
;
1206 if (test_bit(AFS_SERVER_FL_IS_YFS
, &fc
->cbi
->server
->flags
))
1207 return yfs_fs_store_data(fc
, mapping
, first
, last
, offset
, to
, scb
);
1209 _enter(",%x,{%llx:%llu},,",
1210 key_serial(fc
->key
), vnode
->fid
.vid
, vnode
->fid
.vnode
);
1212 size
= (loff_t
)to
- (loff_t
)offset
;
1214 size
+= (loff_t
)(last
- first
) << PAGE_SHIFT
;
1215 pos
= (loff_t
)first
<< PAGE_SHIFT
;
1218 i_size
= i_size_read(&vnode
->vfs_inode
);
1219 if (pos
+ size
> i_size
)
1220 i_size
= size
+ pos
;
1222 _debug("size %llx, at %llx, i_size %llx",
1223 (unsigned long long) size
, (unsigned long long) pos
,
1224 (unsigned long long) i_size
);
1226 if (pos
>> 32 || i_size
>> 32 || size
>> 32 || (pos
+ size
) >> 32)
1227 return afs_fs_store_data64(fc
, mapping
, first
, last
, offset
, to
,
1228 size
, pos
, i_size
, scb
);
1230 call
= afs_alloc_flat_call(net
, &afs_RXFSStoreData
,
1236 call
->key
= fc
->key
;
1237 call
->mapping
= mapping
;
1238 call
->first
= first
;
1240 call
->first_offset
= offset
;
1242 call
->send_pages
= true;
1243 call
->out_scb
= scb
;
1245 /* marshall the parameters */
1247 *bp
++ = htonl(FSSTOREDATA
);
1248 *bp
++ = htonl(vnode
->fid
.vid
);
1249 *bp
++ = htonl(vnode
->fid
.vnode
);
1250 *bp
++ = htonl(vnode
->fid
.unique
);
1252 *bp
++ = htonl(AFS_SET_MTIME
); /* mask */
1253 *bp
++ = htonl(vnode
->vfs_inode
.i_mtime
.tv_sec
); /* mtime */
1254 *bp
++ = 0; /* owner */
1255 *bp
++ = 0; /* group */
1256 *bp
++ = 0; /* unix mode */
1257 *bp
++ = 0; /* segment size */
1260 *bp
++ = htonl(size
);
1261 *bp
++ = htonl(i_size
);
1263 afs_use_fs_server(call
, fc
->cbi
);
1264 trace_afs_make_fs_call(call
, &vnode
->fid
);
1265 afs_set_fc_call(call
, fc
);
1266 afs_make_call(&fc
->ac
, call
, GFP_NOFS
);
1267 return afs_wait_for_call_to_complete(call
, &fc
->ac
);
1271 * deliver reply data to an FS.StoreStatus
1273 static int afs_deliver_fs_store_status(struct afs_call
*call
)
1280 ret
= afs_transfer_reply(call
);
1284 /* unmarshall the reply once we've received all of it */
1286 ret
= xdr_decode_AFSFetchStatus(&bp
, call
, call
->out_scb
);
1289 xdr_decode_AFSVolSync(&bp
, call
->out_volsync
);
1291 _leave(" = 0 [done]");
1296 * FS.StoreStatus operation type
1298 static const struct afs_call_type afs_RXFSStoreStatus
= {
1299 .name
= "FS.StoreStatus",
1300 .op
= afs_FS_StoreStatus
,
1301 .deliver
= afs_deliver_fs_store_status
,
1302 .destructor
= afs_flat_call_destructor
,
1305 static const struct afs_call_type afs_RXFSStoreData_as_Status
= {
1306 .name
= "FS.StoreData",
1307 .op
= afs_FS_StoreData
,
1308 .deliver
= afs_deliver_fs_store_status
,
1309 .destructor
= afs_flat_call_destructor
,
1312 static const struct afs_call_type afs_RXFSStoreData64_as_Status
= {
1313 .name
= "FS.StoreData64",
1314 .op
= afs_FS_StoreData64
,
1315 .deliver
= afs_deliver_fs_store_status
,
1316 .destructor
= afs_flat_call_destructor
,
1320 * set the attributes on a very large file, using FS.StoreData rather than
1321 * FS.StoreStatus so as to alter the file size also
1323 static int afs_fs_setattr_size64(struct afs_fs_cursor
*fc
, struct iattr
*attr
,
1324 struct afs_status_cb
*scb
)
1326 struct afs_vnode
*vnode
= fc
->vnode
;
1327 struct afs_call
*call
;
1328 struct afs_net
*net
= afs_v2net(vnode
);
1331 _enter(",%x,{%llx:%llu},,",
1332 key_serial(fc
->key
), vnode
->fid
.vid
, vnode
->fid
.vnode
);
1334 ASSERT(attr
->ia_valid
& ATTR_SIZE
);
1336 call
= afs_alloc_flat_call(net
, &afs_RXFSStoreData64_as_Status
,
1337 (4 + 6 + 3 * 2) * 4,
1342 call
->key
= fc
->key
;
1343 call
->out_scb
= scb
;
1345 /* marshall the parameters */
1347 *bp
++ = htonl(FSSTOREDATA64
);
1348 *bp
++ = htonl(vnode
->fid
.vid
);
1349 *bp
++ = htonl(vnode
->fid
.vnode
);
1350 *bp
++ = htonl(vnode
->fid
.unique
);
1352 xdr_encode_AFS_StoreStatus(&bp
, attr
);
1354 *bp
++ = htonl(attr
->ia_size
>> 32); /* position of start of write */
1355 *bp
++ = htonl((u32
) attr
->ia_size
);
1356 *bp
++ = 0; /* size of write */
1358 *bp
++ = htonl(attr
->ia_size
>> 32); /* new file length */
1359 *bp
++ = htonl((u32
) attr
->ia_size
);
1361 afs_use_fs_server(call
, fc
->cbi
);
1362 trace_afs_make_fs_call(call
, &vnode
->fid
);
1363 afs_set_fc_call(call
, fc
);
1364 afs_make_call(&fc
->ac
, call
, GFP_NOFS
);
1365 return afs_wait_for_call_to_complete(call
, &fc
->ac
);
1369 * set the attributes on a file, using FS.StoreData rather than FS.StoreStatus
1370 * so as to alter the file size also
1372 static int afs_fs_setattr_size(struct afs_fs_cursor
*fc
, struct iattr
*attr
,
1373 struct afs_status_cb
*scb
)
1375 struct afs_vnode
*vnode
= fc
->vnode
;
1376 struct afs_call
*call
;
1377 struct afs_net
*net
= afs_v2net(vnode
);
1380 _enter(",%x,{%llx:%llu},,",
1381 key_serial(fc
->key
), vnode
->fid
.vid
, vnode
->fid
.vnode
);
1383 ASSERT(attr
->ia_valid
& ATTR_SIZE
);
1384 if (attr
->ia_size
>> 32)
1385 return afs_fs_setattr_size64(fc
, attr
, scb
);
1387 call
= afs_alloc_flat_call(net
, &afs_RXFSStoreData_as_Status
,
1393 call
->key
= fc
->key
;
1394 call
->out_scb
= scb
;
1396 /* marshall the parameters */
1398 *bp
++ = htonl(FSSTOREDATA
);
1399 *bp
++ = htonl(vnode
->fid
.vid
);
1400 *bp
++ = htonl(vnode
->fid
.vnode
);
1401 *bp
++ = htonl(vnode
->fid
.unique
);
1403 xdr_encode_AFS_StoreStatus(&bp
, attr
);
1405 *bp
++ = htonl(attr
->ia_size
); /* position of start of write */
1406 *bp
++ = 0; /* size of write */
1407 *bp
++ = htonl(attr
->ia_size
); /* new file length */
1409 afs_use_fs_server(call
, fc
->cbi
);
1410 trace_afs_make_fs_call(call
, &vnode
->fid
);
1411 afs_set_fc_call(call
, fc
);
1412 afs_make_call(&fc
->ac
, call
, GFP_NOFS
);
1413 return afs_wait_for_call_to_complete(call
, &fc
->ac
);
1417 * set the attributes on a file, using FS.StoreData if there's a change in file
1418 * size, and FS.StoreStatus otherwise
1420 int afs_fs_setattr(struct afs_fs_cursor
*fc
, struct iattr
*attr
,
1421 struct afs_status_cb
*scb
)
1423 struct afs_vnode
*vnode
= fc
->vnode
;
1424 struct afs_call
*call
;
1425 struct afs_net
*net
= afs_v2net(vnode
);
1428 if (test_bit(AFS_SERVER_FL_IS_YFS
, &fc
->cbi
->server
->flags
))
1429 return yfs_fs_setattr(fc
, attr
, scb
);
1431 if (attr
->ia_valid
& ATTR_SIZE
)
1432 return afs_fs_setattr_size(fc
, attr
, scb
);
1434 _enter(",%x,{%llx:%llu},,",
1435 key_serial(fc
->key
), vnode
->fid
.vid
, vnode
->fid
.vnode
);
1437 call
= afs_alloc_flat_call(net
, &afs_RXFSStoreStatus
,
1443 call
->key
= fc
->key
;
1444 call
->out_scb
= scb
;
1446 /* marshall the parameters */
1448 *bp
++ = htonl(FSSTORESTATUS
);
1449 *bp
++ = htonl(vnode
->fid
.vid
);
1450 *bp
++ = htonl(vnode
->fid
.vnode
);
1451 *bp
++ = htonl(vnode
->fid
.unique
);
1453 xdr_encode_AFS_StoreStatus(&bp
, attr
);
1455 afs_use_fs_server(call
, fc
->cbi
);
1456 trace_afs_make_fs_call(call
, &vnode
->fid
);
1457 afs_set_fc_call(call
, fc
);
1458 afs_make_call(&fc
->ac
, call
, GFP_NOFS
);
1459 return afs_wait_for_call_to_complete(call
, &fc
->ac
);
1463 * deliver reply data to an FS.GetVolumeStatus
1465 static int afs_deliver_fs_get_volume_status(struct afs_call
*call
)
1472 _enter("{%u}", call
->unmarshall
);
1474 switch (call
->unmarshall
) {
1477 afs_extract_to_buf(call
, 12 * 4);
1480 /* extract the returned status record */
1482 _debug("extract status");
1483 ret
= afs_extract_data(call
, true);
1488 xdr_decode_AFSFetchVolumeStatus(&bp
, call
->out_volstatus
);
1490 afs_extract_to_tmp(call
);
1493 /* extract the volume name length */
1495 ret
= afs_extract_data(call
, true);
1499 call
->count
= ntohl(call
->tmp
);
1500 _debug("volname length: %u", call
->count
);
1501 if (call
->count
>= AFSNAMEMAX
)
1502 return afs_protocol_error(call
, -EBADMSG
,
1503 afs_eproto_volname_len
);
1504 size
= (call
->count
+ 3) & ~3; /* It's padded */
1505 afs_extract_to_buf(call
, size
);
1509 /* extract the volume name */
1511 _debug("extract volname");
1512 ret
= afs_extract_data(call
, true);
1518 _debug("volname '%s'", p
);
1519 afs_extract_to_tmp(call
);
1523 /* extract the offline message length */
1525 ret
= afs_extract_data(call
, true);
1529 call
->count
= ntohl(call
->tmp
);
1530 _debug("offline msg length: %u", call
->count
);
1531 if (call
->count
>= AFSNAMEMAX
)
1532 return afs_protocol_error(call
, -EBADMSG
,
1533 afs_eproto_offline_msg_len
);
1534 size
= (call
->count
+ 3) & ~3; /* It's padded */
1535 afs_extract_to_buf(call
, size
);
1539 /* extract the offline message */
1541 _debug("extract offline");
1542 ret
= afs_extract_data(call
, true);
1548 _debug("offline '%s'", p
);
1550 afs_extract_to_tmp(call
);
1554 /* extract the message of the day length */
1556 ret
= afs_extract_data(call
, true);
1560 call
->count
= ntohl(call
->tmp
);
1561 _debug("motd length: %u", call
->count
);
1562 if (call
->count
>= AFSNAMEMAX
)
1563 return afs_protocol_error(call
, -EBADMSG
,
1564 afs_eproto_motd_len
);
1565 size
= (call
->count
+ 3) & ~3; /* It's padded */
1566 afs_extract_to_buf(call
, size
);
1570 /* extract the message of the day */
1572 _debug("extract motd");
1573 ret
= afs_extract_data(call
, false);
1579 _debug("motd '%s'", p
);
1587 _leave(" = 0 [done]");
1592 * FS.GetVolumeStatus operation type
1594 static const struct afs_call_type afs_RXFSGetVolumeStatus
= {
1595 .name
= "FS.GetVolumeStatus",
1596 .op
= afs_FS_GetVolumeStatus
,
1597 .deliver
= afs_deliver_fs_get_volume_status
,
1598 .destructor
= afs_flat_call_destructor
,
1602 * fetch the status of a volume
1604 int afs_fs_get_volume_status(struct afs_fs_cursor
*fc
,
1605 struct afs_volume_status
*vs
)
1607 struct afs_vnode
*vnode
= fc
->vnode
;
1608 struct afs_call
*call
;
1609 struct afs_net
*net
= afs_v2net(vnode
);
1612 if (test_bit(AFS_SERVER_FL_IS_YFS
, &fc
->cbi
->server
->flags
))
1613 return yfs_fs_get_volume_status(fc
, vs
);
1617 call
= afs_alloc_flat_call(net
, &afs_RXFSGetVolumeStatus
, 2 * 4,
1618 max(12 * 4, AFSOPAQUEMAX
+ 1));
1622 call
->key
= fc
->key
;
1623 call
->out_volstatus
= vs
;
1625 /* marshall the parameters */
1627 bp
[0] = htonl(FSGETVOLUMESTATUS
);
1628 bp
[1] = htonl(vnode
->fid
.vid
);
1630 afs_use_fs_server(call
, fc
->cbi
);
1631 trace_afs_make_fs_call(call
, &vnode
->fid
);
1632 afs_set_fc_call(call
, fc
);
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.SetLock, FS.ExtendLock or FS.ReleaseLock
1640 static int afs_deliver_fs_xxxx_lock(struct afs_call
*call
)
1645 _enter("{%u}", call
->unmarshall
);
1647 ret
= afs_transfer_reply(call
);
1651 /* unmarshall the reply once we've received all of it */
1653 xdr_decode_AFSVolSync(&bp
, call
->out_volsync
);
1655 _leave(" = 0 [done]");
1660 * FS.SetLock operation type
1662 static const struct afs_call_type afs_RXFSSetLock
= {
1663 .name
= "FS.SetLock",
1664 .op
= afs_FS_SetLock
,
1665 .deliver
= afs_deliver_fs_xxxx_lock
,
1666 .done
= afs_lock_op_done
,
1667 .destructor
= afs_flat_call_destructor
,
1671 * FS.ExtendLock operation type
1673 static const struct afs_call_type afs_RXFSExtendLock
= {
1674 .name
= "FS.ExtendLock",
1675 .op
= afs_FS_ExtendLock
,
1676 .deliver
= afs_deliver_fs_xxxx_lock
,
1677 .done
= afs_lock_op_done
,
1678 .destructor
= afs_flat_call_destructor
,
1682 * FS.ReleaseLock operation type
1684 static const struct afs_call_type afs_RXFSReleaseLock
= {
1685 .name
= "FS.ReleaseLock",
1686 .op
= afs_FS_ReleaseLock
,
1687 .deliver
= afs_deliver_fs_xxxx_lock
,
1688 .destructor
= afs_flat_call_destructor
,
1692 * Set a lock on a file
1694 int afs_fs_set_lock(struct afs_fs_cursor
*fc
, afs_lock_type_t type
,
1695 struct afs_status_cb
*scb
)
1697 struct afs_vnode
*vnode
= fc
->vnode
;
1698 struct afs_call
*call
;
1699 struct afs_net
*net
= afs_v2net(vnode
);
1702 if (test_bit(AFS_SERVER_FL_IS_YFS
, &fc
->cbi
->server
->flags
))
1703 return yfs_fs_set_lock(fc
, type
, scb
);
1707 call
= afs_alloc_flat_call(net
, &afs_RXFSSetLock
, 5 * 4, 6 * 4);
1711 call
->key
= fc
->key
;
1712 call
->lvnode
= vnode
;
1713 call
->out_scb
= scb
;
1715 /* marshall the parameters */
1717 *bp
++ = htonl(FSSETLOCK
);
1718 *bp
++ = htonl(vnode
->fid
.vid
);
1719 *bp
++ = htonl(vnode
->fid
.vnode
);
1720 *bp
++ = htonl(vnode
->fid
.unique
);
1721 *bp
++ = htonl(type
);
1723 afs_use_fs_server(call
, fc
->cbi
);
1724 trace_afs_make_fs_calli(call
, &vnode
->fid
, type
);
1725 afs_set_fc_call(call
, fc
);
1726 afs_make_call(&fc
->ac
, call
, GFP_NOFS
);
1727 return afs_wait_for_call_to_complete(call
, &fc
->ac
);
1731 * extend a lock on a file
1733 int afs_fs_extend_lock(struct afs_fs_cursor
*fc
, struct afs_status_cb
*scb
)
1735 struct afs_vnode
*vnode
= fc
->vnode
;
1736 struct afs_call
*call
;
1737 struct afs_net
*net
= afs_v2net(vnode
);
1740 if (test_bit(AFS_SERVER_FL_IS_YFS
, &fc
->cbi
->server
->flags
))
1741 return yfs_fs_extend_lock(fc
, scb
);
1745 call
= afs_alloc_flat_call(net
, &afs_RXFSExtendLock
, 4 * 4, 6 * 4);
1749 call
->key
= fc
->key
;
1750 call
->lvnode
= vnode
;
1751 call
->out_scb
= scb
;
1753 /* marshall the parameters */
1755 *bp
++ = htonl(FSEXTENDLOCK
);
1756 *bp
++ = htonl(vnode
->fid
.vid
);
1757 *bp
++ = htonl(vnode
->fid
.vnode
);
1758 *bp
++ = htonl(vnode
->fid
.unique
);
1760 afs_use_fs_server(call
, fc
->cbi
);
1761 trace_afs_make_fs_call(call
, &vnode
->fid
);
1762 afs_set_fc_call(call
, fc
);
1763 afs_make_call(&fc
->ac
, call
, GFP_NOFS
);
1764 return afs_wait_for_call_to_complete(call
, &fc
->ac
);
1768 * release a lock on a file
1770 int afs_fs_release_lock(struct afs_fs_cursor
*fc
, struct afs_status_cb
*scb
)
1772 struct afs_vnode
*vnode
= fc
->vnode
;
1773 struct afs_call
*call
;
1774 struct afs_net
*net
= afs_v2net(vnode
);
1777 if (test_bit(AFS_SERVER_FL_IS_YFS
, &fc
->cbi
->server
->flags
))
1778 return yfs_fs_release_lock(fc
, scb
);
1782 call
= afs_alloc_flat_call(net
, &afs_RXFSReleaseLock
, 4 * 4, 6 * 4);
1786 call
->key
= fc
->key
;
1787 call
->lvnode
= vnode
;
1788 call
->out_scb
= scb
;
1790 /* marshall the parameters */
1792 *bp
++ = htonl(FSRELEASELOCK
);
1793 *bp
++ = htonl(vnode
->fid
.vid
);
1794 *bp
++ = htonl(vnode
->fid
.vnode
);
1795 *bp
++ = htonl(vnode
->fid
.unique
);
1797 afs_use_fs_server(call
, fc
->cbi
);
1798 trace_afs_make_fs_call(call
, &vnode
->fid
);
1799 afs_set_fc_call(call
, fc
);
1800 afs_make_call(&fc
->ac
, call
, GFP_NOFS
);
1801 return afs_wait_for_call_to_complete(call
, &fc
->ac
);
1805 * Deliver reply data to an FS.GiveUpAllCallBacks operation.
1807 static int afs_deliver_fs_give_up_all_callbacks(struct afs_call
*call
)
1809 return afs_transfer_reply(call
);
1813 * FS.GiveUpAllCallBacks operation type
1815 static const struct afs_call_type afs_RXFSGiveUpAllCallBacks
= {
1816 .name
= "FS.GiveUpAllCallBacks",
1817 .op
= afs_FS_GiveUpAllCallBacks
,
1818 .deliver
= afs_deliver_fs_give_up_all_callbacks
,
1819 .destructor
= afs_flat_call_destructor
,
1823 * Flush all the callbacks we have on a server.
1825 int afs_fs_give_up_all_callbacks(struct afs_net
*net
,
1826 struct afs_server
*server
,
1827 struct afs_addr_cursor
*ac
,
1830 struct afs_call
*call
;
1835 call
= afs_alloc_flat_call(net
, &afs_RXFSGiveUpAllCallBacks
, 1 * 4, 0);
1841 /* marshall the parameters */
1843 *bp
++ = htonl(FSGIVEUPALLCALLBACKS
);
1845 /* Can't take a ref on server */
1846 afs_make_call(ac
, call
, GFP_NOFS
);
1847 return afs_wait_for_call_to_complete(call
, ac
);
1851 * Deliver reply data to an FS.GetCapabilities operation.
1853 static int afs_deliver_fs_get_capabilities(struct afs_call
*call
)
1858 _enter("{%u,%zu}", call
->unmarshall
, iov_iter_count(call
->iter
));
1860 switch (call
->unmarshall
) {
1862 afs_extract_to_tmp(call
);
1866 /* Extract the capabilities word count */
1868 ret
= afs_extract_data(call
, true);
1872 count
= ntohl(call
->tmp
);
1874 call
->count
= count
;
1875 call
->count2
= count
;
1876 afs_extract_discard(call
, count
* sizeof(__be32
));
1880 /* Extract capabilities words */
1882 ret
= afs_extract_data(call
, false);
1886 /* TODO: Examine capabilities */
1892 _leave(" = 0 [done]");
1897 * FS.GetCapabilities operation type
1899 static const struct afs_call_type afs_RXFSGetCapabilities
= {
1900 .name
= "FS.GetCapabilities",
1901 .op
= afs_FS_GetCapabilities
,
1902 .deliver
= afs_deliver_fs_get_capabilities
,
1903 .done
= afs_fileserver_probe_result
,
1904 .destructor
= afs_flat_call_destructor
,
1908 * Probe a fileserver for the capabilities that it supports. This can
1909 * return up to 196 words.
1911 struct afs_call
*afs_fs_get_capabilities(struct afs_net
*net
,
1912 struct afs_server
*server
,
1913 struct afs_addr_cursor
*ac
,
1915 unsigned int server_index
)
1917 struct afs_call
*call
;
1922 call
= afs_alloc_flat_call(net
, &afs_RXFSGetCapabilities
, 1 * 4, 16 * 4);
1924 return ERR_PTR(-ENOMEM
);
1927 call
->server
= afs_get_server(server
, afs_server_trace_get_caps
);
1928 call
->server_index
= server_index
;
1929 call
->upgrade
= true;
1931 call
->max_lifespan
= AFS_PROBE_MAX_LIFESPAN
;
1933 /* marshall the parameters */
1935 *bp
++ = htonl(FSGETCAPABILITIES
);
1937 /* Can't take a ref on server */
1938 trace_afs_make_fs_call(call
, NULL
);
1939 afs_make_call(ac
, call
, GFP_NOFS
);
1944 * Deliver reply data to an FS.FetchStatus with no vnode.
1946 static int afs_deliver_fs_fetch_status(struct afs_call
*call
)
1951 ret
= afs_transfer_reply(call
);
1955 /* unmarshall the reply once we've received all of it */
1957 ret
= xdr_decode_AFSFetchStatus(&bp
, call
, call
->out_scb
);
1960 xdr_decode_AFSCallBack(&bp
, call
, call
->out_scb
);
1961 xdr_decode_AFSVolSync(&bp
, call
->out_volsync
);
1963 _leave(" = 0 [done]");
1968 * FS.FetchStatus operation type
1970 static const struct afs_call_type afs_RXFSFetchStatus
= {
1971 .name
= "FS.FetchStatus",
1972 .op
= afs_FS_FetchStatus
,
1973 .deliver
= afs_deliver_fs_fetch_status
,
1974 .destructor
= afs_flat_call_destructor
,
1978 * Fetch the status information for a fid without needing a vnode handle.
1980 int afs_fs_fetch_status(struct afs_fs_cursor
*fc
,
1981 struct afs_net
*net
,
1982 struct afs_fid
*fid
,
1983 struct afs_status_cb
*scb
,
1984 struct afs_volsync
*volsync
)
1986 struct afs_call
*call
;
1989 if (test_bit(AFS_SERVER_FL_IS_YFS
, &fc
->cbi
->server
->flags
))
1990 return yfs_fs_fetch_status(fc
, net
, fid
, scb
, volsync
);
1992 _enter(",%x,{%llx:%llu},,",
1993 key_serial(fc
->key
), fid
->vid
, fid
->vnode
);
1995 call
= afs_alloc_flat_call(net
, &afs_RXFSFetchStatus
, 16, (21 + 3 + 6) * 4);
1997 fc
->ac
.error
= -ENOMEM
;
2001 call
->key
= fc
->key
;
2002 call
->out_fid
= fid
;
2003 call
->out_scb
= scb
;
2004 call
->out_volsync
= volsync
;
2006 /* marshall the parameters */
2008 bp
[0] = htonl(FSFETCHSTATUS
);
2009 bp
[1] = htonl(fid
->vid
);
2010 bp
[2] = htonl(fid
->vnode
);
2011 bp
[3] = htonl(fid
->unique
);
2013 afs_use_fs_server(call
, fc
->cbi
);
2014 trace_afs_make_fs_call(call
, fid
);
2015 afs_set_fc_call(call
, fc
);
2016 afs_make_call(&fc
->ac
, call
, GFP_NOFS
);
2017 return afs_wait_for_call_to_complete(call
, &fc
->ac
);
2021 * Deliver reply data to an FS.InlineBulkStatus call
2023 static int afs_deliver_fs_inline_bulk_status(struct afs_call
*call
)
2025 struct afs_status_cb
*scb
;
2030 _enter("{%u}", call
->unmarshall
);
2032 switch (call
->unmarshall
) {
2034 afs_extract_to_tmp(call
);
2038 /* Extract the file status count and array in two steps */
2040 _debug("extract status count");
2041 ret
= afs_extract_data(call
, true);
2045 tmp
= ntohl(call
->tmp
);
2046 _debug("status count: %u/%u", tmp
, call
->count2
);
2047 if (tmp
!= call
->count2
)
2048 return afs_protocol_error(call
, -EBADMSG
,
2049 afs_eproto_ibulkst_count
);
2054 afs_extract_to_buf(call
, 21 * sizeof(__be32
));
2058 _debug("extract status array %u", call
->count
);
2059 ret
= afs_extract_data(call
, true);
2064 scb
= &call
->out_scb
[call
->count
];
2065 ret
= xdr_decode_AFSFetchStatus(&bp
, call
, scb
);
2070 if (call
->count
< call
->count2
)
2075 afs_extract_to_tmp(call
);
2078 /* Extract the callback count and array in two steps */
2080 _debug("extract CB count");
2081 ret
= afs_extract_data(call
, true);
2085 tmp
= ntohl(call
->tmp
);
2086 _debug("CB count: %u", tmp
);
2087 if (tmp
!= call
->count2
)
2088 return afs_protocol_error(call
, -EBADMSG
,
2089 afs_eproto_ibulkst_cb_count
);
2093 afs_extract_to_buf(call
, 3 * sizeof(__be32
));
2097 _debug("extract CB array");
2098 ret
= afs_extract_data(call
, true);
2102 _debug("unmarshall CB array");
2104 scb
= &call
->out_scb
[call
->count
];
2105 xdr_decode_AFSCallBack(&bp
, call
, scb
);
2107 if (call
->count
< call
->count2
)
2110 afs_extract_to_buf(call
, 6 * sizeof(__be32
));
2115 ret
= afs_extract_data(call
, false);
2120 xdr_decode_AFSVolSync(&bp
, call
->out_volsync
);
2128 _leave(" = 0 [done]");
2133 * FS.InlineBulkStatus operation type
2135 static const struct afs_call_type afs_RXFSInlineBulkStatus
= {
2136 .name
= "FS.InlineBulkStatus",
2137 .op
= afs_FS_InlineBulkStatus
,
2138 .deliver
= afs_deliver_fs_inline_bulk_status
,
2139 .destructor
= afs_flat_call_destructor
,
2143 * Fetch the status information for up to 50 files
2145 int afs_fs_inline_bulk_status(struct afs_fs_cursor
*fc
,
2146 struct afs_net
*net
,
2147 struct afs_fid
*fids
,
2148 struct afs_status_cb
*statuses
,
2149 unsigned int nr_fids
,
2150 struct afs_volsync
*volsync
)
2152 struct afs_call
*call
;
2156 if (test_bit(AFS_SERVER_FL_IS_YFS
, &fc
->cbi
->server
->flags
))
2157 return yfs_fs_inline_bulk_status(fc
, net
, fids
, statuses
,
2160 _enter(",%x,{%llx:%llu},%u",
2161 key_serial(fc
->key
), fids
[0].vid
, fids
[1].vnode
, nr_fids
);
2163 call
= afs_alloc_flat_call(net
, &afs_RXFSInlineBulkStatus
,
2164 (2 + nr_fids
* 3) * 4,
2167 fc
->ac
.error
= -ENOMEM
;
2171 call
->key
= fc
->key
;
2172 call
->out_scb
= statuses
;
2173 call
->out_volsync
= volsync
;
2174 call
->count2
= nr_fids
;
2176 /* marshall the parameters */
2178 *bp
++ = htonl(FSINLINEBULKSTATUS
);
2179 *bp
++ = htonl(nr_fids
);
2180 for (i
= 0; i
< nr_fids
; i
++) {
2181 *bp
++ = htonl(fids
[i
].vid
);
2182 *bp
++ = htonl(fids
[i
].vnode
);
2183 *bp
++ = htonl(fids
[i
].unique
);
2186 afs_use_fs_server(call
, fc
->cbi
);
2187 trace_afs_make_fs_call(call
, &fids
[0]);
2188 afs_set_fc_call(call
, fc
);
2189 afs_make_call(&fc
->ac
, call
, GFP_NOFS
);
2190 return afs_wait_for_call_to_complete(call
, &fc
->ac
);
2194 * deliver reply data to an FS.FetchACL
2196 static int afs_deliver_fs_fetch_acl(struct afs_call
*call
)
2198 struct afs_acl
*acl
;
2203 _enter("{%u}", call
->unmarshall
);
2205 switch (call
->unmarshall
) {
2207 afs_extract_to_tmp(call
);
2211 /* extract the returned data length */
2213 ret
= afs_extract_data(call
, true);
2217 size
= call
->count2
= ntohl(call
->tmp
);
2218 size
= round_up(size
, 4);
2220 acl
= kmalloc(struct_size(acl
, data
, size
), GFP_KERNEL
);
2223 call
->ret_acl
= acl
;
2224 acl
->size
= call
->count2
;
2225 afs_extract_begin(call
, acl
->data
, size
);
2229 /* extract the returned data */
2231 ret
= afs_extract_data(call
, true);
2235 afs_extract_to_buf(call
, (21 + 6) * 4);
2239 /* extract the metadata */
2241 ret
= afs_extract_data(call
, false);
2246 ret
= xdr_decode_AFSFetchStatus(&bp
, call
, call
->out_scb
);
2249 xdr_decode_AFSVolSync(&bp
, call
->out_volsync
);
2257 _leave(" = 0 [done]");
2261 static void afs_destroy_fs_fetch_acl(struct afs_call
*call
)
2263 kfree(call
->ret_acl
);
2264 afs_flat_call_destructor(call
);
2268 * FS.FetchACL operation type
2270 static const struct afs_call_type afs_RXFSFetchACL
= {
2271 .name
= "FS.FetchACL",
2272 .op
= afs_FS_FetchACL
,
2273 .deliver
= afs_deliver_fs_fetch_acl
,
2274 .destructor
= afs_destroy_fs_fetch_acl
,
2278 * Fetch the ACL for a file.
2280 struct afs_acl
*afs_fs_fetch_acl(struct afs_fs_cursor
*fc
,
2281 struct afs_status_cb
*scb
)
2283 struct afs_vnode
*vnode
= fc
->vnode
;
2284 struct afs_call
*call
;
2285 struct afs_net
*net
= afs_v2net(vnode
);
2288 _enter(",%x,{%llx:%llu},,",
2289 key_serial(fc
->key
), vnode
->fid
.vid
, vnode
->fid
.vnode
);
2291 call
= afs_alloc_flat_call(net
, &afs_RXFSFetchACL
, 16, (21 + 6) * 4);
2293 fc
->ac
.error
= -ENOMEM
;
2294 return ERR_PTR(-ENOMEM
);
2297 call
->key
= fc
->key
;
2298 call
->ret_acl
= NULL
;
2299 call
->out_scb
= scb
;
2300 call
->out_volsync
= NULL
;
2302 /* marshall the parameters */
2304 bp
[0] = htonl(FSFETCHACL
);
2305 bp
[1] = htonl(vnode
->fid
.vid
);
2306 bp
[2] = htonl(vnode
->fid
.vnode
);
2307 bp
[3] = htonl(vnode
->fid
.unique
);
2309 afs_use_fs_server(call
, fc
->cbi
);
2310 trace_afs_make_fs_call(call
, &vnode
->fid
);
2311 afs_make_call(&fc
->ac
, call
, GFP_KERNEL
);
2312 return (struct afs_acl
*)afs_wait_for_call_to_complete(call
, &fc
->ac
);
2316 * Deliver reply data to any operation that returns file status and volume
2319 static int afs_deliver_fs_file_status_and_vol(struct afs_call
*call
)
2324 ret
= afs_transfer_reply(call
);
2329 ret
= xdr_decode_AFSFetchStatus(&bp
, call
, call
->out_scb
);
2332 xdr_decode_AFSVolSync(&bp
, call
->out_volsync
);
2334 _leave(" = 0 [done]");
2339 * FS.StoreACL operation type
2341 static const struct afs_call_type afs_RXFSStoreACL
= {
2342 .name
= "FS.StoreACL",
2343 .op
= afs_FS_StoreACL
,
2344 .deliver
= afs_deliver_fs_file_status_and_vol
,
2345 .destructor
= afs_flat_call_destructor
,
2349 * Fetch the ACL for a file.
2351 int afs_fs_store_acl(struct afs_fs_cursor
*fc
, const struct afs_acl
*acl
,
2352 struct afs_status_cb
*scb
)
2354 struct afs_vnode
*vnode
= fc
->vnode
;
2355 struct afs_call
*call
;
2356 struct afs_net
*net
= afs_v2net(vnode
);
2360 _enter(",%x,{%llx:%llu},,",
2361 key_serial(fc
->key
), vnode
->fid
.vid
, vnode
->fid
.vnode
);
2363 size
= round_up(acl
->size
, 4);
2364 call
= afs_alloc_flat_call(net
, &afs_RXFSStoreACL
,
2365 5 * 4 + size
, (21 + 6) * 4);
2367 fc
->ac
.error
= -ENOMEM
;
2371 call
->key
= fc
->key
;
2372 call
->out_scb
= scb
;
2373 call
->out_volsync
= NULL
;
2375 /* marshall the parameters */
2377 bp
[0] = htonl(FSSTOREACL
);
2378 bp
[1] = htonl(vnode
->fid
.vid
);
2379 bp
[2] = htonl(vnode
->fid
.vnode
);
2380 bp
[3] = htonl(vnode
->fid
.unique
);
2381 bp
[4] = htonl(acl
->size
);
2382 memcpy(&bp
[5], acl
->data
, acl
->size
);
2383 if (acl
->size
!= size
)
2384 memset((void *)&bp
[5] + acl
->size
, 0, size
- acl
->size
);
2386 trace_afs_make_fs_call(call
, &vnode
->fid
);
2387 afs_make_call(&fc
->ac
, call
, GFP_KERNEL
);
2388 return afs_wait_for_call_to_complete(call
, &fc
->ac
);