Bug 585843 - lsof does not spot files open by a thread which does not share its father's fd table
lsof does not spot files open by a thread which does not share its father's f...
Status: CLOSED NEXTRELEASE
Product: Fedora
Classification: Fedora
Component: lsof (Show other bugs)
14
All Linux
low Severity medium
: ---
: ---
Assigned To: Peter Schiffer
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2010-04-26 04:30 EDT by Jerome Marchand
Modified: 2012-05-24 09:24 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-05-24 09:24:56 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Reproducer (842 bytes, text/x-csrc)
2010-04-26 04:30 EDT, Jerome Marchand
no flags Details
Reproducer (fixed) (843 bytes, text/x-csrc)
2012-04-25 12:47 EDT, Jerome Marchand
no flags Details

  None (edit)
Description Jerome Marchand 2010-04-26 04:30:09 EDT
Created attachment 409106 [details]
Reproducer

Description of problem:
lsof does not spot files open by a thread which does not share its father's fd table.

Version-Release number of selected component (if applicable):


How reproducible:
Always.

Steps to Reproduce:
1. ./clonenofd&
2. lsof -c clonenofd |grep /tmp
3.
  
Actual results:
No opened file in /tmp/ directory is displayed by lsof.

Expected results:
It should displays a line like the following:
clonenofd 4985 root    3u   REG  253,0        0 144152 /tmp/foo.QPKwSV

Additional info:
There is a bug in kernel that make /proc/<pid>/task/<tid>/fdinfo/ gives the link to open files, like  /proc/<pid>/task/<tid>/fd/. You may have to wait for that to be solved in order to be able to show offsets correctly. I've posted a patch against that recently.
Comment 1 Bug Zapper 2010-07-30 07:28:20 EDT
This bug appears to have been reported against 'rawhide' during the Fedora 14 development cycle.
Changing version to '14'.

More information and reason for this action is here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping
Comment 2 Fedora Admin XMLRPC Client 2011-07-11 09:14:20 EDT
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.
Comment 3 Peter Schiffer 2012-04-25 12:05:30 EDT
Hi Jerome,

I am not able to compile your reproducer on F17 because of the following error:

$ gcc clonenofd.c -o clonenofd
clonenofd.c: In function ‘main’:
clonenofd.c:41:17: error: ‘CLONE_THREAD’ undeclared (first use in this function)
clonenofd.c:41:17: note: each undeclared identifier is reported only once for each function it appears in
clonenofd.c:41:32: error: ‘CLONE_SIGHAND’ undeclared (first use in this function)
clonenofd.c:41:48: error: ‘CLONE_VM’ undeclared (first use in this function)


Please, do you know how to fix it?


Thanks,

peter
Comment 4 Jerome Marchand 2012-04-25 12:47:13 EDT
Created attachment 580218 [details]
Reproducer (fixed)

_GNU_SOURCE should be defined before including the first header. This version of the reproducer corrects that.
Comment 5 Peter Schiffer 2012-05-24 06:24:37 EDT
Jerome,

I've just find out, that if you want to list tasks of processes, you have to use -K option:

$ lsof -aK -c clonenofd | grep /tmp
clonenofd 23065 23066 schiffer    3u   REG    8,3        0 1705804 /tmp/foo.x6fJhf


Please, confirm that this is what you need.


Thanks,

peter
Comment 6 Jerome Marchand 2012-05-24 09:17:47 EDT
Yes this is correct. This -K option has been added to lsof 4.84.
Comment 7 Peter Schiffer 2012-05-24 09:24:56 EDT
Thanks. Since lsof 4.84 is available in F15, I am closing this as NEXTRELEASE.

Note You need to log in before you can comment on or make changes to this bug.