Bug 445795

Summary: /proc filesystem in RHEL4 doesn't follow usual unix filesystem conventions
Product: Red Hat Enterprise Linux 4 Reporter: Jan Lieskovsky <jlieskov>
Component: kernelAssignee: Jiri Pirko <jpirko>
Status: CLOSED ERRATA QA Contact: Martin Jenner <mjenner>
Severity: medium Docs Contact:
Priority: medium    
Version: 4.8CC: dhoward, esandeen, jbaron, lwang, riek, rkhan, rlerch, vgoyal, vmayatsk
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Cause: Bug was in the kernel for a long time. Consequence: Behaviour of /proc filesystem was different from unix usual. Fix: There were backported relevant pieces of code from upstream kernel do do the counting right. Result: Now the behaviour is correct and it follows the usual unix filesystem conventions.
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-05-18 19:31:57 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 458752, 461304    

Description Jan Lieskovsky 2008-05-09 08:42:23 UTC
Description of problem:
The -noleaf option of the find command has the following meaning:

Do not optimize by assuming that directories contain 2 fewer subdirectories
than their hard link count.

This option needs to be used on RHEL4 kernel to display correct count
of files with permissions for example of 666:

Version-Release number of selected component (if applicable):
2.6.9-67.0.7.EL 

How reproducible:
Always

Steps to Reproduce:
1. find /proc -perm 666 | wc -l
find: /proc/29869/task/29869/fd/4: No such file or directory
0

2. Find claims there are no files in /proc filesystem with 
permissions of 666.

3. But when using -noleaf option to the "find" command, the correct
number of files with 666 permissions is found:

# find /proc -noleaf -perm 666 | wc -l
find: /proc/29908/task/29908/fd/4: No such file or directory
find: /proc/29908/fd/4: No such file or directory
435


4. The same command on RHEL5(2.6.18-53.1.14.el5):

# find /proc -perm 666 | wc -l
find: /proc/17104/task/17104/fd/4: No such file or directory
find: /proc/17104/fd/4: No such file or directory
1215


5. The output of "find -noleaf" command on RHEL5:

# find /proc -noleaf -perm 666 | wc -l
find: /proc/17113/task/17113/fd/4: No such file or directory
find: /proc/17113/fd/4: No such file or directory
1215
  
Actual results:
The number of files in /proc filesystem with specific permission type is the
same on RHEL5 (with or without using -noleaf option), while on RHEL4
the output differs.

Expected results:
The output of "find -noleaf" command should be the same with or without
using the -noleaf option -- i.e. RHEL-4 /proc filesystem should follow
the Unix filesystem conventions.

Additional info:

Comment 1 Eric Sandeen 2008-05-10 05:46:54 UTC
[PATCH] procfs: Fix hardlink counts for /proc/<PID>/task
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=f246315e1ab96c40978777d1e159820ecca45aa8
and
[PATCH] procfs: Fix hardlink counts
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=bcf88e1163623e8e8ef2ba7feface9c826a890c9

look like the place to start for upstream fixes.

Comment 2 RHEL Program Management 2008-06-30 21:32:18 UTC
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release.  Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products.  This request is not yet committed for inclusion in an Update
release.

Comment 4 RHEL Program Management 2008-09-03 13:15:07 UTC
Updating PM score.

Comment 5 Vivek Goyal 2009-01-05 14:18:14 UTC
Committed in 78.23.EL . RPMS are available at http://people.redhat.com/vgoyal/rhel4/

Comment 9 Jiri Pirko 2009-03-18 11:55:01 UTC
Release note added. If any revisions are required, please set the 
"requires_release_notes" flag to "?" and edit the "Release Notes" field accordingly.
All revisions will be proofread by the Engineering Content Services team.

New Contents:
Cause: Bug was in the kernel for a long time.
Consequence: Behaviour of /proc filesystem was different from unix usual.
Fix: There were backported relevant pieces of code from upstream kernel do do the counting right.
Result: Now the behaviour is correct and it follows the usual unix filesystem conventions.

Comment 11 errata-xmlrpc 2009-05-18 19:31:57 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHSA-2009-1024.html