public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* HELP! vfs_readv() issue
@ 2006-05-15 23:57 Xin Zhao
  2006-05-16  4:31 ` Chris Wedgwood
  0 siblings, 1 reply; 5+ messages in thread
From: Xin Zhao @ 2006-05-15 23:57 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-fsdevel

I am writing a file system, but vfs_read() sometimes return 0. What
could cause this problem?

Please help!

Xin

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: HELP! vfs_readv() issue
  2006-05-15 23:57 HELP! vfs_readv() issue Xin Zhao
@ 2006-05-16  4:31 ` Chris Wedgwood
  2006-05-17 21:44   ` Xin Zhao
  0 siblings, 1 reply; 5+ messages in thread
From: Chris Wedgwood @ 2006-05-16  4:31 UTC (permalink / raw)
  To: Xin Zhao; +Cc: linux-kernel, linux-fsdevel

On Mon, May 15, 2006 at 07:57:21PM -0400, Xin Zhao wrote:

> I am writing a file system, but vfs_read() sometimes return 0. What
> could cause this problem?

EOF?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: HELP! vfs_readv() issue
  2006-05-16  4:31 ` Chris Wedgwood
@ 2006-05-17 21:44   ` Xin Zhao
  2006-05-18 18:00     ` Avishay Traeger
  0 siblings, 1 reply; 5+ messages in thread
From: Xin Zhao @ 2006-05-17 21:44 UTC (permalink / raw)
  To: Chris Wedgwood; +Cc: linux-kernel, linux-fsdevel

Thank you for your care. What I am trying to do is to rewrite NFS in
the virtual machine environment so that network communication can be
replaced with inter-VM communication.

But after I remove the original rpc stuff, I ran into some strange
problem, including this one.  Interesting thing is that I noticed that
even with standard NFS implementation, it is still possible that
nfsd_read() return resp->count to be 0. At this time, eof is also
equal to 1. This seems to be right since NFSD already reach the end of
the file. But question is since 0 byte is read this time, NFS should
detect EOF in previous read. Why need one more read?

Xin

On 5/16/06, Chris Wedgwood <cw@f00f.org> wrote:
> On Mon, May 15, 2006 at 07:57:21PM -0400, Xin Zhao wrote:
>
> > I am writing a file system, but vfs_read() sometimes return 0. What
> > could cause this problem?
>
> EOF?
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: HELP! vfs_readv() issue
  2006-05-17 21:44   ` Xin Zhao
@ 2006-05-18 18:00     ` Avishay Traeger
  2006-05-18 18:12       ` Petr Vandrovec
  0 siblings, 1 reply; 5+ messages in thread
From: Avishay Traeger @ 2006-05-18 18:00 UTC (permalink / raw)
  To: Xin Zhao; +Cc: Chris Wedgwood, linux-kernel, linux-fsdevel

On Wed, 2006-05-17 at 17:44 -0400, Xin Zhao wrote:
> Thank you for your care. What I am trying to do is to rewrite NFS in
> the virtual machine environment so that network communication can be
> replaced with inter-VM communication.
> 
> But after I remove the original rpc stuff, I ran into some strange
> problem, including this one.  Interesting thing is that I noticed that
> even with standard NFS implementation, it is still possible that
> nfsd_read() return resp->count to be 0. At this time, eof is also
> equal to 1. This seems to be right since NFSD already reach the end of
> the file. But question is since 0 byte is read this time, NFS should
> detect EOF in previous read. Why need one more read?
> 
> Xin

How are you reading the file?  Some programs (I believe 'cat' is one of
them) will read a file until 0 is returned.  Try writing a small C
program to read a file until EOF and see if the behavior changes.

Avishay Traeger
http://www.fsl.cs.sunysb.edu/~avishay/


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: HELP! vfs_readv() issue
  2006-05-18 18:00     ` Avishay Traeger
@ 2006-05-18 18:12       ` Petr Vandrovec
  0 siblings, 0 replies; 5+ messages in thread
From: Petr Vandrovec @ 2006-05-18 18:12 UTC (permalink / raw)
  To: Avishay Traeger; +Cc: Xin Zhao, Chris Wedgwood, linux-kernel, linux-fsdevel

Avishay Traeger wrote:
> On Wed, 2006-05-17 at 17:44 -0400, Xin Zhao wrote:
> 
>>Thank you for your care. What I am trying to do is to rewrite NFS in
>>the virtual machine environment so that network communication can be
>>replaced with inter-VM communication.
>>
>>But after I remove the original rpc stuff, I ran into some strange
>>problem, including this one.  Interesting thing is that I noticed that
>>even with standard NFS implementation, it is still possible that
>>nfsd_read() return resp->count to be 0. At this time, eof is also
>>equal to 1. This seems to be right since NFSD already reach the end of
>>the file. But question is since 0 byte is read this time, NFS should
>>detect EOF in previous read. Why need one more read?
>>
>>Xin
> 
> 
> How are you reading the file?  Some programs (I believe 'cat' is one of
> them) will read a file until 0 is returned.  Try writing a small C
> program to read a file until EOF and see if the behavior changes.

Returning 0 from read() is only situation when you can be sure you are at the 
end of file.  If you get short read(), it may be short due to EOF, but it may be 
short also because some error was hit - EIO and EFAULT are two which can occur 
almost always.  And only next read will either return that error (or some other 
error, or success if error condition disappeared meanwhile), or zero if it is 
really EOF.
								Petr


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2006-05-18 18:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-05-15 23:57 HELP! vfs_readv() issue Xin Zhao
2006-05-16  4:31 ` Chris Wedgwood
2006-05-17 21:44   ` Xin Zhao
2006-05-18 18:00     ` Avishay Traeger
2006-05-18 18:12       ` Petr Vandrovec

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox