[mythtv] Files still taking up disk space after unlink

Mauricio Piacentini mauricio at tabuleiro.com
Sun Oct 17 14:43:28 UTC 2004


 >a) run df to get an estimate of disk space
 >b) delete some shows (tried from two different remote frontends, should
 >not make a difference anyway.)
 >c) show is removed from db. .nuv file is removed from disk.
 >d) run df again: disk usage is reported as the same.
...
 >e) Kill the backend.
 >Now df reports the correct free disk space for the device.
 >What this suggests is that the file is still open in the backend >process
 >when unlink() takes place, and it was opened by the mythbackend >process,

OK. I have more information about this, but unfortunately could not find 
where the fd is left opened yet (or even if this is the desired behavior 
for some reason and not a bug.)

Start your backend. Now locate the mythbackend process id with ps (any 
thread will do, in my test.) Suppose it is 2555. As root, list

ls -l /proc/2555/fd

You will see the file descriptors opened by the process. Now start a 
frontend on a remote machine. Just navigate to the Media Library screen, 
and allow one show to preview. It is not necessary to play the show.

Repeat the listing above. You will see that a file descriptor for the 
.nuv file previewed is open. Now play the show. Repeat the listing: it 
now shows 2 file descriptors opened for the same show.
Quit the frontend. Now list the fds again in the backend: the file 
descriptors remain open.

Ok, now you can relaunch the frontend and delete one recording. You will 
then reproduce the issue I reported previously: the file will disappear, 
but the disk space used by it remains. Repeat the listing of fds: you 
will see that the file you deleted will be shown as an opened fd, with 
[deleted] appended to the file name. So my initial guess is correct: 
disk space is not reclaimed because mythbackend still retains a file 
descriptor.

Now I tried to find the place where the fd is being left opened, but 
could not find it. Anyone wants to guess? I suspected

void TV::HandleStateChange(void)

since it creates new RingBuffers() apparently without destroying the old 
ones, but this is not the case...

Maybe the fd is inherited when a pthread is spawned, or something like 
that? Or maybe this is a non issue. It does not look like, as I allowed 
my backend to be alive for about 12 hours and the free space was not 
reclaimed.

Regards,
Mauricio


More information about the mythtv-dev mailing list