Skip to contentSkip to conversation

generic_file_write code segment in 2.2.18

DISCUSSION Asang K Dani 1 participant 1 message Jan 4, 2001

lore
Share & tools
lore
#0 lore raw
Quoted 26 lines · --- Andi Kleen
Quoted 2 lines · Asang K Dani
Quoted 1 line · --- Andi Kleen

On Thu, Jan 04, 2001 at 10:42:34PM +0000, Stephen C. Tweedie

Quoted 1 line · wrote:
Quoted 1 line
Quoted 1 line

No, because then you'd be skipping the updatepage() call if

we

Quoted 2 lines
Quoted 2 lines

took a

Quoted 1 line

fault mid-copy after copying some data. That would imply you

had

Quoted 7 lines
Quoted 7 lines
Quoted 3 lines

dirtied the page cache without an updatepage().

The current behaviour should just result in a short IO, which

should

Quoted 1 line

be fine.

The problem is that the short write is not reported to the

caller,

Quoted 1 line
Quoted 1 line

even when only zero bytes are copied (the page is corrupted

anyways

Quoted 7 lines
Quoted 1 line

though because cfu zeros the uncopied rest).

I think it will be reported to caller, because when cfu copies 0 bytes,

   bytes -= copy_from_user(dest, buf, bytes);
Quoted 9 lines
Quoted 1 line

will make 'bytes' zero. Since 'bytes' is 'zero' updatepage will

not

Quoted 2 lines

be called and status retains value '-EFAULT' and it breaks out of the while loop immediately.

Right for zero it is handled, but not for 1 byte copied but the rest zeroed
(which is a severe IO error)

For all those cases (when bytes != 0 after cfu), 'status' will be overwritten by the return value of 'updatepage'.

Quoted 1 line

-Andi

asang..

__________________________________________________
Do You Yahoo!?
Yahoo! Photos - Share your holiday photos online!
http://photos.yahoo.com/
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/