Skip to content

Commit abcbd3b

Browse files
committed
afs: trace: Log afs_make_call(), including server address
Add a tracepoint to log calls to afs_make_call(), including the destination server address. Signed-off-by: David Howells <dhowells@redhat.com> cc: Marc Dionne <marc.dionne@auristor.com> cc: linux-afs@lists.infradead.org
1 parent 28f4c58 commit abcbd3b

5 files changed

Lines changed: 81 additions & 0 deletions

File tree

fs/afs/fsclient.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,7 @@ void afs_fs_fetch_status(struct afs_operation *op)
290290
bp[2] = htonl(vp->fid.vnode);
291291
bp[3] = htonl(vp->fid.unique);
292292

293+
call->fid = vp->fid;
293294
trace_afs_make_fs_call(call, &vp->fid);
294295
afs_make_op_call(op, call, GFP_NOFS);
295296
}
@@ -442,6 +443,7 @@ static void afs_fs_fetch_data64(struct afs_operation *op)
442443
bp[6] = 0;
443444
bp[7] = htonl(lower_32_bits(req->len));
444445

446+
call->fid = vp->fid;
445447
trace_afs_make_fs_call(call, &vp->fid);
446448
afs_make_op_call(op, call, GFP_NOFS);
447449
}
@@ -476,6 +478,7 @@ void afs_fs_fetch_data(struct afs_operation *op)
476478
bp[4] = htonl(lower_32_bits(req->pos));
477479
bp[5] = htonl(lower_32_bits(req->len));
478480

481+
call->fid = vp->fid;
479482
trace_afs_make_fs_call(call, &vp->fid);
480483
afs_make_op_call(op, call, GFP_NOFS);
481484
}
@@ -559,6 +562,7 @@ void afs_fs_create_file(struct afs_operation *op)
559562
*bp++ = htonl(op->create.mode & S_IALLUGO); /* unix mode */
560563
*bp++ = 0; /* segment size */
561564

565+
call->fid = dvp->fid;
562566
trace_afs_make_fs_call1(call, &dvp->fid, name);
563567
afs_make_op_call(op, call, GFP_NOFS);
564568
}
@@ -612,6 +616,7 @@ void afs_fs_make_dir(struct afs_operation *op)
612616
*bp++ = htonl(op->create.mode & S_IALLUGO); /* unix mode */
613617
*bp++ = 0; /* segment size */
614618

619+
call->fid = dvp->fid;
615620
trace_afs_make_fs_call1(call, &dvp->fid, name);
616621
afs_make_op_call(op, call, GFP_NOFS);
617622
}
@@ -685,6 +690,7 @@ void afs_fs_remove_file(struct afs_operation *op)
685690
bp = (void *) bp + padsz;
686691
}
687692

693+
call->fid = dvp->fid;
688694
trace_afs_make_fs_call1(call, &dvp->fid, name);
689695
afs_make_op_call(op, call, GFP_NOFS);
690696
}
@@ -732,6 +738,7 @@ void afs_fs_remove_dir(struct afs_operation *op)
732738
bp = (void *) bp + padsz;
733739
}
734740

741+
call->fid = dvp->fid;
735742
trace_afs_make_fs_call1(call, &dvp->fid, name);
736743
afs_make_op_call(op, call, GFP_NOFS);
737744
}
@@ -812,6 +819,7 @@ void afs_fs_link(struct afs_operation *op)
812819
*bp++ = htonl(vp->fid.vnode);
813820
*bp++ = htonl(vp->fid.unique);
814821

822+
call->fid = vp->fid;
815823
trace_afs_make_fs_call1(call, &vp->fid, name);
816824
afs_make_op_call(op, call, GFP_NOFS);
817825
}
@@ -907,6 +915,7 @@ void afs_fs_symlink(struct afs_operation *op)
907915
*bp++ = htonl(S_IRWXUGO); /* unix mode */
908916
*bp++ = 0; /* segment size */
909917

918+
call->fid = dvp->fid;
910919
trace_afs_make_fs_call1(call, &dvp->fid, name);
911920
afs_make_op_call(op, call, GFP_NOFS);
912921
}
@@ -1003,6 +1012,7 @@ void afs_fs_rename(struct afs_operation *op)
10031012
bp = (void *) bp + n_padsz;
10041013
}
10051014

