Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F136733147
D31672.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D31672.diff
View Options
diff --git a/sys/compat/linuxkpi/common/include/linux/fs.h b/sys/compat/linuxkpi/common/include/linux/fs.h
--- a/sys/compat/linuxkpi/common/include/linux/fs.h
+++ b/sys/compat/linuxkpi/common/include/linux/fs.h
@@ -108,6 +108,8 @@
/* pointer to associated character device, if any */
struct linux_cdev *f_cdev;
+
+ struct rcu_head rcu;
};
#define file linux_file
@@ -254,6 +256,13 @@
return (f);
}
+static inline bool
+get_file_rcu(struct linux_file *f)
+{
+ return (refcount_acquire_if_not_zero(
+ f->_file == NULL ? &f->f_count : &f->_file->f_count));
+}
+
static inline struct inode *
igrab(struct inode *inode)
{
diff --git a/sys/compat/linuxkpi/common/src/linux_compat.c b/sys/compat/linuxkpi/common/src/linux_compat.c
--- a/sys/compat/linuxkpi/common/src/linux_compat.c
+++ b/sys/compat/linuxkpi/common/src/linux_compat.c
@@ -90,6 +90,7 @@
#include <linux/poll.h>
#include <linux/smp.h>
#include <linux/wait_bit.h>
+#include <linux/rcupdate.h>
#if defined(__i386__) || defined(__amd64__)
#include <asm/smp.h>
@@ -472,7 +473,7 @@
if (filp->_file == NULL) {
if (filp->f_shmem != NULL)
vm_object_deallocate(filp->f_shmem);
- kfree(filp);
+ kfree_rcu(filp, rcu);
} else {
/*
* The close method of the character device or file
@@ -1538,6 +1539,7 @@
ldev = filp->f_cdev;
if (ldev != NULL)
linux_cdev_deref(ldev);
+ linux_synchronize_rcu(RCU_TYPE_REGULAR);
kfree(filp);
return (error);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Nov 20, 3:23 AM (16 h, 56 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
25705315
Default Alt Text
D31672.diff (1 KB)
Attached To
Mode
D31672: LinuxKPI: Implement get_file_rcu()
Attached
Detach File
Event Timeline
Log In to Comment