>>>>> "andrey" == Andrey Borzenkov <[EMAIL PROTECTED]> writes:

>> >> Nope, you need it to have a working: extract cd, change cd,
>> >>make it working.
>> >>
>> 
borzenkov> Nope, it is just an accidental side effect. Put_inode (as
borzenkov> it was) is buggy and not needed.
>> 
>> Are you sure?  We are using put_inode() to _never_ cache inodes of
>> supermounted media after use.  Supermount relies on that behaviour.

andrey> To clarify - inode caching is not a problem because supermount never
andrey> reuse inodes. On first lookup new dentry/inode pair is allocated,
andrey> after media change inode is stale, on next lookup d_revalidate returns
andrey> false and we allocate new dentry/inode pair. (directories is 
andrey> special case but it does not change general rule). We never lookup
andrey> or reuse old inode. using force_delete just purges them from cache
andrey> faster. 

This is a nice theory, but is the thing that is failing :(

For some reason, d_revalidate() is not given the correct values :(

Just now I am having this problem when I switch CD's with ejects in
the midle of some operation:

[root@besta root]# ls /mnt/cdrom/
ls: /mnt/cdrom/libncurses5-5.2-16mdk.i586.rpm: No such file or directory
ls: /mnt/cdrom/libnetpbm9-9.10-6mdk.i586.rpm: No such file or directory
ls: /mnt/cdrom/libnewt0.50-0.50.31-1mdk.i586.rpm: No such file or directory
ls: /mnt/cdrom/libnspr4-4.1-6mdk.i586.rpm: No such file or directory
ls: /mnt/cdrom/libnss3-3.2.1-6mdk.i586.rpm: No such file or directory
ls: /mnt/cdrom/liboaf0-0.6.6-3mdk.i586.rpm: No such file or directory
ls: /mnt/cdrom/libogg0-1.0-0.rc2.1mdk.i586.rpm: No such file or directory
ls: /mnt/cdrom/libopenssl0-0.9.6b-1mdk.i586.rpm: No such file or directory
ls: /mnt/cdrom/libpcap0-0.6.2-1mdk.i586.rpm: No such file or directory
ls: /mnt/cdrom/libpcre0-3.5-1mdk.i586.rpm: No such file or directory
ls: /mnt/cdrom/libpilot-link4-0.9.5-3mdk.i586.rpm: No such file or directory
ls: /mnt/cdrom/libpng2-1.0.12-2mdk.i586.rpm: No such file or directory
ls: /mnt/cdrom/libpng2-devel-1.0.12-2mdk.i586.rpm: No such file or directory
ls: /mnt/cdrom/libprelude0-0.4.2-6mdk.i586.rpm: No such file or directory
ls: /mnt/cdrom/libpspell4-0.12.2-2mdk.i586.rpm: No such file or directory
ls: /mnt/cdrom/libptal0-0.8-1mdk.i586.rpm: No such file or directory
ls: /mnt/cdrom/libpth14-1.4.0-2mdk.i586.rpm: No such file or directory
ls: /mnt/cdrom/libqt2-2.3.1-14mdk.i586.rpm: No such file or directory
ls: /mnt/cdrom/libqtcups2-2.1-13mdk.i586.rpm: No such file or directory
ls: /mnt/cdrom/librep-0.14-1mdk.i586.rpm: No such file or directory
ls: /mnt/cdrom/librsvg1-1.0.1-1mdk.i586.rpm: No such file or directory
ls: /mnt/cdrom/libsafe-2.0.5-5mdk.i586.rpm: No such file or directory


I think that it just has happened that inode numbers of the old sub
mounted media are just given the same number than the old used ones,
but I don't know what that is happening 

(yes, there are not rpm on this root directory, it is a installation
disk of Mandrake).

borzenkov> - fix the last case of improper ESTALE
>> 
>> I thought this one should been fixed, will look at it.

andrey> No, the attached patch really fixes it. It disconnects busy dentries
andrey> from fs tree. they go away when process that holds them open goes away.


I will like this patch, just not sure about the handling of the
sb->s_root dentry.  We were assuming (for some reason I don't
remember) than the root dentry is always there.  I think that it was
to be able to not mount the subfs each time that somebody did a stat
of /mnt/cdrom.

andrey> It is as much as I expect to go into update for 9.0 (assuming no
andrey> serious bugs is found). For 9.1 if time permit see later.

borzenkov> - some more vague ideas
>> 
>> Humm, that is really vague.

andrey> No more.

andrey> - keep list of struct files; close subfs files on media change to
andrey> allow clean umount; mark supermount files as dead; provide mount
andrey> option on_media_change={TERM,KILL,EIO,ESTALE} to respectively TERM or
andrey> KILL owners or just return EIO/ESTALE on subsequent read/write and
andrey> let them handle it.

Only sane way to handle it is -EIO/ESTALE.  

andrey> - add strict_media_change option to always check; intended for slow
andrey> writable media like floppy to catch media change as soon as possible
andrey> to avoid overwriting of newly inserted floppy.

andrey> - add user interface to umount subfs; it is pretty trivial to
andrey> implement as remount option but I am not sure about permissions.
andrey> Intentional use is approximately

andrey> mount -o remount,release /mnt/floppy
andrey> format /dev/fd
andrey> mkfs /dev/fd
andrey> cp /vmlinuz /mnt/floppy

andrey> Not sure how really useful it is but it is quite trivial to implement.

andrey> - document the whole stuff

Yep, I did one beggining, but just stopped due to other things.

I have just thinkig about a way to improve the check_media mess.
- s/int s_media_changed/atomic_t s_media_changed/
  that way, we are not loosing media changes due to anything, and
  should make all things working properly.  We could safe the value of
  this when we mount the sbi to just now if the value is still valid.
  I just think that actual handling of it has still races :(


- Will integrate your patch and send you my current patch.

andrey> -andrey

PD. Would you mind using the -p option in your diffs? It just make
them easier to read, as it put the function name with each hunk :p



-- 
In theory, practice and theory are the same, but in practice they 
are different -- Larry McVoy

Reply via email to