1015+
call->fid = orig_dvp->fid;
10061016
trace_afs_make_fs_call2(call, &orig_dvp->fid, orig_name, new_name);
10071017
afs_make_op_call(op, call, GFP_NOFS);
10081018
}
@@ -1090,6 +1100,7 @@ static void afs_fs_store_data64(struct afs_operation *op)
10901100
*bp++ = htonl(upper_32_bits(op->store.i_size));
10911101
*bp++ = htonl(lower_32_bits(op->store.i_size));
10921102

1103+
call->fid = vp->fid;
10931104
trace_afs_make_fs_call(call, &vp->fid);
10941105
afs_make_op_call(op, call, GFP_NOFS);
10951106
}
@@ -1140,6 +1151,7 @@ void afs_fs_store_data(struct afs_operation *op)
11401151
*bp++ = htonl(lower_32_bits(op->store.size));
11411152
*bp++ = htonl(lower_32_bits(op->store.i_size));
11421153

1154+
call->fid = vp->fid;
11431155
trace_afs_make_fs_call(call, &vp->fid);
11441156
afs_make_op_call(op, call, GFP_NOFS);
11451157
}
@@ -1206,6 +1218,7 @@ static void afs_fs_setattr_size64(struct afs_operation *op)
12061218
*bp++ = htonl(upper_32_bits(attr->ia_size)); /* new file length */
12071219
*bp++ = htonl(lower_32_bits(attr->ia_size));
12081220

1221+
call->fid = vp->fid;
12091222
trace_afs_make_fs_call(call, &vp->fid);
12101223
afs_make_op_call(op, call, GFP_NOFS);
12111224
}
@@ -1247,6 +1260,7 @@ static void afs_fs_setattr_size(struct afs_operation *op)
12471260
*bp++ = 0; /* size of write */
12481261
*bp++ = htonl(attr->ia_size); /* new file length */
12491262

1263+
call->fid = vp->fid;
12501264
trace_afs_make_fs_call(call, &vp->fid);
12511265
afs_make_op_call(op, call, GFP_NOFS);
12521266
}
@@ -1283,6 +1297,7 @@ void afs_fs_setattr(struct afs_operation *op)
12831297

12841298
xdr_encode_AFS_StoreStatus(&bp, op->setattr.attr);
12851299

1300+
call->fid = vp->fid;
12861301
trace_afs_make_fs_call(call, &vp->fid);
12871302
afs_make_op_call(op, call, GFP_NOFS);
12881303
}
@@ -1446,6 +1461,7 @@ void afs_fs_get_volume_status(struct afs_operation *op)
14461461
bp[0] = htonl(FSGETVOLUMESTATUS);
14471462
bp[1] = htonl(vp->fid.vid);
14481463

1464+
call->fid = vp->fid;
14491465
trace_afs_make_fs_call(call, &vp->fid);
14501466
afs_make_op_call(op, call, GFP_NOFS);
14511467
}
@@ -1528,6 +1544,7 @@ void afs_fs_set_lock(struct afs_operation *op)
15281544
*bp++ = htonl(vp->fid.unique);
15291545
*bp++ = htonl(op->lock.type);
15301546

1547+
call->fid = vp->fid;
15311548
trace_afs_make_fs_calli(call, &vp->fid, op->lock.type);
15321549
afs_make_op_call(op, call, GFP_NOFS);
15331550
}
@@ -1554,6 +1571,7 @@ void afs_fs_extend_lock(struct afs_operation *op)
15541571
*bp++ = htonl(vp->fid.vnode);
15551572
*bp++ = htonl(vp->fid.unique);
15561573

1574+
call->fid = vp->fid;
15571575
trace_afs_make_fs_call(call, &vp->fid);
15581576
afs_make_op_call(op, call, GFP_NOFS);
15591577
}
@@ -1580,6 +1598,7 @@ void afs_fs_release_lock(struct afs_operation *op)
15801598
*bp++ = htonl(vp->fid.vnode);
15811599
*bp++ = htonl(vp->fid.unique);
15821600

