mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-02 20:29:20 +00:00
locks: add some tracepoints in the lease handling code
v2: add a __break_lease tracepoint for non-blocking case Recently, I needed these to help track down a softlockup when recalling a delegation, but they might be helpful in other situations as well. Cc: "J. Bruce Fields" <bfields@fieldses.org> Signed-off-by: Jeff Layton <jlayton@poochiereds.net>
This commit is contained in:
parent
5315c26a6c
commit
62af4f1f7d
2 changed files with 107 additions and 0 deletions
11
fs/locks.c
11
fs/locks.c
|
@ -130,6 +130,9 @@
|
|||
#include <linux/percpu.h>
|
||||
#include <linux/lglock.h>
|
||||
|
||||
#define CREATE_TRACE_POINTS
|
||||
#include <trace/events/filelock.h>
|
||||
|
||||
#include <asm/uaccess.h>
|
||||
|
||||
#define IS_POSIX(fl) (fl->fl_flags & FL_POSIX)
|
||||
|
@ -1287,6 +1290,7 @@ static void time_out_leases(struct inode *inode)
|
|||
|
||||
before = &inode->i_flock;
|
||||
while ((fl = *before) && IS_LEASE(fl) && lease_breaking(fl)) {
|
||||
trace_time_out_leases(inode, fl);
|
||||
if (past_time(fl->fl_downgrade_time))
|
||||
lease_modify(before, F_RDLCK);
|
||||
if (past_time(fl->fl_break_time))
|
||||
|
@ -1374,6 +1378,7 @@ int __break_lease(struct inode *inode, unsigned int mode, unsigned int type)
|
|||
}
|
||||
|
||||
if (i_have_this_lease || (mode & O_NONBLOCK)) {
|
||||
trace_break_lease_noblock(inode, new_fl);
|
||||
error = -EWOULDBLOCK;
|
||||
goto out;
|
||||
}
|
||||
|
@ -1385,10 +1390,12 @@ restart:
|
|||
if (break_time == 0)
|
||||
break_time++;
|
||||
locks_insert_block(flock, new_fl);
|
||||
trace_break_lease_block(inode, new_fl);
|
||||
spin_unlock(&inode->i_lock);
|
||||
error = wait_event_interruptible_timeout(new_fl->fl_wait,
|
||||
!new_fl->fl_next, break_time);
|
||||
spin_lock(&inode->i_lock);
|
||||
trace_break_lease_unblock(inode, new_fl);
|
||||
locks_delete_block(new_fl);
|
||||
if (error >= 0) {
|
||||
if (error == 0)
|
||||
|
@ -1510,6 +1517,8 @@ static int generic_add_lease(struct file *filp, long arg, struct file_lock **flp
|
|||
int error;
|
||||
|
||||
lease = *flp;
|
||||
trace_generic_add_lease(inode, lease);
|
||||
|
||||
/*
|
||||
* In the delegation case we need mutual exclusion with
|
||||
* a number of operations that take the i_mutex. We trylock
|
||||
|
@ -1599,6 +1608,8 @@ static int generic_delete_lease(struct file *filp, struct file_lock **flp)
|
|||
struct dentry *dentry = filp->f_path.dentry;
|
||||
struct inode *inode = dentry->d_inode;
|
||||
|
||||
trace_generic_delete_lease(inode, *flp);
|
||||
|
||||
for (before = &inode->i_flock;
|
||||
((fl = *before) != NULL) && IS_LEASE(fl);
|
||||
before = &fl->fl_next) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue