unable to umount after chroot to a NFS mounted partition
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
" " == ingok <[email protected]> writes:
> hi, trond, using 2.4.18 on client snd server side, i stumbled > across a problem where i could not umount a NFS mounted > partition after chroot'ing into it. According to lsof, there > were no processes left with open files on that partition. > Printk debugging in fs/namespace.c:do_unmount() tells that > mnt->mnt_count is still 3 so the mount is still 'busy'. > Local mount points do not have this problem and various > experiments doing different ways of chroot'ing did not solve > the problem. Do you have any ideas or can point me to a > related thread?
Hi,
I've tried to look into this, but I've never been able to duplicate the problem on my own setup.
Frankly I'd be surprised if it is an NFS bug that is causing it, since the filesystem neither knows nor should it care what the user root directory is: The VFS is supposed to run that show all on its own.
Has anybody on linux-fsdevel looked into this? Al?
Cheers,
Trond
Quoted 6 lines · Trond Myklebust
I've tried to look into this, but I've never been able to duplicate the problem on my own setup.
Frankly I'd be surprised if it is an NFS bug that is causing it, since the filesystem neither knows nor should it care what the user root directory is: The VFS is supposed to run that show all on its own.
... and VFS couldn't care less what type of filesystem it is. I'm not sure that I understand what exactly was done, though - if you chroot into filesystem it _will_ be busy as long as there is a process with root on it. But that's the expected behaviour on any Unix and it sure as hell doesn't depend on the type of filesystem. If refcount gets stuck _after_ the chrooted process goes away, though...
I would really like to see how to reproduce that.
Quoted 2 lines · Trond Myklebust
I've tried to look into this, but I've never been able to duplicate the problem on my own setup.
Hi,
i just found out that the problem only arises when mounting the root filesystem of the requested nfs server.
(Well, that might be truly a weired setup, but i just wanted to get some packages installed in a timely manner via a chrooted environment on a very! slow 486)
So mounting an arbitrary partition (not mounted as root on the requested server) behaves ok, but exporting and mounting the root partition seems to be a problem.
I was not aware that this could be a problem as i assumed that the problem has to be on the client side.
When trying to unmount the partition the server (host: noo) confirmeed the unmount request:
May 5 22:09:43 noo rpc.mountd: authenticated unmount request from mu.localnet:869 for / (/)
but the client side (host: mu) failed to unmount.
bye, ingo
Quoted 2 lines · Ingo Koehne
i just found out that the problem only arises when mounting the root filesystem of the requested nfs server.
I checked that it doesnt matter wether the root directory of that partition was mounted or an arbitrary subdirectory on the same fs (containing the necessary files to chroot into it).
It also doesnt matter if the mount was read-only or not.
Quoted 2 lines
I was not aware that this could be a problem as i assumed that the problem has to be on the client side.
It also doesnt matter if the server is in kernel or userspace.
The problem has to be on the client side, but HOW can the client even know if the filesystem is mounted at root on the server site. And how can that in turn create weired interactions with chroot? I am quite lost here, am i missing something?
Quoted 2 lines
When trying to unmount the partition the server (host: noo) confirmeed the unmount request:
...
Quoted 1 line
but the client side (host: mu) failed to unmount.
The server assumes the unmount was successful, the client is not listed with any mounts. However, accessing files from the client is still possible (seems strange to me, 'mnt' and 'umnt' obviously have other meaning than i expected).
ingo
Quoted 2 lines
Quoted 2 lines
i just found out that the problem only arises when mounting the root filesystem of the requested nfs server.
it turned out that this was wrong. it does not depend on any setting on the server (except for file contents of the requested files).
i found out that the f_count of the executable beeing started via chroot is not 0 after it exits.
this is due to non balanced calls to get_file() and fput() in nfs_create_request() and nfs_release_request().
it happens only the first
time it is started after the fs has been mounted and the missing release happens if you do the chroot with the same executable a second time. when having excessive printk in the kernel and the kernel slows down considerably the problem does not occur.
curionsly it depends on the executable being started and for some executables even on the command line options.
i still have no idea how this can have anything to do with chroot and i have no more idea what to look for.
ingo
ok, i think i have an explanation. and as this topic does not seem too intersting for everybody around, this will probably be EOT.
Quoted 7 lines · Ingo Koehne
i found out that the
f_countof the executable beeing started via chroot is not 0 after it exits.
this is due to non balanced calls toget_file()andfput()innfs_create_request()andnfs_release_request().
it happens only the first
time it is started after the fs has been mounted and the missing release happens if you do the chroot with the same executable a second time.
The last async read for the executable file never gets sent off over the network. There are no more succeeding reads that would cause an nfs_pagein_inode() in nfs_readpage_async(). It does not get flushed at process exit as open()ed files are. And the page belonging to that read gets unmapped before any nfs_page_sync() is requested.
Quoted 6 lines
when having excessive printk in the kernel and the kernel slows down considerably the problem does not occur.
curionsly it depends on the executable being started and for some executables even on the command line options.i still have no idea how this can have anything to do with chroot
All these items occur because this is a race condition between the page_sync and the unmapping of that page (eh, i really do dot exactly know what a race condition is, but the name is appropriate at least :). this is heavily affect by the timing of the events, it might also be possible that the problem only occurs an a slow ethernet (10Mb) like mine.
questions remain: i really do not know if unmapping is supposed to sync_page and how the file mapping stuff works is quite opaque to me, so i will probably have got sth wrong.
hope i have not been too annoying.
kernel debugging is quite fun anyway (it would be easier for newbies with a few more comments in the code, though).
bye ingo