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
;
69 abort_code
= ntohl(xdr
->abort_code
);
71 if (xdr
->if_version
!= htonl(AFS_FSTATUS_VERSION
)) {
72 if (xdr
->if_version
== htonl(0) &&
75 /* The OpenAFS fileserver has a bug in FS.InlineBulkStatus
76 * whereby it doesn't set the interface version in the error
79 status
->abort_code
= abort_code
;
80 scb
->have_error
= true;
84 pr_warn("Unknown AFSFetchStatus version %u\n", ntohl(xdr
->if_version
));
88 if (abort_code
!= 0 && inline_error
) {
89 status
->abort_code
= abort_code
;
93 type
= ntohl(xdr
->type
);
97 case AFS_FTYPE_SYMLINK
:
104 status
->nlink
= ntohl(xdr
->nlink
);
105 status
->author
= ntohl(xdr
->author
);
106 status
->owner
= ntohl(xdr
->owner
);
107 status
->caller_access
= ntohl(xdr
->caller_access
); /* Ticket dependent */
108 status
->anon_access
= ntohl(xdr
->anon_access
);
109 status
->mode
= ntohl(xdr
->mode
) & S_IALLUGO
;
110 status
->group
= ntohl(xdr
->group
);
111 status
->lock_count
= ntohl(xdr
->lock_count
);
113 status
->mtime_client
.tv_sec
= ntohl(xdr
->mtime_client
);
114 status
->mtime_client
.tv_nsec
= 0;
115 status
->mtime_server
.tv_sec
= ntohl(xdr
->mtime_server
);
116 status
->mtime_server
.tv_nsec
= 0;
118 size
= (u64
)ntohl(xdr
->size_lo
);
119 size
|= (u64
)ntohl(xdr
->size_hi
) << 32;
122 data_version
= (u64
)ntohl(xdr
->data_version_lo
);
123 data_version
|= (u64
)ntohl(xdr
->data_version_hi
) << 32;
124 status
->data_version
= data_version
;
125 scb
->have_status
= true;
127 *_bp
= (const void *)*_bp
+ sizeof(*xdr
);
132 return afs_protocol_error(call
, -EBADMSG
, afs_eproto_bad_status
);
135 static time64_t
xdr_decode_expiry(struct afs_call
*call
, u32 expiry
)
137 return ktime_divns(call
->reply_time
, NSEC_PER_SEC
) + expiry
;
140 static void xdr_decode_AFSCallBack(const __be32
**_bp
,
141 struct afs_call
*call
,
142 struct afs_status_cb
*scb
)
144 struct afs_callback
*cb
= &scb
->callback
;
145 const __be32
*bp
= *_bp
;
148 cb
->expires_at
= xdr_decode_expiry(call
, ntohl(*bp
++));
155 * decode an AFSVolSync block
157 static void xdr_decode_AFSVolSync(const __be32
**_bp
,
158 struct afs_volsync
*volsync
)
160 const __be32
*bp
= *_bp
;
163 creation
= ntohl(*bp
++);
172 volsync
->creation
= creation
;
176 * encode the requested attributes into an AFSStoreStatus block
178 static void xdr_encode_AFS_StoreStatus(__be32
**_bp
, struct iattr
*attr
)
181 u32 mask
= 0, mtime
= 0, owner
= 0, group
= 0, mode
= 0;
184 if (attr
->ia_valid
& ATTR_MTIME
) {
185 mask
|= AFS_SET_MTIME
;
186 mtime
= attr
->ia_mtime
.tv_sec
;
189 if (attr
->ia_valid
& ATTR_UID
) {
190 mask
|= AFS_SET_OWNER
;
191 owner
= from_kuid(&init_user_ns
, attr
->ia_uid
);
194 if (attr
->ia_valid
& ATTR_GID
) {
195 mask
|= AFS_SET_GROUP
;
196 group
= from_kgid(&init_user_ns
, attr
->ia_gid
);
199 if (attr
->ia_valid
& ATTR_MODE
) {
200 mask
|= AFS_SET_MODE
;
201 mode
= attr
->ia_mode
& S_IALLUGO
;
205 *bp
++ = htonl(mtime
);
206 *bp
++ = htonl(owner
);
207 *bp
++ = htonl(group
);
209 *bp
++ = 0; /* segment size */
214 * decode an AFSFetchVolumeStatus block
216 static void xdr_decode_AFSFetchVolumeStatus(const __be32
**_bp
,
217 struct afs_volume_status
*vs
)
219 const __be32
*bp
= *_bp
;
221 vs
->vid
= ntohl(*bp
++);
222 vs
->parent_id
= ntohl(*bp
++);
223 vs
->online
= ntohl(*bp
++);
224 vs
->in_service
= ntohl(*bp
++);
225 vs
->blessed
= ntohl(*bp
++);
226 vs
->needs_salvage
= ntohl(*bp
++);
227 vs
->type
= ntohl(*bp
++);
228 vs
->min_quota
= ntohl(*bp
++);
229 vs
->max_quota
= ntohl(*bp
++);
230 vs
->blocks_in_use
= ntohl(*bp
++);
231 vs
->part_blocks_avail
= ntohl(*bp
++);
232 vs
->part_max_blocks
= ntohl(*bp
++);
233 vs
->vol_copy_date
= 0;
234 vs
->vol_backup_date
= 0;
239 * deliver reply data to an FS.FetchStatus
241 static int afs_deliver_fs_fetch_status_vnode(struct afs_call
*call
)
246 ret
= afs_transfer_reply(call
);
250 /* unmarshall the reply once we've received all of it */
252 ret
= xdr_decode_AFSFetchStatus(&bp
, call
, call
->out_scb
);
255 xdr_decode_AFSCallBack(&bp
, call
, call
->out_scb
);
256 xdr_decode_AFSVolSync(&bp
, call
->out_volsync
);
258 _leave(" = 0 [done]");
263 * FS.FetchStatus operation type
265 static const struct afs_call_type afs_RXFSFetchStatus_vnode
= {
266 .name
= "FS.FetchStatus(vnode)",
267 .op
= afs_FS_FetchStatus
,
268 .deliver
= afs_deliver_fs_fetch_status_vnode
,
269 .destructor
= afs_flat_call_destructor
,
273 * fetch the status information for a file
275 int afs_fs_fetch_file_status(struct afs_fs_cursor
*fc
, struct afs_status_cb
*scb
,
276 struct afs_volsync
*volsync
)
278 struct afs_vnode
*vnode
= fc
->vnode
;
279 struct afs_call
*call
;
280 struct afs_net
*net
= afs_v2net(vnode
);
283 if (test_bit(AFS_SERVER_FL_IS_YFS
, &fc
->cbi
->server
->flags
))
284 return yfs_fs_fetch_file_status(fc
, scb
, volsync
);
286 _enter(",%x,{%llx:%llu},,",
287 key_serial(fc
->key
), vnode
->fid
.vid
, vnode
->fid
.vnode
);
289 call
= afs_alloc_flat_call(net
, &afs_RXFSFetchStatus_vnode
,
290 16, (21 + 3 + 6) * 4);
292 fc
->ac
.error
= -ENOMEM
;
298 call
->out_volsync
= volsync
;
300 /* marshall the parameters */
302 bp
[0] = htonl(FSFETCHSTATUS
);
303 bp
[1] = htonl(vnode
->fid
.vid
);
304 bp
[2] = htonl(vnode
->fid
.vnode
);
305 bp
[3] = htonl(vnode
->fid
.unique
);
307 afs_use_fs_server(call
, fc
->cbi
);
308 trace_afs_make_fs_call(call
, &vnode
->fid
);
310 afs_set_fc_call(call
, fc
);
311 afs_make_call(&fc
->ac
, call
, GFP_NOFS
);
312 return afs_wait_for_call_to_complete(call
, &fc
->ac
);
316 * deliver reply data to an FS.FetchData
318 static int afs_deliver_fs_fetch_data(struct afs_call
*call
)
320 struct afs_read
*req
= call
->read_request
;
325 _enter("{%u,%zu/%llu}",
326 call
->unmarshall
, iov_iter_count(call
->iter
), req
->actual_len
);
328 switch (call
->unmarshall
) {
332 req
->offset
= req
->pos
& (PAGE_SIZE
- 1);
334 if (call
->operation_ID
== FSFETCHDATA64
) {
335 afs_extract_to_tmp64(call
);
337 call
->tmp_u
= htonl(0);
338 afs_extract_to_tmp(call
);
342 /* extract the returned data length */
344 _debug("extract data length");
345 ret
= afs_extract_data(call
, true);
349 req
->actual_len
= be64_to_cpu(call
->tmp64
);
350 _debug("DATA length: %llu", req
->actual_len
);
351 req
->remain
= min(req
->len
, req
->actual_len
);
352 if (req
->remain
== 0)
358 ASSERTCMP(req
->index
, <, req
->nr_pages
);
359 if (req
->remain
> PAGE_SIZE
- req
->offset
)
360 size
= PAGE_SIZE
- req
->offset
;
363 call
->bvec
[0].bv_len
= size
;
364 call
->bvec
[0].bv_offset
= req
->offset
;
365 call
->bvec
[0].bv_page
= req
->pages
[req
->index
];
366 iov_iter_bvec(&call
->def_iter
, READ
, call
->bvec
, 1, size
);
367 ASSERTCMP(size
, <=, PAGE_SIZE
);
370 /* extract the returned data */
372 _debug("extract data %zu/%llu",
373 iov_iter_count(call
->iter
), req
->remain
);
375 ret
= afs_extract_data(call
, true);
378 req
->remain
-= call
->bvec
[0].bv_len
;
379 req
->offset
+= call
->bvec
[0].bv_len
;
380 ASSERTCMP(req
->offset
, <=, PAGE_SIZE
);
381 if (req
->offset
== PAGE_SIZE
) {
390 ASSERTCMP(req
->remain
, ==, 0);
391 if (req
->actual_len
<= req
->len
)
394 /* Discard any excess data the server gave us */
395 afs_extract_discard(call
, req
->actual_len
- req
->len
);
396 call
->unmarshall
= 3;
400 _debug("extract discard %zu/%llu",
401 iov_iter_count(call
->iter
), req
->actual_len
- req
->len
);
403 ret
= afs_extract_data(call
, true);
408 call
->unmarshall
= 4;
409 afs_extract_to_buf(call
, (21 + 3 + 6) * 4);
412 /* extract the metadata */
414 ret
= afs_extract_data(call
, false);
419 ret
= xdr_decode_AFSFetchStatus(&bp
, call
, call
->out_scb
);
422 xdr_decode_AFSCallBack(&bp
, call
, call
->out_scb
);
423 xdr_decode_AFSVolSync(&bp
, call
->out_volsync
);
425 req
->data_version
= call
->out_scb
->status
.data_version
;
426 req
->file_size
= call
->out_scb
->status
.size
;
434 for (; req
->index
< req
->nr_pages
; req
->index
++) {
435 if (req
->offset
< PAGE_SIZE
)
436 zero_user_segment(req
->pages
[req
->index
],
437 req
->offset
, PAGE_SIZE
);
443 _leave(" = 0 [done]");
447 static void afs_fetch_data_destructor(struct afs_call
*call
)
449 struct afs_read
*req
= call
->read_request
;
452 afs_flat_call_destructor(call
);
456 * FS.FetchData operation type
458 static const struct afs_call_type afs_RXFSFetchData
= {
459 .name
= "FS.FetchData",
460 .op
= afs_FS_FetchData
,
461 .deliver
= afs_deliver_fs_fetch_data
,
462 .destructor
= afs_fetch_data_destructor
,
465 static const struct afs_call_type afs_RXFSFetchData64
= {
466 .name
= "FS.FetchData64",
467 .op
= afs_FS_FetchData64
,
468 .deliver
= afs_deliver_fs_fetch_data
,
469 .destructor
= afs_fetch_data_destructor
,
473 * fetch data from a very large file
475 static int afs_fs_fetch_data64(struct afs_fs_cursor
*fc
,
476 struct afs_status_cb
*scb
,
477 struct afs_read
*req
)
479 struct afs_vnode
*vnode
= fc
->vnode
;
480 struct afs_call
*call
;
481 struct afs_net
*net
= afs_v2net(vnode
);
486 call
= afs_alloc_flat_call(net
, &afs_RXFSFetchData64
, 32, (21 + 3 + 6) * 4);
492 call
->out_volsync
= NULL
;
493 call
->read_request
= afs_get_read(req
);
495 /* marshall the parameters */
497 bp
[0] = htonl(FSFETCHDATA64
);
498 bp
[1] = htonl(vnode
->fid
.vid
);
499 bp
[2] = htonl(vnode
->fid
.vnode
);
500 bp
[3] = htonl(vnode
->fid
.unique
);
501 bp
[4] = htonl(upper_32_bits(req
->pos
));
502 bp
[5] = htonl(lower_32_bits(req
->pos
));
504 bp
[7] = htonl(lower_32_bits(req
->len
));
506 afs_use_fs_server(call
, fc
->cbi
);
507 trace_afs_make_fs_call(call
, &vnode
->fid
);
508 afs_set_fc_call(call
, fc
);
509 afs_make_call(&fc
->ac
, call
, GFP_NOFS
);
510 return afs_wait_for_call_to_complete(call
, &fc
->ac
);
514 * fetch data from a file
516 int afs_fs_fetch_data(struct afs_fs_cursor
*fc
,
517 struct afs_status_cb
*scb
,
518 struct afs_read
*req
)
520 struct afs_vnode
*vnode
= fc
->vnode
;
521 struct afs_call
*call
;
522 struct afs_net
*net
= afs_v2net(vnode
);
525 if (test_bit(AFS_SERVER_FL_IS_YFS
, &fc
->cbi
->server
->flags
))
526 return yfs_fs_fetch_data(fc
, scb
, req
);
528 if (upper_32_bits(req
->pos
) ||
529 upper_32_bits(req
->len
) ||
530 upper_32_bits(req
->pos
+ req
->len
))
531 return afs_fs_fetch_data64(fc
, scb
, req
);
535 call
= afs_alloc_flat_call(net
, &afs_RXFSFetchData
, 24, (21 + 3 + 6) * 4);
541 call
->out_volsync
= NULL
;
542 call
->read_request
= afs_get_read(req
);
544 /* marshall the parameters */
546 bp
[0] = htonl(FSFETCHDATA
);
547 bp
[1] = htonl(vnode
->fid
.vid
);
548 bp
[2] = htonl(vnode
->fid
.vnode
);
549 bp
[3] = htonl(vnode
->fid
.unique
);
550 bp
[4] = htonl(lower_32_bits(req
->pos
));
551 bp
[5] = htonl(lower_32_bits(req
->len
));
553 afs_use_fs_server(call
, fc
->cbi
);
554 trace_afs_make_fs_call(call
, &vnode
->fid
);
555 afs_set_fc_call(call
, fc
);
556 afs_make_call(&fc
->ac
, call
, GFP_NOFS
);
557 return afs_wait_for_call_to_complete(call
, &fc
->ac
);
561 * deliver reply data to an FS.CreateFile or an FS.MakeDir
563 static int afs_deliver_fs_create_vnode(struct afs_call
*call
)
568 ret
= afs_transfer_reply(call
);
572 /* unmarshall the reply once we've received all of it */
574 xdr_decode_AFSFid(&bp
, call
->out_fid
);
575 ret
= xdr_decode_AFSFetchStatus(&bp
, call
, call
->out_scb
);
578 ret
= xdr_decode_AFSFetchStatus(&bp
, call
, call
->out_dir_scb
);
581 xdr_decode_AFSCallBack(&bp
, call
, call
->out_scb
);
582 xdr_decode_AFSVolSync(&bp
, call
->out_volsync
);
584 _leave(" = 0 [done]");
589 * FS.CreateFile and FS.MakeDir operation type
591 static const struct afs_call_type afs_RXFSCreateFile
= {
592 .name
= "FS.CreateFile",
593 .op
= afs_FS_CreateFile
,
594 .deliver
= afs_deliver_fs_create_vnode
,
595 .destructor
= afs_flat_call_destructor
,
598 static const struct afs_call_type afs_RXFSMakeDir
= {
599 .name
= "FS.MakeDir",
600 .op
= afs_FS_MakeDir
,
601 .deliver
= afs_deliver_fs_create_vnode
,
602 .destructor
= afs_flat_call_destructor
,
606 * create a file or make a directory
608 int afs_fs_create(struct afs_fs_cursor
*fc
,
611 struct afs_status_cb
*dvnode_scb
,
612 struct afs_fid
*newfid
,
613 struct afs_status_cb
*new_scb
)
615 struct afs_vnode
*dvnode
= fc
->vnode
;
616 struct afs_call
*call
;
617 struct afs_net
*net
= afs_v2net(dvnode
);
618 size_t namesz
, reqsz
, padsz
;
621 if (test_bit(AFS_SERVER_FL_IS_YFS
, &fc
->cbi
->server
->flags
)){
623 return yfs_fs_make_dir(fc
, name
, mode
, dvnode_scb
,
626 return yfs_fs_create_file(fc
, name
, mode
, dvnode_scb
,
632 namesz
= strlen(name
);
633 padsz
= (4 - (namesz
& 3)) & 3;
634 reqsz
= (5 * 4) + namesz
+ padsz
+ (6 * 4);
636 call
= afs_alloc_flat_call(
637 net
, S_ISDIR(mode
) ? &afs_RXFSMakeDir
: &afs_RXFSCreateFile
,
638 reqsz
, (3 + 21 + 21 + 3 + 6) * 4);
643 call
->out_dir_scb
= dvnode_scb
;
644 call
->out_fid
= newfid
;
645 call
->out_scb
= new_scb
;
647 /* marshall the parameters */
649 *bp
++ = htonl(S_ISDIR(mode
) ? FSMAKEDIR
: FSCREATEFILE
);
650 *bp
++ = htonl(dvnode
->fid
.vid
);
651 *bp
++ = htonl(dvnode
->fid
.vnode
);
652 *bp
++ = htonl(dvnode
->fid
.unique
);
653 *bp
++ = htonl(namesz
);
654 memcpy(bp
, name
, namesz
);
655 bp
= (void *) bp
+ namesz
;
657 memset(bp
, 0, padsz
);
658 bp
= (void *) bp
+ padsz
;
660 *bp
++ = htonl(AFS_SET_MODE
| AFS_SET_MTIME
);
661 *bp
++ = htonl(dvnode
->vfs_inode
.i_mtime
.tv_sec
); /* mtime */
662 *bp
++ = 0; /* owner */
663 *bp
++ = 0; /* group */
664 *bp
++ = htonl(mode
& S_IALLUGO
); /* unix mode */
665 *bp
++ = 0; /* segment size */
667 afs_use_fs_server(call
, fc
->cbi
);
668 trace_afs_make_fs_call1(call
, &dvnode
->fid
, name
);
669 afs_set_fc_call(call
, fc
);
670 afs_make_call(&fc
->ac
, call
, GFP_NOFS
);
671 return afs_wait_for_call_to_complete(call
, &fc
->ac
);
675 * Deliver reply data to any operation that returns directory status and volume
678 static int afs_deliver_fs_dir_status_and_vol(struct afs_call
*call
)
683 ret
= afs_transfer_reply(call
);
687 /* unmarshall the reply once we've received all of it */
689 ret
= xdr_decode_AFSFetchStatus(&bp
, call
, call
->out_dir_scb
);
692 xdr_decode_AFSVolSync(&bp
, call
->out_volsync
);
694 _leave(" = 0 [done]");
699 * FS.RemoveDir/FS.RemoveFile operation type
701 static const struct afs_call_type afs_RXFSRemoveFile
= {
702 .name
= "FS.RemoveFile",
703 .op
= afs_FS_RemoveFile
,
704 .deliver
= afs_deliver_fs_dir_status_and_vol
,
705 .destructor
= afs_flat_call_destructor
,
708 static const struct afs_call_type afs_RXFSRemoveDir
= {
709 .name
= "FS.RemoveDir",
710 .op
= afs_FS_RemoveDir
,
711 .deliver
= afs_deliver_fs_dir_status_and_vol
,
712 .destructor
= afs_flat_call_destructor
,
716 * remove a file or directory
718 int afs_fs_remove(struct afs_fs_cursor
*fc
, struct afs_vnode
*vnode
,
719 const char *name
, bool isdir
, struct afs_status_cb
*dvnode_scb
)
721 struct afs_vnode
*dvnode
= fc
->vnode
;
722 struct afs_call
*call
;
723 struct afs_net
*net
= afs_v2net(dvnode
);
724 size_t namesz
, reqsz
, padsz
;
727 if (test_bit(AFS_SERVER_FL_IS_YFS
, &fc
->cbi
->server
->flags
))
728 return yfs_fs_remove(fc
, vnode
, name
, isdir
, dvnode_scb
);
732 namesz
= strlen(name
);
733 padsz
= (4 - (namesz
& 3)) & 3;
734 reqsz
= (5 * 4) + namesz
+ padsz
;
736 call
= afs_alloc_flat_call(
737 net
, isdir
? &afs_RXFSRemoveDir
: &afs_RXFSRemoveFile
,
738 reqsz
, (21 + 6) * 4);
743 call
->out_dir_scb
= dvnode_scb
;
745 /* marshall the parameters */
747 *bp
++ = htonl(isdir
? FSREMOVEDIR
: FSREMOVEFILE
);
748 *bp
++ = htonl(dvnode
->fid
.vid
);
749 *bp
++ = htonl(dvnode
->fid
.vnode
);
750 *bp
++ = htonl(dvnode
->fid
.unique
);
751 *bp
++ = htonl(namesz
);
752 memcpy(bp
, name
, namesz
);
753 bp
= (void *) bp
+ namesz
;
755 memset(bp
, 0, padsz
);
756 bp
= (void *) bp
+ padsz
;
759 afs_use_fs_server(call
, fc
->cbi
);
760 trace_afs_make_fs_call1(call
, &dvnode
->fid
, name
);
761 afs_set_fc_call(call
, fc
);
762 afs_make_call(&fc
->ac
, call
, GFP_NOFS
);
763 return afs_wait_for_call_to_complete(call
, &fc
->ac
);
767 * deliver reply data to an FS.Link
769 static int afs_deliver_fs_link(struct afs_call
*call
)
774 _enter("{%u}", call
->unmarshall
);
776 ret
= afs_transfer_reply(call
);
780 /* unmarshall the reply once we've received all of it */
782 ret
= xdr_decode_AFSFetchStatus(&bp
, call
, call
->out_scb
);
785 ret
= xdr_decode_AFSFetchStatus(&bp
, call
, call
->out_dir_scb
);
788 xdr_decode_AFSVolSync(&bp
, call
->out_volsync
);
790 _leave(" = 0 [done]");
795 * FS.Link operation type
797 static const struct afs_call_type afs_RXFSLink
= {
800 .deliver
= afs_deliver_fs_link
,
801 .destructor
= afs_flat_call_destructor
,
807 int afs_fs_link(struct afs_fs_cursor
*fc
, struct afs_vnode
*vnode
,
809 struct afs_status_cb
*dvnode_scb
,
810 struct afs_status_cb
*vnode_scb
)
812 struct afs_vnode
*dvnode
= fc
->vnode
;
813 struct afs_call
*call
;
814 struct afs_net
*net
= afs_v2net(vnode
);
815 size_t namesz
, reqsz
, padsz
;
818 if (test_bit(AFS_SERVER_FL_IS_YFS
, &fc
->cbi
->server
->flags
))
819 return yfs_fs_link(fc
, vnode
, name
, dvnode_scb
, vnode_scb
);
823 namesz
= strlen(name
);
824 padsz
= (4 - (namesz
& 3)) & 3;
825 reqsz
= (5 * 4) + namesz
+ padsz
+ (3 * 4);
827 call
= afs_alloc_flat_call(net
, &afs_RXFSLink
, reqsz
, (21 + 21 + 6) * 4);
832 call
->out_dir_scb
= dvnode_scb
;
833 call
->out_scb
= vnode_scb
;
835 /* marshall the parameters */
837 *bp
++ = htonl(FSLINK
);
838 *bp
++ = htonl(dvnode
->fid
.vid
);
839 *bp
++ = htonl(dvnode
->fid
.vnode
);
840 *bp
++ = htonl(dvnode
->fid
.unique
);
841 *bp
++ = htonl(namesz
);
842 memcpy(bp
, name
, namesz
);
843 bp
= (void *) bp
+ namesz
;
845 memset(bp
, 0, padsz
);
846 bp
= (void *) bp
+ padsz
;
848 *bp
++ = htonl(vnode
->fid
.vid
);
849 *bp
++ = htonl(vnode
->fid
.vnode
);
850 *bp
++ = htonl(vnode
->fid
.unique
);
852 afs_use_fs_server(call
, fc
->cbi
);
853 trace_afs_make_fs_call1(call
, &vnode
->fid
, name
);
854 afs_set_fc_call(call
, fc
);
855 afs_make_call(&fc
->ac
, call
, GFP_NOFS
);
856 return afs_wait_for_call_to_complete(call
, &fc
->ac
);
860 * deliver reply data to an FS.Symlink
862 static int afs_deliver_fs_symlink(struct afs_call
*call
)
867 _enter("{%u}", call
->unmarshall
);
869 ret
= afs_transfer_reply(call
);
873 /* unmarshall the reply once we've received all of it */
875 xdr_decode_AFSFid(&bp
, call
->out_fid
);
876 ret
= xdr_decode_AFSFetchStatus(&bp
, call
, call
->out_scb
);
879 ret
= xdr_decode_AFSFetchStatus(&bp
, call
, call
->out_dir_scb
);
882 xdr_decode_AFSVolSync(&bp
, call
->out_volsync
);
884 _leave(" = 0 [done]");
889 * FS.Symlink operation type
891 static const struct afs_call_type afs_RXFSSymlink
= {
892 .name
= "FS.Symlink",
893 .op
= afs_FS_Symlink
,
894 .deliver
= afs_deliver_fs_symlink
,
895 .destructor
= afs_flat_call_destructor
,
899 * create a symbolic link
901 int afs_fs_symlink(struct afs_fs_cursor
*fc
,
903 const char *contents
,
904 struct afs_status_cb
*dvnode_scb
,
905 struct afs_fid
*newfid
,
906 struct afs_status_cb
*new_scb
)
908 struct afs_vnode
*dvnode
= fc
->vnode
;
909 struct afs_call
*call
;
910 struct afs_net
*net
= afs_v2net(dvnode
);
911 size_t namesz
, reqsz
, padsz
, c_namesz
, c_padsz
;
914 if (test_bit(AFS_SERVER_FL_IS_YFS
, &fc
->cbi
->server
->flags
))
915 return yfs_fs_symlink(fc
, name
, contents
, dvnode_scb
,
920 namesz
= strlen(name
);
921 padsz
= (4 - (namesz
& 3)) & 3;
923 c_namesz
= strlen(contents
);
924 c_padsz
= (4 - (c_namesz
& 3)) & 3;
926 reqsz
= (6 * 4) + namesz
+ padsz
+ c_namesz
+ c_padsz
+ (6 * 4);
928 call
= afs_alloc_flat_call(net
, &afs_RXFSSymlink
, reqsz
,
929 (3 + 21 + 21 + 6) * 4);
934 call
->out_dir_scb
= dvnode_scb
;
935 call
->out_fid
= newfid
;
936 call
->out_scb
= new_scb
;
938 /* marshall the parameters */
940 *bp
++ = htonl(FSSYMLINK
);
941 *bp
++ = htonl(dvnode
->fid
.vid
);
942 *bp
++ = htonl(dvnode
->fid
.vnode
);
943 *bp
++ = htonl(dvnode
->fid
.unique
);
944 *bp
++ = htonl(namesz
);
945 memcpy(bp
, name
, namesz
);
946 bp
= (void *) bp
+ namesz
;
948 memset(bp
, 0, padsz
);
949 bp
= (void *) bp
+ padsz
;
951 *bp
++ = htonl(c_namesz
);
952 memcpy(bp
, contents
, c_namesz
);
953 bp
= (void *) bp
+ c_namesz
;
955 memset(bp
, 0, c_padsz
);
956 bp
= (void *) bp
+ c_padsz
;
958 *bp
++ = htonl(AFS_SET_MODE
| AFS_SET_MTIME
);
959 *bp
++ = htonl(dvnode
->vfs_inode
.i_mtime
.tv_sec
); /* mtime */
960 *bp
++ = 0; /* owner */
961 *bp
++ = 0; /* group */
962 *bp
++ = htonl(S_IRWXUGO
); /* unix mode */
963 *bp
++ = 0; /* segment size */
965 afs_use_fs_server(call
, fc
->cbi
);
966 trace_afs_make_fs_call1(call
, &dvnode
->fid
, name
);
967 afs_set_fc_call(call
, fc
);
968 afs_make_call(&fc
->ac
, call
, GFP_NOFS
);
969 return afs_wait_for_call_to_complete(call
, &fc
->ac
);
973 * deliver reply data to an FS.Rename
975 static int afs_deliver_fs_rename(struct afs_call
*call
)
980 ret
= afs_transfer_reply(call
);
984 /* unmarshall the reply once we've received all of it */
986 ret
= xdr_decode_AFSFetchStatus(&bp
, call
, call
->out_dir_scb
);
989 if (call
->out_dir_scb
!= call
->out_scb
) {
990 ret
= xdr_decode_AFSFetchStatus(&bp
, call
, call
->out_scb
);
994 xdr_decode_AFSVolSync(&bp
, call
->out_volsync
);
996 _leave(" = 0 [done]");
1001 * FS.Rename operation type
1003 static const struct afs_call_type afs_RXFSRename
= {
1004 .name
= "FS.Rename",
1005 .op
= afs_FS_Rename
,
1006 .deliver
= afs_deliver_fs_rename
,
1007 .destructor
= afs_flat_call_destructor
,
1011 * Rename/move a file or directory.
1013 int afs_fs_rename(struct afs_fs_cursor
*fc
,
1014 const char *orig_name
,
1015 struct afs_vnode
*new_dvnode
,
1016 const char *new_name
,
1017 struct afs_status_cb
*orig_dvnode_scb
,
1018 struct afs_status_cb
*new_dvnode_scb
)
1020 struct afs_vnode
*orig_dvnode
= fc
->vnode
;
1021 struct afs_call
*call
;
1022 struct afs_net
*net
= afs_v2net(orig_dvnode
);
1023 size_t reqsz
, o_namesz
, o_padsz
, n_namesz
, n_padsz
;
1026 if (test_bit(AFS_SERVER_FL_IS_YFS
, &fc
->cbi
->server
->flags
))
1027 return yfs_fs_rename(fc
, orig_name
,
1028 new_dvnode
, new_name
,
1034 o_namesz
= strlen(orig_name
);
1035 o_padsz
= (4 - (o_namesz
& 3)) & 3;
1037 n_namesz
= strlen(new_name
);
1038 n_padsz
= (4 - (n_namesz
& 3)) & 3;
1041 4 + o_namesz
+ o_padsz
+
1043 4 + n_namesz
+ n_padsz
;
1045 call
= afs_alloc_flat_call(net
, &afs_RXFSRename
, reqsz
, (21 + 21 + 6) * 4);
1049 call
->key
= fc
->key
;
1050 call
->out_dir_scb
= orig_dvnode_scb
;
1051 call
->out_scb
= new_dvnode_scb
;
1053 /* marshall the parameters */
1055 *bp
++ = htonl(FSRENAME
);
1056 *bp
++ = htonl(orig_dvnode
->fid
.vid
);
1057 *bp
++ = htonl(orig_dvnode
->fid
.vnode
);
1058 *bp
++ = htonl(orig_dvnode
->fid
.unique
);
1059 *bp
++ = htonl(o_namesz
);
1060 memcpy(bp
, orig_name
, o_namesz
);
1061 bp
= (void *) bp
+ o_namesz
;
1063 memset(bp
, 0, o_padsz
);
1064 bp
= (void *) bp
+ o_padsz
;
1067 *bp
++ = htonl(new_dvnode
->fid
.vid
);
1068 *bp
++ = htonl(new_dvnode
->fid
.vnode
);
1069 *bp
++ = htonl(new_dvnode
->fid
.unique
);
1070 *bp
++ = htonl(n_namesz
);
1071 memcpy(bp
, new_name
, n_namesz
);
1072 bp
= (void *) bp
+ n_namesz
;
1074 memset(bp
, 0, n_padsz
);
1075 bp
= (void *) bp
+ n_padsz
;
1078 afs_use_fs_server(call
, fc
->cbi
);
1079 trace_afs_make_fs_call2(call
, &orig_dvnode
->fid
, orig_name
, new_name
);
1080 afs_set_fc_call(call
, fc
);
1081 afs_make_call(&fc
->ac
, call
, GFP_NOFS
);
1082 return afs_wait_for_call_to_complete(call
, &fc
->ac
);
1086 * deliver reply data to an FS.StoreData
1088 static int afs_deliver_fs_store_data(struct afs_call
*call
)
1095 ret
= afs_transfer_reply(call
);
1099 /* unmarshall the reply once we've received all of it */
1101 ret
= xdr_decode_AFSFetchStatus(&bp
, call
, call
->out_scb
);
1104 xdr_decode_AFSVolSync(&bp
, call
->out_volsync
);
1106 _leave(" = 0 [done]");
1111 * FS.StoreData operation type
1113 static const struct afs_call_type afs_RXFSStoreData
= {
1114 .name
= "FS.StoreData",
1115 .op
= afs_FS_StoreData
,
1116 .deliver
= afs_deliver_fs_store_data
,
1117 .destructor
= afs_flat_call_destructor
,
1120 static const struct afs_call_type afs_RXFSStoreData64
= {
1121 .name
= "FS.StoreData64",
1122 .op
= afs_FS_StoreData64
,
1123 .deliver
= afs_deliver_fs_store_data
,
1124 .destructor
= afs_flat_call_destructor
,
1128 * store a set of pages to a very large file
1130 static int afs_fs_store_data64(struct afs_fs_cursor
*fc
,
1131 struct address_space
*mapping
,
1132 pgoff_t first
, pgoff_t last
,
1133 unsigned offset
, unsigned to
,
1134 loff_t size
, loff_t pos
, loff_t i_size
,
1135 struct afs_status_cb
*scb
)
1137 struct afs_vnode
*vnode
= fc
->vnode
;
1138 struct afs_call
*call
;
1139 struct afs_net
*net
= afs_v2net(vnode
);
1142 _enter(",%x,{%llx:%llu},,",
1143 key_serial(fc
->key
), vnode
->fid
.vid
, vnode
->fid
.vnode
);
1145 call
= afs_alloc_flat_call(net
, &afs_RXFSStoreData64
,
1146 (4 + 6 + 3 * 2) * 4,
1151 call
->key
= fc
->key
;
1152 call
->mapping
= mapping
;
1153 call
->first
= first
;
1155 call
->first_offset
= offset
;
1157 call
->send_pages
= true;
1158 call
->out_scb
= scb
;
1160 /* marshall the parameters */
1162 *bp
++ = htonl(FSSTOREDATA64
);
1163 *bp
++ = htonl(vnode
->fid
.vid
);
1164 *bp
++ = htonl(vnode
->fid
.vnode
);
1165 *bp
++ = htonl(vnode
->fid
.unique
);
1167 *bp
++ = htonl(AFS_SET_MTIME
); /* mask */
1168 *bp
++ = htonl(vnode
->vfs_inode
.i_mtime
.tv_sec
); /* mtime */
1169 *bp
++ = 0; /* owner */
1170 *bp
++ = 0; /* group */
1171 *bp
++ = 0; /* unix mode */
1172 *bp
++ = 0; /* segment size */
1174 *bp
++ = htonl(pos
>> 32);
1175 *bp
++ = htonl((u32
) pos
);
1176 *bp
++ = htonl(size
>> 32);
1177 *bp
++ = htonl((u32
) size
);
1178 *bp
++ = htonl(i_size
>> 32);
1179 *bp
++ = htonl((u32
) i_size
);
1181 trace_afs_make_fs_call(call
, &vnode
->fid
);
1182 afs_set_fc_call(call
, fc
);
1183 afs_make_call(&fc
->ac
, call
, GFP_NOFS
);
1184 return afs_wait_for_call_to_complete(call
, &fc
->ac
);
1188 * store a set of pages
1190 int afs_fs_store_data(struct afs_fs_cursor
*fc
, struct address_space
*mapping
,
1191 pgoff_t first
, pgoff_t last
,
1192 unsigned offset
, unsigned to
,
1193 struct afs_status_cb
*scb
)
1195 struct afs_vnode
*vnode
= fc
->vnode
;
1196 struct afs_call
*call
;
1197 struct afs_net
*net
= afs_v2net(vnode
);
1198 loff_t size
, pos
, i_size
;
1201 if (test_bit(AFS_SERVER_FL_IS_YFS
, &fc
->cbi
->server
->flags
))
1202 return yfs_fs_store_data(fc
, mapping
, first
, last
, offset
, to
, scb
);
1204 _enter(",%x,{%llx:%llu},,",
1205 key_serial(fc
->key
), vnode
->fid
.vid
, vnode
->fid
.vnode
);
1207 size
= (loff_t
)to
- (loff_t
)offset
;
1209 size
+= (loff_t
)(last
- first
) << PAGE_SHIFT
;
1210 pos
= (loff_t
)first
<< PAGE_SHIFT
;
1213 i_size
= i_size_read(&vnode
->vfs_inode
);
1214 if (pos
+ size
> i_size
)
1215 i_size
= size
+ pos
;
1217 _debug("size %llx, at %llx, i_size %llx",
1218 (unsigned long long) size
, (unsigned long long) pos
,
1219 (unsigned long long) i_size
);
1221 if (pos
>> 32 || i_size
>> 32 || size
>> 32 || (pos
+ size
) >> 32)
1222 return afs_fs_store_data64(fc
, mapping
, first
, last
, offset
, to
,
1223 size
, pos
, i_size
, scb
);
1225 call
= afs_alloc_flat_call(net
, &afs_RXFSStoreData
,
1231 call
->key
= fc
->key
;
1232 call
->mapping
= mapping
;
1233 call
->first
= first
;
1235 call
->first_offset
= offset
;
1237 call
->send_pages
= true;
1238 call
->out_scb
= scb
;
1240 /* marshall the parameters */
1242 *bp
++ = htonl(FSSTOREDATA
);
1243 *bp
++ = htonl(vnode
->fid
.vid
);
1244 *bp
++ = htonl(vnode
->fid
.vnode
);
1245 *bp
++ = htonl(vnode
->fid
.unique
);
1247 *bp
++ = htonl(AFS_SET_MTIME
); /* mask */
1248 *bp
++ = htonl(vnode
->vfs_inode
.i_mtime
.tv_sec
); /* mtime */
1249 *bp
++ = 0; /* owner */
1250 *bp
++ = 0; /* group */
1251 *bp
++ = 0; /* unix mode */
1252 *bp
++ = 0; /* segment size */
1255 *bp
++ = htonl(size
);
1256 *bp
++ = htonl(i_size
);
1258 afs_use_fs_server(call
, fc
->cbi
);
1259 trace_afs_make_fs_call(call
, &vnode
->fid
);
1260 afs_set_fc_call(call
, fc
);
1261 afs_make_call(&fc
->ac
, call
, GFP_NOFS
);
1262 return afs_wait_for_call_to_complete(call
, &fc
->ac
);
1266 * deliver reply data to an FS.StoreStatus
1268 static int afs_deliver_fs_store_status(struct afs_call
*call
)
1275 ret
= afs_transfer_reply(call
);
1279 /* unmarshall the reply once we've received all of it */
1281 ret
= xdr_decode_AFSFetchStatus(&bp
, call
, call
->out_scb
);
1284 xdr_decode_AFSVolSync(&bp
, call
->out_volsync
);
1286 _leave(" = 0 [done]");
1291 * FS.StoreStatus operation type
1293 static const struct afs_call_type afs_RXFSStoreStatus
= {
1294 .name
= "FS.StoreStatus",
1295 .op
= afs_FS_StoreStatus
,
1296 .deliver
= afs_deliver_fs_store_status
,
1297 .destructor
= afs_flat_call_destructor
,
1300 static const struct afs_call_type afs_RXFSStoreData_as_Status
= {
1301 .name
= "FS.StoreData",
1302 .op
= afs_FS_StoreData
,
1303 .deliver
= afs_deliver_fs_store_status
,
1304 .destructor
= afs_flat_call_destructor
,
1307 static const struct afs_call_type afs_RXFSStoreData64_as_Status
= {
1308 .name
= "FS.StoreData64",
1309 .op
= afs_FS_StoreData64
,
1310 .deliver
= afs_deliver_fs_store_status
,
1311 .destructor
= afs_flat_call_destructor
,
1315 * set the attributes on a very large file, using FS.StoreData rather than
1316 * FS.StoreStatus so as to alter the file size also
1318 static int afs_fs_setattr_size64(struct afs_fs_cursor
*fc
, struct iattr
*attr
,
1319 struct afs_status_cb
*scb
)
1321 struct afs_vnode
*vnode
= fc
->vnode
;
1322 struct afs_call
*call
;
1323 struct afs_net
*net
= afs_v2net(vnode
);
1326 _enter(",%x,{%llx:%llu},,",
1327 key_serial(fc
->key
), vnode
->fid
.vid
, vnode
->fid
.vnode
);
1329 ASSERT(attr
->ia_valid
& ATTR_SIZE
);
1331 call
= afs_alloc_flat_call(net
, &afs_RXFSStoreData64_as_Status
,
1332 (4 + 6 + 3 * 2) * 4,
1337 call
->key
= fc
->key
;
1338 call
->out_scb
= scb
;
1340 /* marshall the parameters */
1342 *bp
++ = htonl(FSSTOREDATA64
);
1343 *bp
++ = htonl(vnode
->fid
.vid
);
1344 *bp
++ = htonl(vnode
->fid
.vnode
);
1345 *bp
++ = htonl(vnode
->fid
.unique
);
1347 xdr_encode_AFS_StoreStatus(&bp
, attr
);
1349 *bp
++ = htonl(attr
->ia_size
>> 32); /* position of start of write */
1350 *bp
++ = htonl((u32
) attr
->ia_size
);
1351 *bp
++ = 0; /* size of write */
1353 *bp
++ = htonl(attr
->ia_size
>> 32); /* new file length */
1354 *bp
++ = htonl((u32
) attr
->ia_size
);
1356 afs_use_fs_server(call
, fc
->cbi
);
1357 trace_afs_make_fs_call(call
, &vnode
->fid
);
1358 afs_set_fc_call(call
, fc
);
1359 afs_make_call(&fc
->ac
, call
, GFP_NOFS
);
1360 return afs_wait_for_call_to_complete(call
, &fc
->ac
);
1364 * set the attributes on a file, using FS.StoreData rather than FS.StoreStatus
1365 * so as to alter the file size also
1367 static int afs_fs_setattr_size(struct afs_fs_cursor
*fc
, struct iattr
*attr
,
1368 struct afs_status_cb
*scb
)
1370 struct afs_vnode
*vnode
= fc
->vnode
;
1371 struct afs_call
*call
;
1372 struct afs_net
*net
= afs_v2net(vnode
);
1375 _enter(",%x,{%llx:%llu},,",
1376 key_serial(fc
->key
), vnode
->fid
.vid
, vnode
->fid
.vnode
);
1378 ASSERT(attr
->ia_valid
& ATTR_SIZE
);
1379 if (attr
->ia_size
>> 32)
1380 return afs_fs_setattr_size64(fc
, attr
, scb
);
1382 call
= afs_alloc_flat_call(net
, &afs_RXFSStoreData_as_Status
,
1388 call
->key
= fc
->key
;
1389 call
->out_scb
= scb
;
1391 /* marshall the parameters */
1393 *bp
++ = htonl(FSSTOREDATA
);
1394 *bp
++ = htonl(vnode
->fid
.vid
);
1395 *bp
++ = htonl(vnode
->fid
.vnode
);
1396 *bp
++ = htonl(vnode
->fid
.unique
);
1398 xdr_encode_AFS_StoreStatus(&bp
, attr
);
1400 *bp
++ = htonl(attr
->ia_size
); /* position of start of write */
1401 *bp
++ = 0; /* size of write */
1402 *bp
++ = htonl(attr
->ia_size
); /* new file length */
1404 afs_use_fs_server(call
, fc
->cbi
);
1405 trace_afs_make_fs_call(call
, &vnode
->fid
);
1406 afs_set_fc_call(call
, fc
);
1407 afs_make_call(&fc
->ac
, call
, GFP_NOFS
);
1408 return afs_wait_for_call_to_complete(call
, &fc
->ac
);
1412 * set the attributes on a file, using FS.StoreData if there's a change in file
1413 * size, and FS.StoreStatus otherwise
1415 int afs_fs_setattr(struct afs_fs_cursor
*fc
, struct iattr
*attr
,
1416 struct afs_status_cb
*scb
)
1418 struct afs_vnode
*vnode
= fc
->vnode
;
1419 struct afs_call
*call
;
1420 struct afs_net
*net
= afs_v2net(vnode
);
1423 if (test_bit(AFS_SERVER_FL_IS_YFS
, &fc
->cbi
->server
->flags
))
1424 return yfs_fs_setattr(fc
, attr
, scb
);
1426 if (attr
->ia_valid
& ATTR_SIZE
)
1427 return afs_fs_setattr_size(fc
, attr
, scb
);
1429 _enter(",%x,{%llx:%llu},,",
1430 key_serial(fc
->key
), vnode
->fid
.vid
, vnode
->fid
.vnode
);
1432 call
= afs_alloc_flat_call(net
, &afs_RXFSStoreStatus
,
1438 call
->key
= fc
->key
;
1439 call
->out_scb
= scb
;
1441 /* marshall the parameters */
1443 *bp
++ = htonl(FSSTORESTATUS
);
1444 *bp
++ = htonl(vnode
->fid
.vid
);
1445 *bp
++ = htonl(vnode
->fid
.vnode
);
1446 *bp
++ = htonl(vnode
->fid
.unique
);
1448 xdr_encode_AFS_StoreStatus(&bp
, attr
);
1450 afs_use_fs_server(call
, fc
->cbi
);
1451 trace_afs_make_fs_call(call
, &vnode
->fid
);
1452 afs_set_fc_call(call
, fc
);
1453 afs_make_call(&fc
->ac
, call
, GFP_NOFS
);
1454 return afs_wait_for_call_to_complete(call
, &fc
->ac
);
1458 * deliver reply data to an FS.GetVolumeStatus
1460 static int afs_deliver_fs_get_volume_status(struct afs_call
*call
)
1467 _enter("{%u}", call
->unmarshall
);
1469 switch (call
->unmarshall
) {
1472 afs_extract_to_buf(call
, 12 * 4);
1475 /* extract the returned status record */
1477 _debug("extract status");
1478 ret
= afs_extract_data(call
, true);
1483 xdr_decode_AFSFetchVolumeStatus(&bp
, call
->out_volstatus
);
1485 afs_extract_to_tmp(call
);
1488 /* extract the volume name length */
1490 ret
= afs_extract_data(call
, true);
1494 call
->count
= ntohl(call
->tmp
);
1495 _debug("volname length: %u", call
->count
);
1496 if (call
->count
>= AFSNAMEMAX
)
1497 return afs_protocol_error(call
, -EBADMSG
,
1498 afs_eproto_volname_len
);
1499 size
= (call
->count
+ 3) & ~3; /* It's padded */
1500 afs_extract_to_buf(call
, size
);
1504 /* extract the volume name */
1506 _debug("extract volname");
1507 ret
= afs_extract_data(call
, true);
1513 _debug("volname '%s'", p
);
1514 afs_extract_to_tmp(call
);
1518 /* extract the offline message length */
1520 ret
= afs_extract_data(call
, true);
1524 call
->count
= ntohl(call
->tmp
);
1525 _debug("offline msg length: %u", call
->count
);
1526 if (call
->count
>= AFSNAMEMAX
)
1527 return afs_protocol_error(call
, -EBADMSG
,
1528 afs_eproto_offline_msg_len
);
1529 size
= (call
->count
+ 3) & ~3; /* It's padded */
1530 afs_extract_to_buf(call
, size
);
1534 /* extract the offline message */
1536 _debug("extract offline");
1537 ret
= afs_extract_data(call
, true);
1543 _debug("offline '%s'", p
);
1545 afs_extract_to_tmp(call
);
1549 /* extract the message of the day length */
1551 ret
= afs_extract_data(call
, true);
1555 call
->count
= ntohl(call
->tmp
);
1556 _debug("motd length: %u", call
->count
);
1557 if (call
->count
>= AFSNAMEMAX
)
1558 return afs_protocol_error(call
, -EBADMSG
,
1559 afs_eproto_motd_len
);
1560 size
= (call
->count
+ 3) & ~3; /* It's padded */
1561 afs_extract_to_buf(call
, size
);
1565 /* extract the message of the day */
1567 _debug("extract motd");
1568 ret
= afs_extract_data(call
, false);
1574 _debug("motd '%s'", p
);
1582 _leave(" = 0 [done]");
1587 * FS.GetVolumeStatus operation type
1589 static const struct afs_call_type afs_RXFSGetVolumeStatus
= {
1590 .name
= "FS.GetVolumeStatus",
1591 .op
= afs_FS_GetVolumeStatus
,
1592 .deliver
= afs_deliver_fs_get_volume_status
,
1593 .destructor
= afs_flat_call_destructor
,
1597 * fetch the status of a volume
1599 int afs_fs_get_volume_status(struct afs_fs_cursor
*fc
,
1600 struct afs_volume_status
*vs
)
1602 struct afs_vnode
*vnode
= fc
->vnode
;
1603 struct afs_call
*call
;
1604 struct afs_net
*net
= afs_v2net(vnode
);
1607 if (test_bit(AFS_SERVER_FL_IS_YFS
, &fc
->cbi
->server
->flags
))
1608 return yfs_fs_get_volume_status(fc
, vs
);
1612 call
= afs_alloc_flat_call(net
, &afs_RXFSGetVolumeStatus
, 2 * 4,
1613 max(12 * 4, AFSOPAQUEMAX
+ 1));
1617 call
->key
= fc
->key
;
1618 call
->out_volstatus
= vs
;
1620 /* marshall the parameters */
1622 bp
[0] = htonl(FSGETVOLUMESTATUS
);
1623 bp
[1] = htonl(vnode
->fid
.vid
);
1625 afs_use_fs_server(call
, fc
->cbi
);
1626 trace_afs_make_fs_call(call
, &vnode
->fid
);
1627 afs_set_fc_call(call
, fc
);
1628 afs_make_call(&fc
->ac
, call
, GFP_NOFS
);
1629 return afs_wait_for_call_to_complete(call
, &fc
->ac
);
1633 * deliver reply data to an FS.SetLock, FS.ExtendLock or FS.ReleaseLock
1635 static int afs_deliver_fs_xxxx_lock(struct afs_call
*call
)
1640 _enter("{%u}", call
->unmarshall
);
1642 ret
= afs_transfer_reply(call
);
1646 /* unmarshall the reply once we've received all of it */
1648 xdr_decode_AFSVolSync(&bp
, call
->out_volsync
);
1650 _leave(" = 0 [done]");
1655 * FS.SetLock operation type
1657 static const struct afs_call_type afs_RXFSSetLock
= {
1658 .name
= "FS.SetLock",
1659 .op
= afs_FS_SetLock
,
1660 .deliver
= afs_deliver_fs_xxxx_lock
,
1661 .done
= afs_lock_op_done
,
1662 .destructor
= afs_flat_call_destructor
,
1666 * FS.ExtendLock operation type
1668 static const struct afs_call_type afs_RXFSExtendLock
= {
1669 .name
= "FS.ExtendLock",
1670 .op
= afs_FS_ExtendLock
,
1671 .deliver
= afs_deliver_fs_xxxx_lock
,
1672 .done
= afs_lock_op_done
,
1673 .destructor
= afs_flat_call_destructor
,
1677 * FS.ReleaseLock operation type
1679 static const struct afs_call_type afs_RXFSReleaseLock
= {
1680 .name
= "FS.ReleaseLock",
1681 .op
= afs_FS_ReleaseLock
,
1682 .deliver
= afs_deliver_fs_xxxx_lock
,
1683 .destructor
= afs_flat_call_destructor
,
1687 * Set a lock on a file
1689 int afs_fs_set_lock(struct afs_fs_cursor
*fc
, afs_lock_type_t type
,
1690 struct afs_status_cb
*scb
)
1692 struct afs_vnode
*vnode
= fc
->vnode
;
1693 struct afs_call
*call
;
1694 struct afs_net
*net
= afs_v2net(vnode
);
1697 if (test_bit(AFS_SERVER_FL_IS_YFS
, &fc
->cbi
->server
->flags
))
1698 return yfs_fs_set_lock(fc
, type
, scb
);
1702 call
= afs_alloc_flat_call(net
, &afs_RXFSSetLock
, 5 * 4, 6 * 4);
1706 call
->key
= fc
->key
;
1707 call
->lvnode
= vnode
;
1708 call
->out_scb
= scb
;
1710 /* marshall the parameters */
1712 *bp
++ = htonl(FSSETLOCK
);
1713 *bp
++ = htonl(vnode
->fid
.vid
);
1714 *bp
++ = htonl(vnode
->fid
.vnode
);
1715 *bp
++ = htonl(vnode
->fid
.unique
);
1716 *bp
++ = htonl(type
);
1718 afs_use_fs_server(call
, fc
->cbi
);
1719 trace_afs_make_fs_calli(call
, &vnode
->fid
, type
);
1720 afs_set_fc_call(call
, fc
);
1721 afs_make_call(&fc
->ac
, call
, GFP_NOFS
);
1722 return afs_wait_for_call_to_complete(call
, &fc
->ac
);
1726 * extend a lock on a file
1728 int afs_fs_extend_lock(struct afs_fs_cursor
*fc
, struct afs_status_cb
*scb
)
1730 struct afs_vnode
*vnode
= fc
->vnode
;
1731 struct afs_call
*call
;
1732 struct afs_net
*net
= afs_v2net(vnode
);
1735 if (test_bit(AFS_SERVER_FL_IS_YFS
, &fc
->cbi
->server
->flags
))
1736 return yfs_fs_extend_lock(fc
, scb
);
1740 call
= afs_alloc_flat_call(net
, &afs_RXFSExtendLock
, 4 * 4, 6 * 4);
1744 call
->key
= fc
->key
;
1745 call
->lvnode
= vnode
;
1746 call
->out_scb
= scb
;
1748 /* marshall the parameters */
1750 *bp
++ = htonl(FSEXTENDLOCK
);
1751 *bp
++ = htonl(vnode
->fid
.vid
);
1752 *bp
++ = htonl(vnode
->fid
.vnode
);
1753 *bp
++ = htonl(vnode
->fid
.unique
);
1755 afs_use_fs_server(call
, fc
->cbi
);
1756 trace_afs_make_fs_call(call
, &vnode
->fid
);
1757 afs_set_fc_call(call
, fc
);
1758 afs_make_call(&fc
->ac
, call
, GFP_NOFS
);
1759 return afs_wait_for_call_to_complete(call
, &fc
->ac
);
1763 * release a lock on a file
1765 int afs_fs_release_lock(struct afs_fs_cursor
*fc
, struct afs_status_cb
*scb
)
1767 struct afs_vnode
*vnode
= fc
->vnode
;
1768 struct afs_call
*call
;
1769 struct afs_net
*net
= afs_v2net(vnode
);
1772 if (test_bit(AFS_SERVER_FL_IS_YFS
, &fc
->cbi
->server
->flags
))
1773 return yfs_fs_release_lock(fc
, scb
);
1777 call
= afs_alloc_flat_call(net
, &afs_RXFSReleaseLock
, 4 * 4, 6 * 4);
1781 call
->key
= fc
->key
;
1782 call
->lvnode
= vnode
;
1783 call
->out_scb
= scb
;
1785 /* marshall the parameters */
1787 *bp
++ = htonl(FSRELEASELOCK
);
1788 *bp
++ = htonl(vnode
->fid
.vid
);
1789 *bp
++ = htonl(vnode
->fid
.vnode
);
1790 *bp
++ = htonl(vnode
->fid
.unique
);
1792 afs_use_fs_server(call
, fc
->cbi
);
1793 trace_afs_make_fs_call(call
, &vnode
->fid
);
1794 afs_set_fc_call(call
, fc
);
1795 afs_make_call(&fc
->ac
, call
, GFP_NOFS
);
1796 return afs_wait_for_call_to_complete(call
, &fc
->ac
);
1800 * Deliver reply data to an FS.GiveUpAllCallBacks operation.
1802 static int afs_deliver_fs_give_up_all_callbacks(struct afs_call
*call
)
1804 return afs_transfer_reply(call
);
1808 * FS.GiveUpAllCallBacks operation type
1810 static const struct afs_call_type afs_RXFSGiveUpAllCallBacks
= {
1811 .name
= "FS.GiveUpAllCallBacks",
1812 .op
= afs_FS_GiveUpAllCallBacks
,
1813 .deliver
= afs_deliver_fs_give_up_all_callbacks
,
1814 .destructor
= afs_flat_call_destructor
,
1818 * Flush all the callbacks we have on a server.
1820 int afs_fs_give_up_all_callbacks(struct afs_net
*net
,
1821 struct afs_server
*server
,
1822 struct afs_addr_cursor
*ac
,
1825 struct afs_call
*call
;
1830 call
= afs_alloc_flat_call(net
, &afs_RXFSGiveUpAllCallBacks
, 1 * 4, 0);
1836 /* marshall the parameters */
1838 *bp
++ = htonl(FSGIVEUPALLCALLBACKS
);
1840 /* Can't take a ref on server */
1841 afs_make_call(ac
, call
, GFP_NOFS
);
1842 return afs_wait_for_call_to_complete(call
, ac
);
1846 * Deliver reply data to an FS.GetCapabilities operation.
1848 static int afs_deliver_fs_get_capabilities(struct afs_call
*call
)
1853 _enter("{%u,%zu}", call
->unmarshall
, iov_iter_count(call
->iter
));
1855 switch (call
->unmarshall
) {
1857 afs_extract_to_tmp(call
);
1861 /* Extract the capabilities word count */
1863 ret
= afs_extract_data(call
, true);
1867 count
= ntohl(call
->tmp
);
1869 call
->count
= count
;
1870 call
->count2
= count
;
1871 afs_extract_discard(call
, count
* sizeof(__be32
));
1875 /* Extract capabilities words */
1877 ret
= afs_extract_data(call
, false);
1881 /* TODO: Examine capabilities */
1887 _leave(" = 0 [done]");
1892 * FS.GetCapabilities operation type
1894 static const struct afs_call_type afs_RXFSGetCapabilities
= {
1895 .name
= "FS.GetCapabilities",
1896 .op
= afs_FS_GetCapabilities
,
1897 .deliver
= afs_deliver_fs_get_capabilities
,
1898 .done
= afs_fileserver_probe_result
,
1899 .destructor
= afs_flat_call_destructor
,
1903 * Probe a fileserver for the capabilities that it supports. This can
1904 * return up to 196 words.
1906 struct afs_call
*afs_fs_get_capabilities(struct afs_net
*net
,
1907 struct afs_server
*server
,
1908 struct afs_addr_cursor
*ac
,
1910 unsigned int server_index
)
1912 struct afs_call
*call
;
1917 call
= afs_alloc_flat_call(net
, &afs_RXFSGetCapabilities
, 1 * 4, 16 * 4);
1919 return ERR_PTR(-ENOMEM
);
1922 call
->server
= afs_get_server(server
, afs_server_trace_get_caps
);
1923 call
->server_index
= server_index
;
1924 call
->upgrade
= true;
1926 call
->max_lifespan
= AFS_PROBE_MAX_LIFESPAN
;
1928 /* marshall the parameters */
1930 *bp
++ = htonl(FSGETCAPABILITIES
);
1932 /* Can't take a ref on server */
1933 trace_afs_make_fs_call(call
, NULL
);
1934 afs_make_call(ac
, call
, GFP_NOFS
);
1939 * Deliver reply data to an FS.FetchStatus with no vnode.
1941 static int afs_deliver_fs_fetch_status(struct afs_call
*call
)
1946 ret
= afs_transfer_reply(call
);
1950 /* unmarshall the reply once we've received all of it */
1952 ret
= xdr_decode_AFSFetchStatus(&bp
, call
, call
->out_scb
);
1955 xdr_decode_AFSCallBack(&bp
, call
, call
->out_scb
);
1956 xdr_decode_AFSVolSync(&bp
, call
->out_volsync
);
1958 _leave(" = 0 [done]");
1963 * FS.FetchStatus operation type
1965 static const struct afs_call_type afs_RXFSFetchStatus
= {
1966 .name
= "FS.FetchStatus",
1967 .op
= afs_FS_FetchStatus
,
1968 .deliver
= afs_deliver_fs_fetch_status
,
1969 .destructor
= afs_flat_call_destructor
,
1973 * Fetch the status information for a fid without needing a vnode handle.
1975 int afs_fs_fetch_status(struct afs_fs_cursor
*fc
,
1976 struct afs_net
*net
,
1977 struct afs_fid
*fid
,
1978 struct afs_status_cb
*scb
,
1979 struct afs_volsync
*volsync
)
1981 struct afs_call
*call
;
1984 if (test_bit(AFS_SERVER_FL_IS_YFS
, &fc
->cbi
->server
->flags
))
1985 return yfs_fs_fetch_status(fc
, net
, fid
, scb
, volsync
);
1987 _enter(",%x,{%llx:%llu},,",
1988 key_serial(fc
->key
), fid
->vid
, fid
->vnode
);
1990 call
= afs_alloc_flat_call(net
, &afs_RXFSFetchStatus
, 16, (21 + 3 + 6) * 4);
1992 fc
->ac
.error
= -ENOMEM
;
1996 call
->key
= fc
->key
;
1997 call
->out_fid
= fid
;
1998 call
->out_scb
= scb
;
1999 call
->out_volsync
= volsync
;
2001 /* marshall the parameters */
2003 bp
[0] = htonl(FSFETCHSTATUS
);
2004 bp
[1] = htonl(fid
->vid
);
2005 bp
[2] = htonl(fid
->vnode
);
2006 bp
[3] = htonl(fid
->unique
);
2008 afs_use_fs_server(call
, fc
->cbi
);
2009 trace_afs_make_fs_call(call
, fid
);
2010 afs_set_fc_call(call
, fc
);
2011 afs_make_call(&fc
->ac
, call
, GFP_NOFS
);
2012 return afs_wait_for_call_to_complete(call
, &fc
->ac
);
2016 * Deliver reply data to an FS.InlineBulkStatus call
2018 static int afs_deliver_fs_inline_bulk_status(struct afs_call
*call
)
2020 struct afs_status_cb
*scb
;
2025 _enter("{%u}", call
->unmarshall
);
2027 switch (call
->unmarshall
) {
2029 afs_extract_to_tmp(call
);
2033 /* Extract the file status count and array in two steps */
2035 _debug("extract status count");
2036 ret
= afs_extract_data(call
, true);
2040 tmp
= ntohl(call
->tmp
);
2041 _debug("status count: %u/%u", tmp
, call
->count2
);
2042 if (tmp
!= call
->count2
)
2043 return afs_protocol_error(call
, -EBADMSG
,
2044 afs_eproto_ibulkst_count
);
2049 afs_extract_to_buf(call
, 21 * sizeof(__be32
));
2053 _debug("extract status array %u", call
->count
);
2054 ret
= afs_extract_data(call
, true);
2059 scb
= &call
->out_scb
[call
->count
];
2060 ret
= xdr_decode_AFSFetchStatus(&bp
, call
, scb
);
2065 if (call
->count
< call
->count2
)
2070 afs_extract_to_tmp(call
);
2073 /* Extract the callback count and array in two steps */
2075 _debug("extract CB count");
2076 ret
= afs_extract_data(call
, true);
2080 tmp
= ntohl(call
->tmp
);
2081 _debug("CB count: %u", tmp
);
2082 if (tmp
!= call
->count2
)
2083 return afs_protocol_error(call
, -EBADMSG
,
2084 afs_eproto_ibulkst_cb_count
);
2088 afs_extract_to_buf(call
, 3 * sizeof(__be32
));
2092 _debug("extract CB array");
2093 ret
= afs_extract_data(call
, true);
2097 _debug("unmarshall CB array");
2099 scb
= &call
->out_scb
[call
->count
];
2100 xdr_decode_AFSCallBack(&bp
, call
, scb
);
2102 if (call
->count
< call
->count2
)
2105 afs_extract_to_buf(call
, 6 * sizeof(__be32
));
2110 ret
= afs_extract_data(call
, false);
2115 xdr_decode_AFSVolSync(&bp
, call
->out_volsync
);
2123 _leave(" = 0 [done]");
2128 * FS.InlineBulkStatus operation type
2130 static const struct afs_call_type afs_RXFSInlineBulkStatus
= {
2131 .name
= "FS.InlineBulkStatus",
2132 .op
= afs_FS_InlineBulkStatus
,
2133 .deliver
= afs_deliver_fs_inline_bulk_status
,
2134 .destructor
= afs_flat_call_destructor
,
2138 * Fetch the status information for up to 50 files
2140 int afs_fs_inline_bulk_status(struct afs_fs_cursor
*fc
,
2141 struct afs_net
*net
,
2142 struct afs_fid
*fids
,
2143 struct afs_status_cb
*statuses
,
2144 unsigned int nr_fids
,
2145 struct afs_volsync
*volsync
)
2147 struct afs_call
*call
;
2151 if (test_bit(AFS_SERVER_FL_IS_YFS
, &fc
->cbi
->server
->flags
))
2152 return yfs_fs_inline_bulk_status(fc
, net
, fids
, statuses
,
2155 _enter(",%x,{%llx:%llu},%u",
2156 key_serial(fc
->key
), fids
[0].vid
, fids
[1].vnode
, nr_fids
);
2158 call
= afs_alloc_flat_call(net
, &afs_RXFSInlineBulkStatus
,
2159 (2 + nr_fids
* 3) * 4,
2162 fc
->ac
.error
= -ENOMEM
;
2166 call
->key
= fc
->key
;
2167 call
->out_scb
= statuses
;
2168 call
->out_volsync
= volsync
;
2169 call
->count2
= nr_fids
;
2171 /* marshall the parameters */
2173 *bp
++ = htonl(FSINLINEBULKSTATUS
);
2174 *bp
++ = htonl(nr_fids
);
2175 for (i
= 0; i
< nr_fids
; i
++) {
2176 *bp
++ = htonl(fids
[i
].vid
);
2177 *bp
++ = htonl(fids
[i
].vnode
);
2178 *bp
++ = htonl(fids
[i
].unique
);
2181 afs_use_fs_server(call
, fc
->cbi
);
2182 trace_afs_make_fs_call(call
, &fids
[0]);
2183 afs_set_fc_call(call
, fc
);
2184 afs_make_call(&fc
->ac
, call
, GFP_NOFS
);
2185 return afs_wait_for_call_to_complete(call
, &fc
->ac
);
2189 * deliver reply data to an FS.FetchACL
2191 static int afs_deliver_fs_fetch_acl(struct afs_call
*call
)
2193 struct afs_acl
*acl
;
2198 _enter("{%u}", call
->unmarshall
);
2200 switch (call
->unmarshall
) {
2202 afs_extract_to_tmp(call
);
2206 /* extract the returned data length */
2208 ret
= afs_extract_data(call
, true);
2212 size
= call
->count2
= ntohl(call
->tmp
);
2213 size
= round_up(size
, 4);
2215 acl
= kmalloc(struct_size(acl
, data
, size
), GFP_KERNEL
);
2218 call
->ret_acl
= acl
;
2219 acl
->size
= call
->count2
;
2220 afs_extract_begin(call
, acl
->data
, size
);
2224 /* extract the returned data */
2226 ret
= afs_extract_data(call
, true);
2230 afs_extract_to_buf(call
, (21 + 6) * 4);
2234 /* extract the metadata */
2236 ret
= afs_extract_data(call
, false);
2241 ret
= xdr_decode_AFSFetchStatus(&bp
, call
, call
->out_scb
);
2244 xdr_decode_AFSVolSync(&bp
, call
->out_volsync
);
2252 _leave(" = 0 [done]");
2256 static void afs_destroy_fs_fetch_acl(struct afs_call
*call
)
2258 kfree(call
->ret_acl
);
2259 afs_flat_call_destructor(call
);
2263 * FS.FetchACL operation type
2265 static const struct afs_call_type afs_RXFSFetchACL
= {
2266 .name
= "FS.FetchACL",
2267 .op
= afs_FS_FetchACL
,
2268 .deliver
= afs_deliver_fs_fetch_acl
,
2269 .destructor
= afs_destroy_fs_fetch_acl
,
2273 * Fetch the ACL for a file.
2275 struct afs_acl
*afs_fs_fetch_acl(struct afs_fs_cursor
*fc
,
2276 struct afs_status_cb
*scb
)
2278 struct afs_vnode
*vnode
= fc
->vnode
;
2279 struct afs_call
*call
;
2280 struct afs_net
*net
= afs_v2net(vnode
);
2283 _enter(",%x,{%llx:%llu},,",
2284 key_serial(fc
->key
), vnode
->fid
.vid
, vnode
->fid
.vnode
);
2286 call
= afs_alloc_flat_call(net
, &afs_RXFSFetchACL
, 16, (21 + 6) * 4);
2288 fc
->ac
.error
= -ENOMEM
;
2289 return ERR_PTR(-ENOMEM
);
2292 call
->key
= fc
->key
;
2293 call
->ret_acl
= NULL
;
2294 call
->out_scb
= scb
;
2295 call
->out_volsync
= NULL
;
2297 /* marshall the parameters */
2299 bp
[0] = htonl(FSFETCHACL
);
2300 bp
[1] = htonl(vnode
->fid
.vid
);
2301 bp
[2] = htonl(vnode
->fid
.vnode
);
2302 bp
[3] = htonl(vnode
->fid
.unique
);
2304 afs_use_fs_server(call
, fc
->cbi
);
2305 trace_afs_make_fs_call(call
, &vnode
->fid
);
2306 afs_make_call(&fc
->ac
, call
, GFP_KERNEL
);
2307 return (struct afs_acl
*)afs_wait_for_call_to_complete(call
, &fc
->ac
);
2311 * Deliver reply data to any operation that returns file status and volume
2314 static int afs_deliver_fs_file_status_and_vol(struct afs_call
*call
)
2319 ret
= afs_transfer_reply(call
);
2324 ret
= xdr_decode_AFSFetchStatus(&bp
, call
, call
->out_scb
);
2327 xdr_decode_AFSVolSync(&bp
, call
->out_volsync
);
2329 _leave(" = 0 [done]");
2334 * FS.StoreACL operation type
2336 static const struct afs_call_type afs_RXFSStoreACL
= {
2337 .name
= "FS.StoreACL",
2338 .op
= afs_FS_StoreACL
,
2339 .deliver
= afs_deliver_fs_file_status_and_vol
,
2340 .destructor
= afs_flat_call_destructor
,
2344 * Fetch the ACL for a file.
2346 int afs_fs_store_acl(struct afs_fs_cursor
*fc
, const struct afs_acl
*acl
,
2347 struct afs_status_cb
*scb
)
2349 struct afs_vnode
*vnode
= fc
->vnode
;
2350 struct afs_call
*call
;
2351 struct afs_net
*net
= afs_v2net(vnode
);
2355 _enter(",%x,{%llx:%llu},,",
2356 key_serial(fc
->key
), vnode
->fid
.vid
, vnode
->fid
.vnode
);
2358 size
= round_up(acl
->size
, 4);
2359 call
= afs_alloc_flat_call(net
, &afs_RXFSStoreACL
,
2360 5 * 4 + size
, (21 + 6) * 4);
2362 fc
->ac
.error
= -ENOMEM
;
2366 call
->key
= fc
->key
;
2367 call
->out_scb
= scb
;
2368 call
->out_volsync
= NULL
;
2370 /* marshall the parameters */
2372 bp
[0] = htonl(FSSTOREACL
);
2373 bp
[1] = htonl(vnode
->fid
.vid
);
2374 bp
[2] = htonl(vnode
->fid
.vnode
);
2375 bp
[3] = htonl(vnode
->fid
.unique
);
2376 bp
[4] = htonl(acl
->size
);
2377 memcpy(&bp
[5], acl
->data
, acl
->size
);
2378 if (acl
->size
!= size
)
2379 memset((void *)&bp
[5] + acl
->size
, 0, size
- acl
->size
);
2381 trace_afs_make_fs_call(call
, &vnode
->fid
);
2382 afs_make_call(&fc
->ac
, call
, GFP_KERNEL
);
2383 return afs_wait_for_call_to_complete(call
, &fc
->ac
);