Page MenuHomeFreeBSD

D31672.id95562.diff
No OneTemporary

D31672.id95562.diff

Index: sys/compat/linuxkpi/common/include/linux/fs.h
===================================================================
--- sys/compat/linuxkpi/common/include/linux/fs.h
+++ 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)
{
Index: sys/compat/linuxkpi/common/src/linux_compat.c
===================================================================
--- sys/compat/linuxkpi/common/src/linux_compat.c
+++ 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
Tue, Oct 28, 5:07 AM (13 h, 27 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
24338817
Default Alt Text
D31672.id95562.diff (1 KB)

Event Timeline