From: ira.weiny@intel.com
To: lsf-pc@lists.linux-foundation.org
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-mm@kvack.org, "Dan Williams" <dan.j.williams@intel.com>,
"Jan Kara" <jack@suse.cz>, "Jérôme Glisse" <jglisse@redhat.com>,
"John Hubbard" <jhubbard@nvidia.com>,
"Michal Hocko" <mhocko@suse.com>,
"Ira Weiny" <ira.weiny@intel.com>
Subject: [RFC PATCH 01/10] fs/locks: Add trace_leases_conflict
Date: Sun, 28 Apr 2019 21:53:50 -0700 [thread overview]
Message-ID: <20190429045359.8923-2-ira.weiny@intel.com> (raw)
In-Reply-To: <20190429045359.8923-1-ira.weiny@intel.com>
From: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Ira Weiny <ira.weiny@intel.com>
---
fs/locks.c | 20 ++++++++++++++-----
include/trace/events/filelock.h | 35 +++++++++++++++++++++++++++++++++
2 files changed, 50 insertions(+), 5 deletions(-)
diff --git a/fs/locks.c b/fs/locks.c
index eaa1cfaf73b0..4b66ed91fb53 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -1528,11 +1528,21 @@ static void time_out_leases(struct inode *inode, struct list_head *dispose)
static bool leases_conflict(struct file_lock *lease, struct file_lock *breaker)
{
- if ((breaker->fl_flags & FL_LAYOUT) != (lease->fl_flags & FL_LAYOUT))
- return false;
- if ((breaker->fl_flags & FL_DELEG) && (lease->fl_flags & FL_LEASE))
- return false;
- return locks_conflict(breaker, lease);
+ bool rc;
+
+ if ((breaker->fl_flags & FL_LAYOUT) != (lease->fl_flags & FL_LAYOUT)) {
+ rc = false;
+ goto trace;
+ }
+ if ((breaker->fl_flags & FL_DELEG) && (lease->fl_flags & FL_LEASE)) {
+ rc = false;
+ goto trace;
+ }
+
+ rc = locks_conflict(breaker, lease);
+trace:
+ trace_leases_conflict(rc, lease, breaker);
+ return rc;
}
static bool
diff --git a/include/trace/events/filelock.h b/include/trace/events/filelock.h
index fad7befa612d..4b735923f2ff 100644
--- a/include/trace/events/filelock.h
+++ b/include/trace/events/filelock.h
@@ -203,6 +203,41 @@ TRACE_EVENT(generic_add_lease,
show_fl_type(__entry->fl_type))
);
+TRACE_EVENT(leases_conflict,
+ TP_PROTO(bool conflict, struct file_lock *lease, struct file_lock *breaker),
+
+ TP_ARGS(conflict, lease, breaker),
+
+ TP_STRUCT__entry(
+ __field(void *, lease)
+ __field(void *, breaker)
+ __field(unsigned int, l_fl_flags)
+ __field(unsigned int, b_fl_flags)
+ __field(unsigned char, l_fl_type)
+ __field(unsigned char, b_fl_type)
+ __field(bool, conflict)
+ ),
+
+ TP_fast_assign(
+ __entry->lease = lease;
+ __entry->l_fl_flags = lease->fl_flags;
+ __entry->l_fl_type = lease->fl_type;
+ __entry->breaker = breaker;
+ __entry->b_fl_flags = breaker->fl_flags;
+ __entry->b_fl_type = breaker->fl_type;
+ __entry->conflict = conflict;
+ ),
+
+ TP_printk("conflict %d: lease=0x%p fl_flags=%s fl_type=%s; breaker=0x%p fl_flags=%s fl_type=%s",
+ __entry->conflict,
+ __entry->lease,
+ show_fl_flags(__entry->l_fl_flags),
+ show_fl_type(__entry->l_fl_type),
+ __entry->breaker,
+ show_fl_flags(__entry->b_fl_flags),
+ show_fl_type(__entry->b_fl_type))
+);
+
#endif /* _TRACE_FILELOCK_H */
/* This part must be outside protection */
--
2.20.1
next prev parent reply other threads:[~2019-04-29 4:54 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-29 4:53 [RFC PATCH 00/10] RDMA/FS DAX "LONGTERM" lease proposal ira.weiny
2019-04-29 4:53 ` ira.weiny [this message]
2019-04-29 4:53 ` [RFC PATCH 02/10] fs/locks: Introduce FL_LONGTERM file lease ira.weiny
2019-04-29 4:53 ` [RFC PATCH 03/10] mm/gup: Pass flags down to __gup_device_huge* calls ira.weiny
2019-04-29 4:53 ` [RFC PATCH 04/10] WIP: mm/gup: Ensure F_LONGTERM lease is held on GUP pages ira.weiny
2019-04-29 4:53 ` [RFC PATCH 05/10] mm/gup: Take FL_LONGTERM lease if not set by user ira.weiny
2019-04-29 4:53 ` [RFC PATCH 06/10] fs/locks: Add longterm lease traces ira.weiny
2019-04-29 4:53 ` [RFC PATCH 07/10] fs/dax: Create function dax_mapping_is_dax() ira.weiny
2019-04-29 4:53 ` [RFC PATCH 08/10] mm/gup: fs: Send SIGBUS on truncate of active file ira.weiny
2019-04-29 4:53 ` [RFC PATCH 09/10] fs/locks: Add tracepoint for SIGBUS on LONGTERM expiration ira.weiny
2019-04-29 4:53 ` [RFC PATCH 10/10] mm/gup: Remove FOLL_LONGTERM DAX exclusion ira.weiny
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190429045359.8923-2-ira.weiny@intel.com \
--to=ira.weiny@intel.com \
--cc=dan.j.williams@intel.com \
--cc=jack@suse.cz \
--cc=jglisse@redhat.com \
--cc=jhubbard@nvidia.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lsf-pc@lists.linux-foundation.org \
--cc=mhocko@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).