PFS: when copy fails, don't change state

. makes it safe to transparently repeate i/o operation on
	  EFAULT
	. needed for future re-issued i/o operation change in VFS

Change-Id: Iea6b29f3bff19002dcd69b30569671768ac17e21
This commit is contained in:
Ben Gras 2014-02-26 15:57:08 +01:00 committed by Lionel Sambuc
parent fa901649a3
commit 8c277f99f4

View file

@ -74,18 +74,19 @@ int fs_readwrite(message *fs_m_in, message *fs_m_out)
if (r == OK) { if (r == OK) {
position += (signed) nrbytes; /* Update position */ position += (signed) nrbytes; /* Update position */
cum_io += nrbytes; cum_io += nrbytes;
/* On write, update file size and access time. */
if (rw_flag == WRITING) {
rip->i_size = position;
} else {
memmove(bp->b_data, bp->b_data+nrbytes, rip->i_size - nrbytes);
rip->i_size -= nrbytes;
}
if (rw_flag == READING) rip->i_update |= ATIME;
if (rw_flag == WRITING) rip->i_update |= CTIME | MTIME;
} }
/* On write, update file size and access time. */
if (rw_flag == WRITING) {
rip->i_size = position;
} else {
memmove(bp->b_data, bp->b_data+nrbytes, rip->i_size - nrbytes);
rip->i_size -= nrbytes;
}
if (rw_flag == READING) rip->i_update |= ATIME;
if (rw_flag == WRITING) rip->i_update |= CTIME | MTIME;
fs_m_out->RES_NBYTES = (size_t) cum_io; fs_m_out->RES_NBYTES = (size_t) cum_io;
fs_m_out->RES_SEEK_POS = rip->i_size; fs_m_out->RES_SEEK_POS = rip->i_size;