LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 09-05-2014, 11:17 AM   #1
repdetect
LQ Newbie
 
Registered: Sep 2014
Posts: 1

Rep: Reputation: Disabled
Unhappy Deadlock occurs rarely when traversing task's open-fds


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.

Last edited by repdetect; 09-05-2014 at 07:05 PM.
 
Old 09-08-2014, 12:10 AM   #2
xode
Member
 
Registered: Aug 2003
Distribution: Mandrake 9.0; FC4; FC8; SUSE 10.3; SUSE 12.1; SUSE 13.2
Posts: 638
Blog Entries: 1

Rep: Reputation: 52
This is a wild guess on my part coming from basic multitasking principles. The rcu_read_lock() function might not be checking the state of the lock before turning the lock on. If that is the case, you need to add an additional code line to check the lock state and, if the lock is on, make the process wait until the lock is off.
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Things newcomers to open source rarely ask but often wonder LXer Syndicated Linux News 0 02-26-2014 10:51 PM
Why can not increase the open files (fds) ? chachi95 Linux - Newbie 2 09-26-2011 11:33 AM
To not have window in task bar when open? keksinen Linux - Software 2 08-07-2007 05:55 PM
Windows captions are not highlighted on the task bar when an event occurs galois82 Linux - Newbie 2 12-20-2005 02:03 PM
Default FDs arvind_tyche Programming 2 06-24-2004 10:02 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 01:10 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration