diff --git a/src/db.c b/src/db.c index 8b23af16..0dc32c38 100644 --- a/src/db.c +++ b/src/db.c @@ -7055,7 +7055,10 @@ db_statements_prepare_ping(const char *table) sqlite3_stmt *stmt; int ret; - CHECK_NULL(L_DB, query = db_mprintf("UPDATE %s SET db_timestamp = ?, disabled = 0 WHERE path = ? AND db_timestamp >= ?;", table)); + // The last param will be the file mtime. We must not update if the mtime is + // newer or equal than the current db_timestamp, since the file may have been + // modified and must be rescanned. + CHECK_NULL(L_DB, query = db_mprintf("UPDATE %s SET db_timestamp = ?, disabled = 0 WHERE path = ? AND db_timestamp > ?;", table)); ret = db_blocking_prepare_v2(query, -1, &stmt, NULL); if (ret != SQLITE_OK) diff --git a/src/library/filescanner.c b/src/library/filescanner.c index 2bb208b4..ffcf9e59 100644 --- a/src/library/filescanner.c +++ b/src/library/filescanner.c @@ -572,10 +572,12 @@ process_regular_file(const char *file, struct stat *sb, int type, int flags, int char virtual_path[PATH_MAX]; int ret; - // Will return 0 if file is not in library or if file mtime is newer than library timestamp - // - note if mtime is 0 then we always scan the file if (!(flags & F_SCAN_METARESCAN)) { + // Will return 0 if file is not in library or if file mtime is not older + // than the library timestamp. If mtime is equal we must rescan, since a + // fast update may have been made, see issue #1782. If mtime is 0 then we + // always scan. ret = db_file_ping_bypath(file, sb->st_mtime); if ((sb->st_mtime != 0) && (ret != 0)) return;