aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2020-10-08 14:59:15 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-10-08 15:00:10 +0100
commitd8d1c38bc12c283e7d113a2dfe0691fca804b570 (patch)
treeda76be4cc41a3af994c5aea9fb81b368f91be5bb
parentf3ae0c96e012426a8bcb6f881d1c8c30f9673b14 (diff)
downloadpseudo-d8d1c38bc12c283e7d113a2dfe0691fca804b570.tar.gz
pseudo-d8d1c38bc12c283e7d113a2dfe0691fca804b570.tar.bz2
pseudo-d8d1c38bc12c283e7d113a2dfe0691fca804b570.zip
pseudo_client: Allow server to tell the client to abort() on path mismatches
Rather than mapping mismatched inode entries to paths, thrown an abort() instead. Add a new result type to allow the server to pass back this instruction to the client. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--enums/res.in1
-rw-r--r--pseudo.c9
-rw-r--r--pseudo_client.c4
3 files changed, 9 insertions, 5 deletions
diff --git a/enums/res.in b/enums/res.in
index 435338f..b0096b4 100644
--- a/enums/res.in
+++ b/enums/res.in
@@ -2,3 +2,4 @@ res: RESULT
succeed
fail
error
+abort
diff --git a/pseudo.c b/pseudo.c
index 73843d0..331a20c 100644
--- a/pseudo.c
+++ b/pseudo.c
@@ -695,17 +695,15 @@ pseudo_op(pseudo_msg_t *msg, const char *program, const char *tag, char **respon
msg->path);
pdb_did_unlink_file(path_by_ino, &by_ino, by_ino.deleting);
} else {
- int flags = 0;
- if (msg->nlink > 1) {
- flags = PDBGF_FILE | PDBGF_VERBOSE;
- }
- pseudo_debug(flags, "path mismatch [%d link%s]: ino %llu db '%s' req '%s'.\n",
+ pseudo_diag("path mismatch [%d link%s]: ino %llu db '%s' req '%s'.\n",
msg->nlink,
msg->nlink == 1 ? "" : "s",
(unsigned long long) msg_header.ino,
path_by_ino ? path_by_ino : "no path",
msg->path);
found_ino = 0;
+ msg->result = RESULT_ABORT;
+ goto op_exit;
}
}
} else {
@@ -1025,6 +1023,7 @@ pseudo_op(pseudo_msg_t *msg, const char *program, const char *tag, char **respon
break;
}
+op_exit:
/* in the case of an exact match, we just used the pointer
* rather than allocating space.
*/
diff --git a/pseudo_client.c b/pseudo_client.c
index 401f141..bcaf2dd 100644
--- a/pseudo_client.c
+++ b/pseudo_client.c
@@ -1923,6 +1923,10 @@ pseudo_client_op(pseudo_op_t op, int access, int fd, int dirfd, const char *path
#endif
if (result) {
pseudo_debug(PDBGF_OP, "(%d) %s", getpid(), pseudo_res_name(result->result));
+ if (result->result == RESULT_ABORT) {
+ pseudo_diag("abort()ing pseudo client by server request. See https://wiki.yoctoproject.org/wiki/Pseudo_Abort for more details on this.\n");
+ abort();
+ }
if (op == OP_STAT || op == OP_FSTAT) {
pseudo_debug(PDBGF_OP, " mode 0%o uid %d:%d",
(int) result->mode,