From 79ddbfa500b37a94fa7501e65ebdd5c0e4c7592d Mon Sep 17 00:00:00 2001 From: David Howells Date: Thu, 25 Apr 2019 14:26:51 +0100 Subject: afs: Implement sillyrename for unlink and rename Implement sillyrename for AFS unlink and rename, using the NFS variant implementation as a basis. Note that the asynchronous file locking extender/releaser has to be notified with a state change to stop it complaining if there's a race between that and the actual file deletion. A tracepoint, afs_silly_rename, is also added to note the silly rename and the cleanup. The afs_edit_dir tracepoint is given some extra reason indicators and the afs_flock_ev tracepoint is given a silly-delete file lock cancellation indicator. Signed-off-by: David Howells --- include/trace/events/afs.h | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) (limited to 'include/trace') diff --git a/include/trace/events/afs.h b/include/trace/events/afs.h index 8da9dd5bc2b6..f67815ebb1b9 100644 --- a/include/trace/events/afs.h +++ b/include/trace/events/afs.h @@ -108,8 +108,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, }; @@ -161,6 +165,7 @@ enum afs_flock_event { 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, @@ -273,8 +278,12 @@ enum afs_flock_operation { 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") @@ -337,6 +346,7 @@ enum afs_flock_operation { 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 ") \ @@ -964,6 +974,26 @@ TRACE_EVENT(afs_reload_dir, __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) + ); + #endif /* _TRACE_AFS_H */ /* This part must be outside protection */ -- cgit v1.2.3-59-g8ed1b