aboutsummaryrefslogtreecommitdiffstats
path: root/pseudo_db.c
diff options
context:
space:
mode:
authorPeter Seebach <peter.seebach@windriver.com>2014-10-03 18:38:28 +0000
committerPeter Seebach <peter.seebach@windriver.com>2014-10-03 17:34:36 -0500
commitee00f63d0ffee405de95562f4b88cb92a7b3a033 (patch)
tree45f1c8361174aeab2798d8bd60b10b7f6e12f294 /pseudo_db.c
parent85f1c9edd95bb0f02b4705f4a6397409ad6eb82d (diff)
downloadpseudo-ee00f63d0ffee405de95562f4b88cb92a7b3a033.tar.gz
pseudo-ee00f63d0ffee405de95562f4b88cb92a7b3a033.tar.bz2
pseudo-ee00f63d0ffee405de95562f4b88cb92a7b3a033.zip
Possibly fix strange corruptions
Trying to track down problems which sometimes result in files showing up as nameless files, producing clashes later. Looks like there were two issues; one is we were creating links for files that we'd already found by inode. The other is that rename was sending bogus LINK messages in some cases. Also simplified the find_file_dev path to extract the path as part of the initial operation, since there wasn't any case where that wasn't being done immediately afterwards.
Diffstat (limited to 'pseudo_db.c')
-rw-r--r--pseudo_db.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/pseudo_db.c b/pseudo_db.c
index bbc71f0..f60f0ab 100644
--- a/pseudo_db.c
+++ b/pseudo_db.c
@@ -1401,7 +1401,7 @@ pdb_link_file(pseudo_msg_t *msg, long long *row) {
sqlite3_bind_int(insert, 5, msg->gid);
sqlite3_bind_int(insert, 6, msg->mode);
sqlite3_bind_int(insert, 7, msg->rdev);
- pseudo_debug(PDBGF_DB, "linking %s: dev %llu, ino %llu, mode %o, owner %d\n",
+ pseudo_debug(PDBGF_DB | PDBGF_FILE, "linking %s: dev %llu, ino %llu, mode %o, owner %d\n",
(msg->pathlen ? msg->path : "<nil> (as NAMELESS FILE)"),
(unsigned long long) msg->dev, (unsigned long long) msg->ino,
(int) msg->mode, msg->uid);
@@ -2113,7 +2113,7 @@ pdb_get_file_path(pseudo_msg_t *msg) {
/* find file using dev/inode as key */
int
-pdb_find_file_dev(pseudo_msg_t *msg, long long *row) {
+pdb_find_file_dev(pseudo_msg_t *msg, long long *row, char **path) {
static sqlite3_stmt *select;
int rc;
char *sql = "SELECT * FROM files WHERE dev = ? AND ino = ?;";
@@ -2145,6 +2145,12 @@ pdb_find_file_dev(pseudo_msg_t *msg, long long *row) {
msg->mode = (unsigned long) sqlite3_column_int64(select, 6);
msg->rdev = (unsigned long) sqlite3_column_int64(select, 7);
msg->deleting = (int) sqlite3_column_int64(select, 8);
+ /* stash path */
+ if (path) {
+ *path = strdup((char *) sqlite3_column_text(select, 1));
+ pseudo_debug(PDBGF_FILE, "find_file_dev: path %s\n",
+ *path ? *path : "<nil>");
+ }
rc = 0;
break;
case SQLITE_DONE: