lkml.org 
[lkml]   [2000]   [Mar]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [bugfix] SMP, shm-2.3.52-A0
Ingo Molnar wrote:
>
> shm.c calls filp_open without the kernel lock held - this is illegal
> because the dentry code is not yet SMP-threaded. The attached patch
> (against pre3-2.3.52) fixes this.

Prevent this from ever happening again....



diff -uNr linux-2.3.99-pre1/include/linux/kassert.h linux-akpm/include/linux/kassert.h
--- linux-2.3.99-pre1/include/linux/kassert.h Thu Jan 1 10:00:00 1970
+++ linux-akpm/include/linux/kassert.h Fri Mar 17 10:36:34 2000
@@ -0,0 +1,21 @@
+#ifndef _KASSERT_H_
+#define _KASSERT_H_
+
+#define KASSERTS_ENABLED 1
+
+#if KASSERTS_ENABLED
+#define KASSERT_FAIL() \
+ do { \
+ printk("assertion failure at %s:%d\n", __FILE__, __LINE__); \
+ } while (0)
+
+#define KASSERT(expr) \
+ do { \
+ if (!(expr)) \
+ KASSERT_FAIL(); \
+ } while (0)
+#else
+#define KASSERT(expr) ((void)0)
+#endif
+
+#endif /* _KASSERT_H_ */
--- linux-2.3.99-pre1/fs/open.c Fri Mar 17 11:50:30 2000
+++ linux-akpm/fs/open.c Fri Mar 17 10:48:06 2000
@@ -10,6 +10,7 @@
#include <linux/file.h>
#include <linux/smp_lock.h>
#include <linux/quotaops.h>
+#include <linux/kassert.h>

#include <asm/uaccess.h>

@@ -650,6 +651,8 @@
struct dentry * dentry;
struct file * f;
int flag,error;
+
+ KASSERT(spin_is_locked(&kernel_flag));

error = -ENFILE;
f = get_empty_filp();
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:57    [W:0.058 / U:0.272 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site