LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 09-19-2006, 11:12 AM   #1
zero_g
LQ Newbie
 
Registered: Sep 2006
Posts: 6

Rep: Reputation: 0
Question Is this a bug, or a new feature?


I think I have found a bug in the low level read() code of the 2.6.9-34 kernel from RedHat, or maybe a new feature.

To summarize, reading of a file in the same process which opened it with a F_WRLCK will fail in 2.6.9-34 but not in the 2.4.21-27 kernel.

It fails only when the disk is a cached nfs mounted disk. It works as before on local disks, and disks mounted with "noac".

Code:
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <fcntl.h>

int main (int argc, char *argv[] )
{
   int f;

   int i;
   char buff[10] = "TestBuffer";
   struct flock fl;
   fl.l_type=F_WRLCK;
   fl.l_whence=SEEK_CUR;
   fl.l_start=0;
   fl.l_len=0;

   f = open(argv[1],O_RDWR|O_CREAT|O_EXCL,0666);
   fcntl(f,F_SETLK, &fl);      
   lseek(f,0,SEEK_SET);
   write(f,buff,10);
   lseek(f,0,SEEK_SET);
   printf("read = %d\n",read(f,buff,10));
   close(f);
}
The program outputs "read = 0" on 2.6.9-34 when it cannot read from a file it opened with a F_WRLCK lock, the error condition. It will output "read = 10" always on 2.4.21-27 and when using a local disk like /tmp, or when using a disk mounted with a "noac". "read = 10" means things are working properly.

How do a report this bug? Or how do I determine if it is a bug or a new "feature"?

Last edited by zero_g; 09-21-2006 at 09:03 AM.
 
Old 09-19-2006, 12:07 PM   #2
Lenard
Senior Member
 
Registered: Dec 2005
Location: Indiana
Distribution: RHEL/CentOS/SL 5 i386 and x86_64 pata for IDE in use
Posts: 4,790

Rep: Reputation: 56
Please see; https://rhn.redhat.com/errata/RHSA-2006-0617.html
 
Old 09-20-2006, 07:57 AM   #3
zero_g
LQ Newbie
 
Registered: Sep 2006
Posts: 6

Original Poster
Rep: Reputation: 0
How is the update related to the bug?

Thanks for the link, however, it is not apparent to me how this update from Red Hat relates to my problem with the NFS disks.
 
  


Reply

Tags
file, process, read, same


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
wget 1.8.2 - feature or bug? tek1024 Linux - Software 2 02-27-2007 07:39 AM
Free86 bug or nVidia bug?? ProtoformX Linux - Software 2 05-12-2004 02:38 AM
bug or feature? Gunnyman Linspire/Freespire 5 03-06-2004 03:18 PM
intel 855GM crash - bug or feature? crashmeister Linux - Hardware 1 12-06-2003 07:46 PM
DrakPerm feature or bug? Doergn Mandriva 0 09-20-2003 05:56 AM


All times are GMT -5. The time now is 04:59 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration