lib/repo: Add debug messages when allocating tmpdir
authorDan Nicholson <nicholson@endlessm.com>
Fri, 17 Nov 2017 16:54:33 +0000 (16:54 +0000)
committerAtomic Bot <atomic-devel@projectatomic.io>
Fri, 17 Nov 2017 18:25:22 +0000 (18:25 +0000)
This code is pretty complex and has some races when reusing tmpdirs, so
print some messages for debugging.

Closes: #1346
Approved by: cgwalters

src/libostree/ostree-repo.c

index 22214056d0e121aca09cd5b63fbb01e778c00d1a..826958002d617b0940c3d8a5c7af4055ae0bad3b 100644 (file)
@@ -4979,6 +4979,7 @@ _ostree_repo_allocate_tmpdir (int tmpdir_dfd,
       (void)futimens (target_dfd, NULL);
 
       /* We found an existing tmpdir which we managed to lock */
+      g_debug ("Reusing tmpdir %s", dent->d_name);
       ret_tmpdir.src_dfd = tmpdir_dfd;
       ret_tmpdir.fd = glnx_steal_fd (&target_dfd);
       ret_tmpdir.path = g_strdup (dent->d_name);
@@ -5003,6 +5004,7 @@ _ostree_repo_allocate_tmpdir (int tmpdir_dfd,
       if (!did_lock)
         continue;
 
+      g_debug ("Using new tmpdir %s", new_tmpdir.path);
       ret_tmpdir = new_tmpdir; /* Transfer ownership */
       new_tmpdir.initialized = FALSE;
     }