lkml.org 
[lkml]   [1999]   [Aug]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRFC: proc_unregister: call release method
The revoke like functionality of proc_unregister currently
does not call the release method when access is revoked.
This makes it difficult at least to have per open state
for any procfs entry.

This patch calls the release method just before f_op is
replaced by NULL, so release can be used to clean up
per open state.

On the other hand, this may lead to complex locking issues
which I might not fully understand.

Comments?

Tom--- fs/proc/root.c 1999/08/28 12:29:08 1.1
+++ fs/proc/root.c 1999/08/28 13:04:19
@@ -381,6 +381,7 @@
struct file * filp = list_entry(p, struct file, f_list);
struct dentry * dentry;
struct inode * inode;
+ int (*release)(struct inode *, struct file *) = NULL;

dentry = filp->f_dentry;
if (!dentry)
@@ -392,7 +393,19 @@
continue;
if (inode->i_ino != ino)
continue;
+ /*
+ * 19990828, sailer@ife.ee.ethz.ch
+ * call the release method for the filp now, as it is
+ * unaccessible afterwards. Careful: if the release
+ * method pointer is non-null, proc_unregister should
+ * be called with the lock_kernel lock being held.
+ * This is the case for USB, where I intend to use this.
+ */
+ if (filp->f_op)
+ release = filp->f_op->release;
filp->f_op = NULL;
+ if (release)
+ release(inode, filp);
}
file_list_unlock();
}
\
 
 \ /
  Last update: 2005-03-22 13:53    [W:0.036 / U:0.280 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site