summaryrefslogtreecommitdiffstats
path: root/include/trace
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2019-05-07 20:51:58 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2019-05-07 20:51:58 -0700
commite5fef2a9732580c5bd30c0097f5e9091a3d58ce5 (patch)
treecb91b5a51f7e451300e06e203a50cbed8aabbc1c /include/trace
parent149e703cb8bfcbdae46140b108bb6f7d2407df8f (diff)
parentf5e4546347bc847be30b3cf904db5fc874b3c5dc (diff)
downloadlinux-e5fef2a9732580c5bd30c0097f5e9091a3d58ce5.tar.bz2
Merge tag 'afs-next-20190507' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs
Pull AFS updates from David Howells: "A set of fix and development patches for AFS for 5.2. Summary: - Fix the AFS file locking so that sqlite can run on an AFS mount and also so that firefox and gnome can use a homedir that's mounted through AFS. This required emulation of fine-grained locking when the server will only support whole-file locks and no upgrade/downgrade. Four modes are provided, settable by mount parameter: "flock=local" - No reference to the server "flock=openafs" - Fine-grained locks are local-only, whole-file locks require sufficient server locks "flock=strict" - All locks require sufficient server locks "flock=write" - Always get an exclusive server lock If the volume is a read-only or backup volume, then flock=local for that volume. - Log extra information for a couple of cases where the client mucks up somehow: AFS vnode with undefined type and dir check failure - in both cases we seem to end up with unfilled data, but the issues happen infrequently and are difficult to reproduce at will. - Implement silly rename for unlink() and rename(). - Set i_blocks so that du can get some information about usage. - Fix xattr handlers to return the right amount of data and to not overflow buffers. - Implement getting/setting raw AFS and YFS ACLs as xattrs" * tag 'afs-next-20190507' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs: afs: Implement YFS ACL setting afs: Get YFS ACLs and information through xattrs afs: implement acl setting afs: Get an AFS3 ACL as an xattr afs: Fix getting the afs.fid xattr afs: Fix the afs.cell and afs.volume xattr handlers afs: Calculate i_blocks based on file size afs: Log more information for "kAFS: AFS vnode with undefined type\n" afs: Provide mount-time configurable byte-range file locking emulation afs: Add more tracepoints afs: Implement sillyrename for unlink and rename afs: Add directory reload tracepoint afs: Handle lock rpc ops failing on a file that got deleted afs: Improve dir check failure reports afs: Add file locking tracepoints afs: Further fix file locking afs: Fix AFS file locking to allow fine grained locks afs: Calculate lock extend timer from set/extend reply reception afs: Split wait from afs_make_call()
Diffstat (limited to 'include/trace')
-rw-r--r--include/trace/events/afs.h385
1 files changed, 380 insertions, 5 deletions
diff --git a/include/trace/events/afs.h b/include/trace/events/afs.h
index e3f005eae1f7..562f854ac4bf 100644
--- a/include/trace/events/afs.h
+++ b/include/trace/events/afs.h
@@ -33,8 +33,10 @@ enum afs_call_trace {
enum afs_fs_operation {
afs_FS_FetchData = 130, /* AFS Fetch file data */
+ afs_FS_FetchACL = 131, /* AFS Fetch file ACL */
afs_FS_FetchStatus = 132, /* AFS Fetch file status */
afs_FS_StoreData = 133, /* AFS Store file data */
+ afs_FS_StoreACL = 134, /* AFS Store file ACL */
afs_FS_StoreStatus = 135, /* AFS Store file status */
afs_FS_RemoveFile = 136, /* AFS Remove a file */
afs_FS_CreateFile = 137, /* AFS Create a file */
@@ -108,8 +110,12 @@ enum afs_edit_dir_reason {
afs_edit_dir_for_create,
afs_edit_dir_for_link,
afs_edit_dir_for_mkdir,
- afs_edit_dir_for_rename,
+ afs_edit_dir_for_rename_0,
+ afs_edit_dir_for_rename_1,
+ afs_edit_dir_for_rename_2,
afs_edit_dir_for_rmdir,
+ afs_edit_dir_for_silly_0,
+ afs_edit_dir_for_silly_1,
afs_edit_dir_for_symlink,
afs_edit_dir_for_unlink,
};
@@ -152,6 +158,43 @@ enum afs_file_error {
afs_file_error_writeback_fail,
};
+enum afs_flock_event {
+ afs_flock_acquired,
+ afs_flock_callback_break,
+ afs_flock_defer_unlock,
+ afs_flock_extend_fail,
+ afs_flock_fail_other,
+ afs_flock_fail_perm,
+ afs_flock_no_lockers,
+ afs_flock_release_fail,
+ afs_flock_silly_delete,
+ afs_flock_timestamp,
+ afs_flock_try_to_lock,
+ afs_flock_vfs_lock,
+ afs_flock_vfs_locking,
+ afs_flock_waited,
+ afs_flock_waiting,
+ afs_flock_work_extending,
+ afs_flock_work_retry,
+ afs_flock_work_unlocking,
+ afs_flock_would_block,
+};
+
+enum afs_flock_operation {
+ afs_flock_op_copy_lock,
+ afs_flock_op_flock,
+ afs_flock_op_grant,
+ afs_flock_op_lock,
+ afs_flock_op_release_lock,
+ afs_flock_op_return_ok,
+ afs_flock_op_return_eagain,
+ afs_flock_op_return_edeadlk,
+ afs_flock_op_return_error,
+ afs_flock_op_set_lock,
+ afs_flock_op_unlock,
+ afs_flock_op_wake,
+};
+
#endif /* end __AFS_DECLARE_TRACE_ENUMS_ONCE_ONLY */
/*
@@ -237,8 +280,12 @@ enum afs_file_error {
EM(afs_edit_dir_for_create, "Create") \
EM(afs_edit_dir_for_link, "Link ") \
EM(afs_edit_dir_for_mkdir, "MkDir ") \
- EM(afs_edit_dir_for_rename, "Rename") \
+ EM(afs_edit_dir_for_rename_0, "Renam0") \
+ EM(afs_edit_dir_for_rename_1, "Renam1") \
+ EM(afs_edit_dir_for_rename_2, "Renam2") \
EM(afs_edit_dir_for_rmdir, "RmDir ") \
+ EM(afs_edit_dir_for_silly_0, "S_Ren0") \
+ EM(afs_edit_dir_for_silly_1, "S_Ren1") \
EM(afs_edit_dir_for_symlink, "Symlnk") \
E_(afs_edit_dir_for_unlink, "Unlink")
@@ -277,6 +324,56 @@ enum afs_file_error {
EM(afs_file_error_mntpt, "MNTPT_READ_FAILED") \
E_(afs_file_error_writeback_fail, "WRITEBACK_FAILED")
+#define afs_flock_types \
+ EM(F_RDLCK, "RDLCK") \
+ EM(F_WRLCK, "WRLCK") \
+ E_(F_UNLCK, "UNLCK")
+
+#define afs_flock_states \
+ EM(AFS_VNODE_LOCK_NONE, "NONE") \
+ EM(AFS_VNODE_LOCK_WAITING_FOR_CB, "WAIT_FOR_CB") \
+ EM(AFS_VNODE_LOCK_SETTING, "SETTING") \
+ EM(AFS_VNODE_LOCK_GRANTED, "GRANTED") \
+ EM(AFS_VNODE_LOCK_EXTENDING, "EXTENDING") \
+ EM(AFS_VNODE_LOCK_NEED_UNLOCK, "NEED_UNLOCK") \
+ EM(AFS_VNODE_LOCK_UNLOCKING, "UNLOCKING") \
+ E_(AFS_VNODE_LOCK_DELETED, "DELETED")
+
+#define afs_flock_events \
+ EM(afs_flock_acquired, "Acquired") \
+ EM(afs_flock_callback_break, "Callback") \
+ EM(afs_flock_defer_unlock, "D-Unlock") \
+ EM(afs_flock_extend_fail, "Ext_Fail") \
+ EM(afs_flock_fail_other, "ErrOther") \
+ EM(afs_flock_fail_perm, "ErrPerm ") \
+ EM(afs_flock_no_lockers, "NoLocker") \
+ EM(afs_flock_release_fail, "Rel_Fail") \
+ EM(afs_flock_silly_delete, "SillyDel") \
+ EM(afs_flock_timestamp, "Timestmp") \
+ EM(afs_flock_try_to_lock, "TryToLck") \
+ EM(afs_flock_vfs_lock, "VFSLock ") \
+ EM(afs_flock_vfs_locking, "VFSLking") \
+ EM(afs_flock_waited, "Waited ") \
+ EM(afs_flock_waiting, "Waiting ") \
+ EM(afs_flock_work_extending, "Extendng") \
+ EM(afs_flock_work_retry, "Retry ") \
+ EM(afs_flock_work_unlocking, "Unlcking") \
+ E_(afs_flock_would_block, "EWOULDBL")
+
+#define afs_flock_operations \
+ EM(afs_flock_op_copy_lock, "COPY ") \
+ EM(afs_flock_op_flock, "->flock ") \
+ EM(afs_flock_op_grant, "GRANT ") \
+ EM(afs_flock_op_lock, "->lock ") \
+ EM(afs_flock_op_release_lock, "RELEASE ") \
+ EM(afs_flock_op_return_ok, "<-OK ") \
+ EM(afs_flock_op_return_edeadlk, "<-EDEADL") \
+ EM(afs_flock_op_return_eagain, "<-EAGAIN") \
+ EM(afs_flock_op_return_error, "<-ERROR ") \
+ EM(afs_flock_op_set_lock, "SET ") \
+ EM(afs_flock_op_unlock, "UNLOCK ") \
+ E_(afs_flock_op_wake, "WAKE ")
+
/*
* Export enum symbols via userspace.
*/
@@ -293,6 +390,8 @@ afs_edit_dir_reasons;
afs_eproto_causes;
afs_io_errors;
afs_file_errors;
+afs_flock_types;
+afs_flock_operations;
/*
* Now redefine the EM() and E_() macros to map the enums to the strings that
@@ -442,6 +541,123 @@ TRACE_EVENT(afs_make_fs_call,
__print_symbolic(__entry->op, afs_fs_operations))
);
+TRACE_EVENT(afs_make_fs_calli,
+ TP_PROTO(struct afs_call *call, const struct afs_fid *fid,
+ unsigned int i),
+
+ TP_ARGS(call, fid, i),
+
+ TP_STRUCT__entry(
+ __field(unsigned int, call )
+ __field(unsigned int, i )
+ __field(enum afs_fs_operation, op )
+ __field_struct(struct afs_fid, fid )
+ ),
+
+ TP_fast_assign(
+ __entry->call = call->debug_id;
+ __entry->i = i;
+ __entry->op = call->operation_ID;
+ if (fid) {
+ __entry->fid = *fid;
+ } else {
+ __entry->fid.vid = 0;
+ __entry->fid.vnode = 0;
+ __entry->fid.unique = 0;
+ }
+ ),
+
+ TP_printk("c=%08x %06llx:%06llx:%06x %s i=%u",
+ __entry->call,
+ __entry->fid.vid,
+ __entry->fid.vnode,
+ __entry->fid.unique,
+ __print_symbolic(__entry->op, afs_fs_operations),
+ __entry->i)
+ );
+
+TRACE_EVENT(afs_make_fs_call1,
+ TP_PROTO(struct afs_call *call, const struct afs_fid *fid,
+ const char *name),
+
+ TP_ARGS(call, fid, name),
+
+ TP_STRUCT__entry(
+ __field(unsigned int, call )
+ __field(enum afs_fs_operation, op )
+ __field_struct(struct afs_fid, fid )
+ __array(char, name, 24 )
+ ),
+
+ TP_fast_assign(
+ int __len = strlen(name);
+ __len = min(__len, 23);
+ __entry->call = call->debug_id;
+ __entry->op = call->operation_ID;
+ if (fid) {
+ __entry->fid = *fid;
+ } else {
+ __entry->fid.vid = 0;
+ __entry->fid.vnode = 0;
+ __entry->fid.unique = 0;
+ }
+ memcpy(__entry->name, name, __len);
+ __entry->name[__len] = 0;
+ ),
+
+ TP_printk("c=%08x %06llx:%06llx:%06x %s \"%s\"",
+ __entry->call,
+ __entry->fid.vid,
+ __entry->fid.vnode,
+ __entry->fid.unique,
+ __print_symbolic(__entry->op, afs_fs_operations),
+ __entry->name)
+ );
+
+TRACE_EVENT(afs_make_fs_call2,
+ TP_PROTO(struct afs_call *call, const struct afs_fid *fid,
+ const char *name, const char *name2),
+
+ TP_ARGS(call, fid, name, name2),
+
+ TP_STRUCT__entry(
+ __field(unsigned int, call )
+ __field(enum afs_fs_operation, op )
+ __field_struct(struct afs_fid, fid )
+ __array(char, name, 24 )
+ __array(char, name2, 24 )
+ ),
+
+ TP_fast_assign(
+ int __len = strlen(name);
+ int __len2 = strlen(name2);
+ __len = min(__len, 23);
+ __len2 = min(__len2, 23);
+ __entry->call = call->debug_id;
+ __entry->op = call->operation_ID;
+ if (fid) {
+ __entry->fid = *fid;
+ } else {
+ __entry->fid.vid = 0;
+ __entry->fid.vnode = 0;
+ __entry->fid.unique = 0;
+ }
+ memcpy(__entry->name, name, __len);
+ __entry->name[__len] = 0;
+ memcpy(__entry->name2, name2, __len2);
+ __entry->name2[__len2] = 0;
+ ),
+
+ TP_printk("c=%08x %06llx:%06llx:%06x %s \"%s\" \"%s\"",
+ __entry->call,
+ __entry->fid.vid,
+ __entry->fid.vnode,
+ __entry->fid.unique,
+ __print_symbolic(__entry->op, afs_fs_operations),
+ __entry->name,
+ __entry->name2)
+ );
+
TRACE_EVENT(afs_make_vl_call,
TP_PROTO(struct afs_call *call),
@@ -639,6 +855,38 @@ TRACE_EVENT(afs_call_state,
__entry->ret, __entry->abort)
);
+TRACE_EVENT(afs_lookup,
+ TP_PROTO(struct afs_vnode *dvnode, const struct qstr *name,
+ struct afs_vnode *vnode),
+
+ TP_ARGS(dvnode, name, vnode),
+
+ TP_STRUCT__entry(
+ __field_struct(struct afs_fid, dfid )
+ __field_struct(struct afs_fid, fid )
+ __array(char, name, 24 )
+ ),
+
+ TP_fast_assign(
+ int __len = min_t(int, name->len, 23);
+ __entry->dfid = dvnode->fid;
+ if (vnode) {
+ __entry->fid = vnode->fid;
+ } else {
+ __entry->fid.vid = 0;
+ __entry->fid.vnode = 0;
+ __entry->fid.unique = 0;
+ }
+ memcpy(__entry->name, name->name, __len);
+ __entry->name[__len] = 0;
+ ),
+
+ TP_printk("d=%llx:%llx:%x \"%s\" f=%llx:%x",
+ __entry->dfid.vid, __entry->dfid.vnode, __entry->dfid.unique,
+ __entry->name,
+ __entry->fid.vnode, __entry->fid.unique)
+ );
+
TRACE_EVENT(afs_edit_dir,
TP_PROTO(struct afs_vnode *dvnode,
enum afs_edit_dir_reason why,
@@ -660,12 +908,12 @@ TRACE_EVENT(afs_edit_dir,
__field(unsigned short, slot )
__field(unsigned int, f_vnode )
__field(unsigned int, f_unique )
- __array(char, name, 18 )
+ __array(char, name, 24 )
),
TP_fast_assign(
int __len = strlen(name);
- __len = min(__len, 17);
+ __len = min(__len, 23);
__entry->vnode = dvnode->fid.vnode;
__entry->unique = dvnode->fid.unique;
__entry->why = why;
@@ -678,7 +926,7 @@ TRACE_EVENT(afs_edit_dir,
__entry->name[__len] = 0;
),
- TP_printk("d=%x:%x %s %s %u[%u] f=%x:%x %s",
+ TP_printk("d=%x:%x %s %s %u[%u] f=%x:%x \"%s\"",
__entry->vnode, __entry->unique,
__print_symbolic(__entry->why, afs_edit_dir_reasons),
__print_symbolic(__entry->op, afs_edit_dir_ops),
@@ -796,6 +1044,133 @@ TRACE_EVENT(afs_cm_no_server_u,
__entry->call, __entry->op_id, &__entry->uuid)
);
+TRACE_EVENT(afs_flock_ev,
+ TP_PROTO(struct afs_vnode *vnode, struct file_lock *fl,
+ enum afs_flock_event event, int error),
+
+ TP_ARGS(vnode, fl, event, error),
+
+ TP_STRUCT__entry(
+ __field_struct(struct afs_fid, fid )
+ __field(enum afs_flock_event, event )
+ __field(enum afs_lock_state, state )
+ __field(int, error )
+ __field(unsigned int, debug_id )
+ ),
+
+ TP_fast_assign(
+ __entry->fid = vnode->fid;
+ __entry->event = event;
+ __entry->state = vnode->lock_state;
+ __entry->error = error;
+ __entry->debug_id = fl ? fl->fl_u.afs.debug_id : 0;
+ ),
+
+ TP_printk("%llx:%llx:%x %04x %s s=%s e=%d",
+ __entry->fid.vid, __entry->fid.vnode, __entry->fid.unique,
+ __entry->debug_id,
+ __print_symbolic(__entry->event, afs_flock_events),
+ __print_symbolic(__entry->state, afs_flock_states),
+ __entry->error)
+ );
+
+TRACE_EVENT(afs_flock_op,
+ TP_PROTO(struct afs_vnode *vnode, struct file_lock *fl,
+ enum afs_flock_operation op),
+
+ TP_ARGS(vnode, fl, op),
+
+ TP_STRUCT__entry(
+ __field_struct(struct afs_fid, fid )
+ __field(loff_t, from )
+ __field(loff_t, len )
+ __field(enum afs_flock_operation, op )
+ __field(unsigned char, type )
+ __field(unsigned int, flags )
+ __field(unsigned int, debug_id )
+ ),
+
+ TP_fast_assign(
+ __entry->fid = vnode->fid;
+ __entry->from = fl->fl_start;
+ __entry->len = fl->fl_end - fl->fl_start + 1;
+ __entry->op = op;
+ __entry->type = fl->fl_type;
+ __entry->flags = fl->fl_flags;
+ __entry->debug_id = fl->fl_u.afs.debug_id;
+ ),
+
+ TP_printk("%llx:%llx:%x %04x %s t=%s R=%llx/%llx f=%x",
+ __entry->fid.vid, __entry->fid.vnode, __entry->fid.unique,
+ __entry->debug_id,
+ __print_symbolic(__entry->op, afs_flock_operations),
+ __print_symbolic(__entry->type, afs_flock_types),
+ __entry->from, __entry->len, __entry->flags)
+ );
+
+TRACE_EVENT(afs_reload_dir,
+ TP_PROTO(struct afs_vnode *vnode),
+
+ TP_ARGS(vnode),
+
+ TP_STRUCT__entry(
+ __field_struct(struct afs_fid, fid )
+ ),
+
+ TP_fast_assign(
+ __entry->fid = vnode->fid;
+ ),
+
+ TP_printk("%llx:%llx:%x",
+ __entry->fid.vid, __entry->fid.vnode, __entry->fid.unique)
+ );
+
+TRACE_EVENT(afs_silly_rename,
+ TP_PROTO(struct afs_vnode *vnode, bool done),
+
+ TP_ARGS(vnode, done),
+
+ TP_STRUCT__entry(
+ __field_struct(struct afs_fid, fid )
+ __field(bool, done )
+ ),
+
+ TP_fast_assign(
+ __entry->fid = vnode->fid;
+ __entry->done = done;
+ ),
+
+ TP_printk("%llx:%llx:%x done=%u",
+ __entry->fid.vid, __entry->fid.vnode, __entry->fid.unique,
+ __entry->done)
+ );
+
+TRACE_EVENT(afs_get_tree,
+ TP_PROTO(struct afs_cell *cell, struct afs_volume *volume),
+
+ TP_ARGS(cell, volume),
+
+ TP_STRUCT__entry(
+ __field(u64, vid )
+ __array(char, cell, 24 )
+ __array(char, volume, 24 )
+ ),
+
+ TP_fast_assign(
+ int __len;
+ __entry->vid = volume->vid;
+ __len = min_t(int, cell->name_len, 23);
+ memcpy(__entry->cell, cell->name, __len);
+ __entry->cell[__len] = 0;
+ __len = min_t(int, volume->name_len, 23);
+ memcpy(__entry->volume, volume->name, __len);
+ __entry->volume[__len] = 0;
+ ),
+
+ TP_printk("--- MOUNT %s:%s %llx",
+ __entry->cell, __entry->volume, __entry->vid)
+ );
+
#endif /* _TRACE_AFS_H */
/* This part must be outside protection */