1601+
call->fid = vp->fid;
15831602
trace_afs_make_fs_call(call, &vp->fid);
15841603
afs_make_op_call(op, call, GFP_NOFS);
15851604
}
@@ -1948,6 +1967,7 @@ void afs_fs_inline_bulk_status(struct afs_operation *op)
19481967
*bp++ = htonl(op->more_files[i].fid.unique);
19491968
}
19501969

1970+
call->fid = vp->fid;
19511971
trace_afs_make_fs_call(call, &vp->fid);
19521972
afs_make_op_call(op, call, GFP_NOFS);
19531973
}
@@ -2053,6 +2073,7 @@ void afs_fs_fetch_acl(struct afs_operation *op)
20532073
bp[2] = htonl(vp->fid.vnode);
20542074
bp[3] = htonl(vp->fid.unique);
20552075

2076+
call->fid = vp->fid;
20562077
trace_afs_make_fs_call(call, &vp->fid);
20572078
afs_make_op_call(op, call, GFP_KERNEL);
20582079
}
@@ -2098,6 +2119,7 @@ void afs_fs_store_acl(struct afs_operation *op)
20982119
if (acl->size != size)
20992120
memset((void *)&bp[5] + acl->size, 0, size - acl->size);
21002121

2122+
call->fid = vp->fid;
21012123
trace_afs_make_fs_call(call, &vp->fid);
21022124
afs_make_op_call(op, call, GFP_KERNEL);
21032125
}

fs/afs/internal.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ struct afs_call {
153153
struct afs_vldb_entry *ret_vldb;
154154
char *ret_str;
155155
};
156+
struct afs_fid fid; /* Primary vnode ID (or all zeroes) */
156157
unsigned char probe_index; /* Address in ->probe_alist */
157158
struct afs_operation *op;
158159
unsigned int server_index;

fs/afs/rxrpc.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,8 @@ void afs_make_call(struct afs_call *call, gfp_t gfp)
313313
call, call->type->name, key_serial(call->key),
314314
atomic_read(&call->net->nr_outstanding_calls));
315315

316+
trace_afs_make_call(call);
317+
316318
/* Work out the length we're going to transmit. This is awkward for
317319
* calls such as FS.StoreData where there's an extra injection of data
318320
* after the initial fixed part.

fs/afs/yfsclient.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,7 @@ void yfs_fs_fetch_data(struct afs_operation *op)
493493
bp = xdr_encode_u64(bp, req->len);
494494
yfs_check_req(call, bp);
495495

496+
call->fid = vp->fid;
496497
trace_afs_make_fs_call(call, &vp->fid);
497498
afs_make_op_call(op, call, GFP_NOFS);
498499
}
@@ -575,6 +576,7 @@ void yfs_fs_create_file(struct afs_operation *op)
575576
bp = xdr_encode_u32(bp, yfs_LockNone); /* ViceLockType */
576577
yfs_check_req(call, bp);
577578

579+
call->fid = dvp->fid;
578580
trace_afs_make_fs_call1(call, &dvp->fid, name);
579581
afs_make_op_call(op, call, GFP_NOFS);
580582
}
@@ -623,6 +625,7 @@ void yfs_fs_make_dir(struct afs_operation *op)
623625
bp = xdr_encode_YFSStoreStatus(bp, &op->create.mode, &op->mtime);
624626
yfs_check_req(call, bp);
625627

628+
call->fid = dvp->fid;
626629
trace_afs_make_fs_call1(call, &dvp->fid, name);
627630
afs_make_op_call(op, call, GFP_NOFS);
628631
}
@@ -707,6 +710,7 @@ void yfs_fs_remove_file2(struct afs_operation *op)
707710
bp = xdr_encode_name(bp, name);
708711
yfs_check_req(call, bp);
709712

713+
call->fid = dvp->fid;
710714
trace_afs_make_fs_call1(call, &dvp->fid, name);
711715
afs_make_op_call(op, call, GFP_NOFS);
712716
}
@@ -776,6 +780,7 @@ void yfs_fs_remove_file(struct afs_operation *op)
776780
bp = xdr_encode_name(bp, name);
777781
yfs_check_req(call, bp);
778782

