Page MenuHomeFreeBSD

D31672.diff
No OneTemporary

D31672.diff

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

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)

Event Timeline