aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Seebach <peter.seebach@windriver.com>2014-10-03 17:27:41 +0000
committerPeter Seebach <peter.seebach@windriver.com>2014-10-03 17:27:41 +0000
commit85f1c9edd95bb0f02b4705f4a6397409ad6eb82d (patch)
treeee79fd0d7b189d45c5fd205ad4e7ffff19dc9faa
parenta0a24bc84f7c630838a04a5f49dad68c73f9a2aa (diff)
downloadpseudo-85f1c9edd95bb0f02b4705f4a6397409ad6eb82d.tar.gz
pseudo-85f1c9edd95bb0f02b4705f4a6397409ad6eb82d.tar.bz2
pseudo-85f1c9edd95bb0f02b4705f4a6397409ad6eb82d.zip
further fixups for did_unlink
So it turns out that the sanity checks should be skipped on did_unlink, because otherwise if an inode gets reused for a different file type, it'll get nuked. This is pretty rare, but appears to bite us occasionally during debug stripping.
-rw-r--r--ChangeLog.txt4
-rw-r--r--pseudo.c33
2 files changed, 20 insertions, 17 deletions
diff --git a/ChangeLog.txt b/ChangeLog.txt
index 8d7ea9a..48a3261 100644
--- a/ChangeLog.txt
+++ b/ChangeLog.txt
@@ -1,3 +1,7 @@
+2014-10-03:
+ * (seebs) in fact, suppress a lot of sanity checks entirely for
+ did_unlink.
+
2014-10-02:
* (seebs) use sqlite3_bind_int64 for inodes.
* (seebs) suppress path mismatch warnings for did_unlink.
diff --git a/pseudo.c b/pseudo.c
index b669b4a..f719eee 100644
--- a/pseudo.c
+++ b/pseudo.c
@@ -602,7 +602,11 @@ pseudo_op(pseudo_msg_t *msg, const char *program, const char *tag, char **respon
(unsigned long long) msg_header.ino,
found_ino ? "+" : "-");
- if (found_path) {
+ /* the sanity checks are inappropriate for DID_UNLINK, since it's
+ * completely legitimate to have a new database entry for the
+ * same inode.
+ */
+ if (found_path && msg->op != OP_DID_UNLINK) {
/* This is a bad sign. We should never have a different entry
* for the inode... But an inode of 0 from an EXEC is normal,
* we don't track those.
@@ -657,7 +661,11 @@ pseudo_op(pseudo_msg_t *msg, const char *program, const char *tag, char **respon
}
}
- if (found_ino) {
+ /* for OP_DID_UNLINK, the reason this op exists is that the same
+ * inode might have been reclaimed. Don't sanity-check it, and
+ * especially don't delete the database contents!
+ */
+ if (found_ino && msg->op != OP_DID_UNLINK) {
/* Not always an absolute failure case.
* If a file descriptor shows up unexpectedly and gets
* fchown()d, you could have an entry giving the inode and
@@ -711,21 +719,12 @@ 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.deleting);
} else {
- if (msg->op != OP_DID_UNLINK) {
- 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);
- } else {
- pseudo_debug(PDBGF_FILE, "path mismatch on did-unlink [%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);
- }
+ 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);
}
}
} else {