Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 707698 - catalyst-3.0.8: fatal error trying to empty directory on NFSv4 mount due to NFS "sillyrename"
Summary: catalyst-3.0.8: fatal error trying to empty directory on NFSv4 mount due to N...
Status: RESOLVED DUPLICATE of bug 282928
Alias: None
Product: Gentoo Hosted Projects
Classification: Unclassified
Component: Catalyst (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Catalyst Developers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-02-01 05:13 UTC by Joshua Kinard
Modified: 2020-03-28 23:25 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Joshua Kinard gentoo-dev 2020-02-01 05:13:30 UTC
I've recently moved my main catalyst build directory to a NAS mountpoint over NFSv4.1.  It seems there is an old "hack" called "sillyrename", where when a client deletes/unlinks a file, the NFS server will very temporarily rename the file to ".nfs<lots of hex digits>', then signal to the client the file is deleted.  The NFS server will fully remove the file once it is sure that no other clients need it.

Catalyst chokes at this point because the Python function it uses to delete the directory (shutil.rmtree) doesn't seem to be capable of dealing with this NFS obscurity:

NOTICE:catalyst:Removing the chroot path ...
31 Jan 2020 23:50:16 EST: NOTICE  : Emptying directory: /nas/catalyst/tmp/musl/stage1-mips3-20200119
NOTICE:catalyst:Emptying directory: /nas/catalyst/tmp/musl/stage1-mips3-20200119
31 Jan 2020 23:51:25 EST: ERROR   : clear_dir failed
Traceback (most recent call last):
  File "/usr/lib/python3.7/site-packages/catalyst/fileops.py", line 85, in clear_dir
    shutil.rmtree(target)
  File "/usr/lib/python3.7/shutil.py", line 498, in rmtree
    onerror(os.rmdir, path, sys.exc_info())
  File "/usr/lib/python3.7/shutil.py", line 496, in rmtree
    os.rmdir(path)
OSError: [Errno 93] Directory not empty: '/nas/catalyst/tmp/musl/stage1-mips3-20200119'

[snip]

Traceback (most recent call last):
  File "/usr/lib/python3.7/site-packages/catalyst/fileops.py", line 85, in clear_dir
    shutil.rmtree(target)
  File "/usr/lib/python3.7/shutil.py", line 494, in rmtree
    _rmtree_safe_fd(fd, path, onerror)
  File "/usr/lib/python3.7/shutil.py", line 452, in _rmtree_safe_fd
    onerror(os.unlink, fullname, sys.exc_info())
  File "/usr/lib/python3.7/shutil.py", line 450, in _rmtree_safe_fd
    os.unlink(entry.name, dir_fd=topfd)
OSError: [Errno 16] Device or resource busy: '.nfs000000000003b4f7000062a6'
31 Jan 2020 23:51:25 EST: ERROR   : clean_stage1 failed, see previous log messages for details

Portage has similar problems when its TMPDIR is hosted on NFSv4.1, and it tries to rmdir the ${T} directory, but Portage seems to just ignore the fact that the delete command fails.  The only side-effect in this case is leftover files in $PORTAGE_TMPDIR.

I don't know of a way to disable this "sillyrename" feature on the NFS server.  It's running FreeBSD 12.1, and it seems that their upstream development has discussed disabling, or making a switch to disable it, available in FreeBSD 13.x, which is a ways off from release.

This RedHat bug may shed some light on options, though the developers there note that shutil.rmtree was not designed to handle recursively deleting directories that still has open files:
https://bugzilla.redhat.com/show_bug.cgi?id=1362667
Comment 1 Matt Turner gentoo-dev 2020-03-28 23:25:31 UTC

*** This bug has been marked as a duplicate of bug 282928 ***