Hello,
I am a newbie about the Linux Kernel Module and I need some help.
Please let me know the problem with the below code.
Code:
struct fdtable *fdt = NULL;
struct file *file = NULL;
rcu_read_lock();
for_each_process(ptask) {
if (!ptask->files) continue;
spin_lock_irqsave(&f->file_lock, iflags);
fdt = files_fdtable(f);
if (fdt) {
for (i = 0; i < fdt->max_fds; i++) {
file = fcheck_files(f, i);
if (!file) continue;
if (file == some filepointer) break;
}
}
spin_unlock_irqrestore(&f->file_lock, iflags);
}
rcu_read_unlock();
I just want to traverse opened files from tasks but my system (CentOS 6.5, Kernel Version is 2.6.32-431.el6.i686) rarely hangs.
By the way I am working on netfilter hook module.
And I guess the deadlock a bit more happens when I try to open, close and switch between websites very quickly in Firefox.
I have already spent the number of days, please help me.
Thank you for any help.