summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2019-07-10 19:21:38 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2019-07-10 19:21:38 -0700
commit988052f47adc5c3b0b004180b59bb3761d91b752 (patch)
tree044dbcb77fa966b01ad1a4c9b211dccaa62b29a0 /include
parent028db3e290f15ac509084c0fc3b9d021f668f877 (diff)
parent387e3746d01c34457d6a73688acd90428725070b (diff)
downloadlinux-988052f47adc5c3b0b004180b59bb3761d91b752.tar.bz2
Merge tag 'locks-v5.3-1' of git://git.kernel.org/pub/scm/linux/kernel/git/jlayton/linux
Pull file locking updates from Jeff Layton: "Just a couple of small lease-related patches this cycle. One from Ira to add a new tracepoint that fires during lease conflict checks, and another patch from Amir to reduce false positives when checking for lease conflicts" * tag 'locks-v5.3-1' of git://git.kernel.org/pub/scm/linux/kernel/git/jlayton/linux: locks: eliminate false positive conflicts for write lease locks: Add trace_leases_conflict
Diffstat (limited to 'include')
-rw-r--r--include/linux/fs.h4
-rw-r--r--include/trace/events/filelock.h35
2 files changed, 37 insertions, 2 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h
index c564cf3f48d9..4fb399b77327 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -694,7 +694,7 @@ struct inode {
atomic_t i_count;
atomic_t i_dio_count;
atomic_t i_writecount;
-#ifdef CONFIG_IMA
+#if defined(CONFIG_IMA) || defined(CONFIG_FILE_LOCKING)
atomic_t i_readcount; /* struct files open RO */
#endif
union {
@@ -2890,7 +2890,7 @@ static inline bool inode_is_open_for_write(const struct inode *inode)
return atomic_read(&inode->i_writecount) > 0;
}
-#ifdef CONFIG_IMA
+#if defined(CONFIG_IMA) || defined(CONFIG_FILE_LOCKING)
static inline void i_readcount_dec(struct inode *inode)
{
BUG_ON(!atomic_read(&inode->i_readcount));
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 */