783+
call->fid = dvp->fid;
779784
trace_afs_make_fs_call1(call, &dvp->fid, name);
780785
afs_make_op_call(op, call, GFP_NOFS);
781786
}
@@ -817,6 +822,7 @@ void yfs_fs_remove_dir(struct afs_operation *op)
817822
bp = xdr_encode_name(bp, name);
818823
yfs_check_req(call, bp);
819824

825+
call->fid = dvp->fid;
820826
trace_afs_make_fs_call1(call, &dvp->fid, name);
821827
afs_make_op_call(op, call, GFP_NOFS);
822828
}
@@ -890,6 +896,7 @@ void yfs_fs_link(struct afs_operation *op)
890896
bp = xdr_encode_YFSFid(bp, &vp->fid);
891897
yfs_check_req(call, bp);
892898

899+
call->fid = vp->fid;
893900
trace_afs_make_fs_call1(call, &vp->fid, name);
894901
afs_make_op_call(op, call, GFP_NOFS);
895902
}
@@ -971,6 +978,7 @@ void yfs_fs_symlink(struct afs_operation *op)
971978
bp = xdr_encode_YFSStoreStatus(bp, &mode, &op->mtime);
972979
yfs_check_req(call, bp);
973980

981+
call->fid = dvp->fid;
974982
trace_afs_make_fs_call1(call, &dvp->fid, name);
975983
afs_make_op_call(op, call, GFP_NOFS);
976984
}
@@ -1050,6 +1058,7 @@ void yfs_fs_rename(struct afs_operation *op)
10501058
bp = xdr_encode_name(bp, new_name);
10511059
yfs_check_req(call, bp);
10521060

1061+
call->fid = orig_dvp->fid;
10531062
trace_afs_make_fs_call2(call, &orig_dvp->fid, orig_name, new_name);
10541063
afs_make_op_call(op, call, GFP_NOFS);
10551064
}
@@ -1105,6 +1114,7 @@ void yfs_fs_store_data(struct afs_operation *op)
11051114
bp = xdr_encode_u64(bp, op->store.i_size);
11061115
yfs_check_req(call, bp);
11071116

1117+
call->fid = vp->fid;
11081118
trace_afs_make_fs_call(call, &vp->fid);
11091119
afs_make_op_call(op, call, GFP_NOFS);
11101120
}
@@ -1161,6 +1171,7 @@ static void yfs_fs_setattr_size(struct afs_operation *op)
11611171
bp = xdr_encode_u64(bp, attr->ia_size); /* new file length */
11621172
yfs_check_req(call, bp);
11631173

1174+
call->fid = vp->fid;
11641175
trace_afs_make_fs_call(call, &vp->fid);
11651176
afs_make_op_call(op, call, GFP_NOFS);
11661177
}
@@ -1199,6 +1210,7 @@ void yfs_fs_setattr(struct afs_operation *op)
11991210
bp = xdr_encode_YFS_StoreStatus(bp, attr);
12001211
yfs_check_req(call, bp);
12011212

1213+
call->fid = vp->fid;
12021214
trace_afs_make_fs_call(call, &vp->fid);
12031215
afs_make_op_call(op, call, GFP_NOFS);
12041216
}
@@ -1369,6 +1381,7 @@ void yfs_fs_get_volume_status(struct afs_operation *op)
13691381
bp = xdr_encode_u64(bp, vp->fid.vid);
13701382
yfs_check_req(call, bp);
13711383

1384+
call->fid = vp->fid;
13721385
trace_afs_make_fs_call(call, &vp->fid);
13731386
afs_make_op_call(op, call, GFP_NOFS);
13741387
}
@@ -1433,6 +1446,7 @@ void yfs_fs_set_lock(struct afs_operation *op)
14331446
bp = xdr_encode_u32(bp, op->lock.type);
14341447
yfs_check_req(call, bp);
14351448

1449+
call->fid = vp->fid;
14361450
trace_afs_make_fs_calli(call, &vp->fid, op->lock.type);
14371451
afs_make_op_call(op, call, GFP_NOFS);
14381452
}
@@ -1463,6 +1477,7 @@ void yfs_fs_extend_lock(struct afs_operation *op)
14631477
bp = xdr_encode_YFSFid(bp, &vp->fid);
14641478
yfs_check_req(call, bp);
14651479

