Bug 130373 - (IT_48101) LTP read02 test case hangs when tmpfs is in use
LTP read02 test case hangs when tmpfs is in use
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: kernel (Show other bugs)
i686 Linux
medium Severity medium
: ---
: ---
Assigned To: Alexander Viro
Brian Brock
Depends On:
Blocks: 123574
  Show dependency treegraph
Reported: 2004-08-19 14:32 EDT by Howard Owen
Modified: 2007-11-30 17:07 EST (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2004-12-20 15:55:56 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
Program hangs on read(2) call (954 bytes, text/plain)
2004-08-19 14:35 EDT, Howard Owen
no flags Details
changes to shmem.c (845 bytes, patch)
2004-08-23 20:12 EDT, Kevin W. Rudd
no flags Details | Diff
Patch for do_shmem_file_read loop problems (1.04 KB, patch)
2004-08-30 20:55 EDT, Kevin W. Rudd
no flags Details | Diff

External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2004:550 normal SHIPPED_LIVE Updated kernel packages available for Red Hat Enterprise Linux 3 Update 4 2004-12-20 00:00:00 EST

  None (edit)
Description Howard Owen 2004-08-19 14:32:15 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.2)
Gecko/20040803 Galeon/1.3.17

Description of problem:
On a system running kernel-smp-2.4.21-15.0.4.EL, and with /tmp mounted
as tmpfs, The LTP test 'read02' hangs in R state and cannot be cleared
short of rebooting the system. The LTP source code I used for the test
is ltp-full-20040804/testcases/kernel/syscalls/read/read02.c. The
third test is the one that hangs. I wrote the attached C program based
on this test, which makes the test case more explicit. This code also
hangs when /tmp is mounted as tmpfs, and not otherwise.

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

How reproducible:

Steps to Reproduce:
1. Compile the attached C code
2. Run it.

Actual Results:  Program hangs after printing "About to Try"

Expected Results:  Program should print:

About to try
Didn't hang! rc = -1
errno = 14

Additional info:
Comment 1 Howard Owen 2004-08-19 14:35:01 EDT
Created attachment 102892 [details]
Program hangs on read(2) call

Program inlines the LTP test case

If run on a system where /tmp is mounted as tmpfs, the process will hang in 'R'
Comment 2 Kevin W. Rudd 2004-08-23 20:12:42 EDT
Created attachment 103008 [details]
changes to shmem.c

A quick look with crash shows the tmpfs test is spinning in
do_shmem_file_read().  The loop logic is a bit different from
do_generic_file_read().  For the case that is properly returning an
error, do_generic_file_read() has the following logic:

    ret = actor(desc, page, offset, nr);
    if (ret == nr && desc->count)

For the broken tmpfs case that spins, the logic is:

    while (nr && desc->count) {
    nr = file_read_actor(desc, page, offset, nr);

Simply changing this to be more like the do_generic_file_read()logic
resolved the hang problem.

    while (nr == ret && desc->count) {
    ret = file_read_actor(desc, page, offset, nr);

Diffs of the test changes attached.
Comment 3 Kevin W. Rudd 2004-08-30 20:55:29 EDT
Created attachment 103274 [details]
Patch for do_shmem_file_read loop problems

It appears that this problem has already been resolved in later 2.4 kernels. 
The attached patch file represents the changes to the loop logic found in
2.4.26.  This is just the bare essential changes needed to resolve the spinning
problem, but there are other changes to do_shmem_file_read() in the later
kernels that are probably worth picking up.
Comment 4 Mike Gahagan 2004-09-03 15:57:03 EDT
I just confirmed that RHL 9 with 2.4.20-31.9 doesn't have this problem
by mistake :). It looks like something similar to the patch in comment
3 was already applied.

Comment 6 Ernie Petrides 2004-09-24 05:39:28 EDT
A fix for this problem has just been committed to the RHEL3 U4
patch pool this evening (in kernel version 2.4.21-20.11.EL).
Comment 7 Ernie Petrides 2004-09-28 04:33:10 EDT
A fix to the prior fix has just been committed to the RHEL3 U4
patch pool this evening (in kernel version 2.4.21-20.12.EL).
Comment 8 John Flanagan 2004-12-20 15:55:56 EST
An errata 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 the 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.


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