Skip to contentSkip to conversation

Let the read retry on short reads.

PATCH In review Venkateswararao Jujjuri (JV) 3 participants 6 messages Aug 17, 2010 – Aug 23, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Let the read retry on short reads.

A simple fix to retry on short reads.

---
 fs/9p/vfs_file.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
fs/9p/vfs_file.c +1 -1
index 2695491..cae984d 100644
@@ -166,7 +166,7 @@ v9fs_file_readn(struct file *filp, char *data, char __user *udata, u32 count,
 		offset += n;
 		count -= n;
 		total += n;
-	} while (count > 0 && n == size);
+	} while (count > 0);
 
 	if (n < 0)
 		total = n;
Signature · 1 line
1.6.5.2
maintainer
#1 lore raw

What problem does that change solve? It adds an additional call when EOF is reached. The way most user apps are written, that'll mean two calls that return Rread count 0.

I was thinking of doing a similar change, but decided against it.

Thanks,
Lucho

Quoted 27 lines · Venkateswararao Jujjuri (JV)

A simple fix to retry on short reads.

---
 fs/9p/vfs_file.c |    2 +-

 1 files changed, 1 insertions(+), 1 deletions(-)
fs/9p/vfs_file.c +1 -2
index 2695491..cae984d 100644
@@ -166,7 +166,7 @@ v9fs_file_readn(struct file *filp, char *data, char __user *udata, u32 count,
                offset += n;
                count -= n;
                total += n;
-       } while (count > 0 && n == size);
+       } while (count > 0);
 
        if (n < 0)
                total = n;
--

1.6.5.2

------------------------------------------------------------------------------
This SF.net email is sponsored by

Quoted 8 lines

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev
_______________________________________________
V9fs-developer mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/v9fs-developer

--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw
Quoted 5 lines · Latchesar Ionkov

What problem does that change solve? It adds an additional call when EOF is reached. The way most user apps are written, that'll mean two calls that return Rread count 0.

I was thinking of doing a similar change, but decided against it.

Yeah I ran into the issue when tried with o_direct and dd.

Can we depend on the application retrying?
Yes I also observed the behavior you are mentioning (2 Rreads returning 0) Wondering if we have a better way to address this.

Thanks,
JV

Quoted 41 lines

Thanks,
Lucho

Quoted 35 lines · Venkateswararao Jujjuri (JV)

A simple fix to retry on short reads.

---
 fs/9p/vfs_file.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
fs/9p/vfs_file.c +1 -2
index 2695491..cae984d 100644
@@ -166,7 +166,7 @@ v9fs_file_readn(struct file *filp, char *data, char __user *udata, u32 count,
               offset += n;
               count -= n;
               total += n;
-       } while (count > 0 && n == size);
+       } while (count > 0);
 
       if (n < 0)
               total = n;
--

1.6.5.2

------------------------------------------------------------------------------
This SF.net email is sponsored by

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev
_______________________________________________
V9fs-developer mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/v9fs-developer

maintainer
#3 lore raw

The only solution I can think of is to use the iounit value the file server returns (and not the msize as we do now). If iounit is 0, allow short reads, if iounit is more than zero and the read returns less that the iounit, don't try anymore.

This kind of passes the problem to the file server, but I guess that's the right place to solve it anyway.

Thanks,
Lucho

Quoted 49 lines · Venkateswararao Jujjuri (JV)
Quoted 5 lines · Latchesar Ionkov

What problem does that change solve? It adds an additional call when EOF is reached. The way most user apps are written, that'll mean two calls that return Rread count 0.

I was thinking of doing a similar change, but decided against it.

Yeah I ran into the issue when tried with o_direct and dd.

Can we depend on the application retrying?
Yes I also observed the behavior you are mentioning (2 Rreads returning 0) Wondering if we have a better way to address this.

Thanks,
JV

Quoted 33 lines

Thanks,
    Lucho

Quoted 27 lines · Venkateswararao Jujjuri (JV)

A simple fix to retry on short reads.

---
 fs/9p/vfs_file.c |    2 +-

 1 files changed, 1 insertions(+), 1 deletions(-)
fs/9p/vfs_file.c +1 -2
index 2695491..cae984d 100644
@@ -166,7 +166,7 @@ v9fs_file_readn(struct file *filp, char *data, char __user *udata, u32 count,
                offset += n;
                count -= n;
                total += n;
-       } while (count > 0 && n == size);
+       } while (count > 0);
 
        if (n < 0)
                total = n;
--

1.6.5.2

------------------------------------------------------------------------------
This SF.net email is sponsored by

Quoted 11 lines
Quoted 8 lines
Quoted 8 lines

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev
_______________________________________________
V9fs-developer mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/v9fs-developer

--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#4 lore raw
Quoted 8 lines · Latchesar Ionkov

The only solution I can think of is to use the iounit value the file server returns (and not the msize as we do now). If iounit is 0, allow short reads, if iounit is more than zero and the read returns less that the iounit, don't try anymore.

This kind of passes the problem to the file server, but I guess that's the right place to solve it anyway.

What's the potential impact on existing serves? What does Plan 9 expect?

read(5) says:
The count field in the reply indicates the number of bytes returned. This may be less than the requested amount. If the offset field is greater than or equal to the number of bytes in the file, a count of zero will be returned.

I'd say if we wanted to do something different, I would need to be conditional by 9p2000.u/9p2000.L -- I don't want to break existing servers/clients that might rely on this behavior to frame messages (like pipes, the IP stack, etc.)

-eric

maintainer
#5 lore raw

The potential impact is that if the existing server returns iounit==0, there will be two Rread count 0. Which is perfectly fine with 9P, just a bit slower. I am not sure how Plan9 handles the case.

Thanks,
Lucho

Quoted 18 lines · Eric Van Hensbergen
Quoted 8 lines · Latchesar Ionkov

The only solution I can think of is to use the iounit value the file server returns (and not the msize as we do now). If iounit is 0, allow short reads, if iounit is more than zero and the read returns less that the iounit, don't try anymore.

This kind of passes the problem to the file server, but I guess that's the right place to solve it anyway.

What's the potential impact on existing serves?  What does Plan 9 expect?

read(5) says:
The count field in the reply indicates the number of bytes returned. This may be less than the requested amount. If the offset field is greater than or equal to the number of bytes in the file, a count of zero will be returned.

Quoted 7 lines

I'd say if we wanted to do something different, I would need to be conditional by 9p2000.u/9p2000.L -- I don't want to break existing servers/clients that might rely on this behavior to frame messages (like pipes, the IP stack, etc.)

        -eric

--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html