1480+
call->fid = vp->fid;
14661481
trace_afs_make_fs_call(call, &vp->fid);
14671482
afs_make_op_call(op, call, GFP_NOFS);
14681483
}
@@ -1493,6 +1508,7 @@ void yfs_fs_release_lock(struct afs_operation *op)
14931508
bp = xdr_encode_YFSFid(bp, &vp->fid);
14941509
yfs_check_req(call, bp);
14951510

1511+
call->fid = vp->fid;
14961512
trace_afs_make_fs_call(call, &vp->fid);
14971513
afs_make_op_call(op, call, GFP_NOFS);
14981514
}
@@ -1559,6 +1575,7 @@ void yfs_fs_fetch_status(struct afs_operation *op)
15591575
bp = xdr_encode_YFSFid(bp, &vp->fid);
15601576
yfs_check_req(call, bp);
15611577

1578+
call->fid = vp->fid;
15621579
trace_afs_make_fs_call(call, &vp->fid);
15631580
afs_make_op_call(op, call, GFP_NOFS);
15641581
}
@@ -1739,6 +1756,7 @@ void yfs_fs_inline_bulk_status(struct afs_operation *op)
17391756
bp = xdr_encode_YFSFid(bp, &op->more_files[i].fid);
17401757
yfs_check_req(call, bp);
17411758

1759+
call->fid = vp->fid;
17421760
trace_afs_make_fs_call(call, &vp->fid);
17431761
afs_make_op_call(op, call, GFP_NOFS);
17441762
}
@@ -1901,6 +1919,7 @@ void yfs_fs_fetch_opaque_acl(struct afs_operation *op)
19011919
bp = xdr_encode_YFSFid(bp, &vp->fid);
19021920
yfs_check_req(call, bp);
19031921

1922+
call->fid = vp->fid;
19041923
trace_afs_make_fs_call(call, &vp->fid);
19051924
afs_make_op_call(op, call, GFP_KERNEL);
19061925
}
@@ -1951,6 +1970,7 @@ void yfs_fs_store_opaque_acl2(struct afs_operation *op)
19511970
bp += size / sizeof(__be32);
19521971
yfs_check_req(call, bp);
19531972

1973+
call->fid = vp->fid;
19541974
trace_afs_make_fs_call(call, &vp->fid);
19551975
afs_make_op_call(op, call, GFP_KERNEL);
19561976
}

include/trace/events/afs.h

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1576,6 +1576,42 @@ TRACE_EVENT(afs_rotate,
15761576
__entry->extra)
15771577
);
15781578

1579+
TRACE_EVENT(afs_make_call,
1580+
TP_PROTO(struct afs_call *call),
1581+
1582+
TP_ARGS(call),
1583+
1584+
TP_STRUCT__entry(
1585+
__field(unsigned int, call)
1586+
__field(bool, is_vl)
1587+
__field(enum afs_fs_operation, op)
1588+
__field_struct(struct afs_fid, fid)
1589+
__field_struct(struct sockaddr_rxrpc, srx)
1590+
),
1591+
1592+
TP_fast_assign(
1593+
__entry->call = call->debug_id;
1594+
__entry->op = call->operation_ID;
1595+
__entry->fid = call->fid;
1596+
memcpy(&__entry->srx, rxrpc_kernel_remote_srx(call->peer),
1597+
sizeof(__entry->srx));
1598+
__entry->srx.srx_service = call->service_id;
1599+
__entry->is_vl = (__entry->srx.srx_service == VL_SERVICE ||
1600+
__entry->srx.srx_service == YFS_VL_SERVICE);
1601+
),
1602+
1603+
TP_printk("c=%08x %pISpc+%u %s %llx:%llx:%x",
1604+
__entry->call,
1605+
&__entry->srx.transport,
1606+
__entry->srx.srx_service,
1607+
__entry->is_vl ?
1608+
__print_symbolic(__entry->op, afs_vl_operations) :
1609+
__print_symbolic(__entry->op, afs_fs_operations),
1610+
__entry->fid.vid,
1611+
__entry->fid.vnode,
1612+
__entry->fid.unique)
1613+
);
1614+
15791615
#endif /* _TRACE_AFS_H */
15801616

15811617
/* This part must be outside protection */

0 commit comments

Comments
 (0)