“33062477e4fc182e85ea56b7dd0d41718575daf2”上不存在“make/common/git@gitcode.net:openanolis/dragonwell8_jdk.git”
提交 162ada77 编写于 作者: M Mike Marshall

Orangefs: improve the POSIXness of interrupted writes...

Don't return EINTR on interrupted writes if some data has already
been written.
Signed-off-by: NMike Marshall <hubcap@omnibond.com>
上级 cf07c0bf
...@@ -180,21 +180,57 @@ static ssize_t wait_for_direct_io(enum ORANGEFS_io_type type, struct inode *inod ...@@ -180,21 +180,57 @@ static ssize_t wait_for_direct_io(enum ORANGEFS_io_type type, struct inode *inod
} }
if (ret < 0) { if (ret < 0) {
/* if (ret == -EINTR) {
* don't write an error to syslog on signaled operation /*
* termination unless we've got debugging turned on, as * We can't return EINTR if any data was written,
* this can happen regularly (i.e. ctrl-c) * it's not POSIX. It is minimally acceptable
*/ * to give a partial write, the way NFS does.
if (ret == -EINTR) *
* It would be optimal to return all or nothing,
* but if a userspace write is bigger than
* an IO buffer, and the interrupt occurs
* between buffer writes, that would not be
* possible.
*/
switch (new_op->op_state - OP_VFS_STATE_GIVEN_UP) {
/*
* If the op was waiting when the interrupt
* occurred, then the client-core did not
* trigger the write.
*/
case OP_VFS_STATE_WAITING:
if (*offset == 0)
ret = -EINTR;
else
ret = 0;
break;
/*
* If the op was in progress when the interrupt
* occurred, then the client-core was able to
* trigger the write.
*/
case OP_VFS_STATE_INPROGR:
ret = total_size;
break;
default:
gossip_err("%s: unexpected op state :%d:.\n",
__func__,
new_op->op_state);
ret = 0;
break;
}
gossip_debug(GOSSIP_FILE_DEBUG, gossip_debug(GOSSIP_FILE_DEBUG,
"%s: returning error %ld\n", __func__, "%s: got EINTR, state:%d: %p\n",
(long)ret); __func__,
else new_op->op_state,
new_op);
} else {
gossip_err("%s: error in %s handle %pU, returning %zd\n", gossip_err("%s: error in %s handle %pU, returning %zd\n",
__func__, __func__,
type == ORANGEFS_IO_READ ? type == ORANGEFS_IO_READ ?
"read from" : "write to", "read from" : "write to",
handle, ret); handle, ret);
}
if (orangefs_cancel_op_in_progress(new_op)) if (orangefs_cancel_op_in_progress(new_op))
return ret; return ret;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册