Hide Forgot
Description of problem: It's not possible to umount directory, where ecryptfs was mounted. Version-Release number of selected component (if applicable): kernel-2.6.32-220.el6.x86_64 How reproducible: always Steps to Reproduce: mount something at /mnt/test, either some partition or disk image: mkdir /mnt/test dd if=/dev/zero of=disk.img bs=1M count=100 mkfs.ext3 disk.img mount disk.img /mnt/ -oloop cd /mnt/test mkdir 1 2 mount -t ecryptfs 1 2 umount 2 cd / umount /mnt/test Actual results: umount: /mnt/test: device is busy output of both: lsof | grep mnt/test and fuser -cu /mnt/test is empty Expected results: /mnt/test umounted Additional info: works in Fedora
I spent a little time looking at this and I'm able to reproduce on a RHEL 6.3 kernel. What I see boils down to the umount failing with -EBUSY because the reference count on vfsmount->mnt_count is one larger than expected in the umount path (3 rather than 2). Without knowing too much about the ecryptfs driver, I went through and tried to see where we're taking/releasing these references and I noticed that we do two nested path_lookup()'s of the same file path in the ecryptfs_get_sb() path. The first right in ecryptfs_get_sb(), the second is a kern_path() in ecryptfs_read_super(). I presume this reference is taken and held for a good reason, but thought it strange to reference twice. If I release the ecryptfs_read_super() reference before returning, the umount problem doesn't occur. I also took a look at an upstream kernel (where the problem doesn't occur), and see that the ecryptfs_read_super() functionality is essentially folded up into ecryptfs_mount(). That seems to support this as the source of the issue, but I reiterate that I don't have enough context on the driver to specifically understand/audit the expected reference counting semantics.
Ok, over to you Brian. :) Your fix looks good, and while we aren't investing a lot in ecryptfs right now, we should probably at least fix our (my ...) regressions. QA: Very easy reproducer on this one... Thanks! -Eric
This request was evaluated by Red Hat Product Management for inclusion in a Red Hat Enterprise Linux maintenance release. Product Management has requested further review of this request by Red Hat Engineering, for potential inclusion in a Red Hat Enterprise Linux Update release for currently deployed products. This request is not yet committed for inclusion in an Update release.
Patch(es) available on kernel-2.6.32-231.el6
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. http://rhn.redhat.com/errata/RHSA-2012-0862.html