[Cooker] Re: PATCH: 2.4.21-0.pre3.1mdk: supermount - fix ESTALE on mediachange wth busy files

2003-01-29 Thread Juan Quintela
 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 

[Cooker] Re: PATCH: 2.4.21-0.pre3.1mdk: supermount - fix ESTALE on mediachange wth busy files

2003-01-28 Thread Juan Quintela
 borzenkov == Borzenkov Andrey [EMAIL PROTECTED] writes:

borzenkov Folks, unfortunately patch in 9.0/updates (or supermount/2.4.20) is buggy;
borzenkov it has the same bug as in 9.0.
 
  BTW, I just integrated all your patches in kernel for updates (will
  be in next cooker kernel).  I just didn't delete put_inode() as
  your patch does.
 
andrey Strange. For all I can tell it was the exact reason for
 disappearing
andrey files.
 
 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.

borzenkov ESTALE was my fault, I did not expect that the same
borzenkov superblock is reused on remount with busy files. The
borzenkov attached patch plugs the hole (reinitialize
borzenkov s_media_changed) until I find a proper fix.

Just saw that :(  We have to reuse the superblock because we need a
place to store the generation value.

borzenkov Also patch does

borzenkov - mode parameter was forgotten for ext2

Applied.

borzenkov - move setting of s_media_changed to where it belongs - check_disk_change

Done.

borzenkov - add MS_SUPERMOUNTED flag for future use

Done but see below.

borzenkov - use MS_SUPERMOUNTED to properly respect reference count on CD eject
borzenkov instead of blindly disabling it

Nice, adopted.

borzenkov - self destroying message is back, it is fixed for supermount and we
borzenkov should not hide errors for other cases.

It was just a hack :p


borzenkov cd /mnt/cdrom/foo
borzenkov eject
borzenkov ls /mnt/cdrom

borzenkov will show /mnt/cdrom/foo as ESTALE. It is because d_invalidate never
borzenkov invalidates busy directory. I think I know how to fix it.

will look at that.

borzenkov TODO

borzenkov - really fix ejecting with busy files

It shouldn't be that problem, we are supposed to have the door closed
if we have busy files.  If you are using a floppy that don't have a
locking mechanism and you retire the floppy in the middle of a write,
well, you get what you asked for (an error).

borzenkov - fix the last case of improper ESTALE

I thought this one should been fixed, will look at it.

borzenkov - some more vague ideas

Humm, that is really vague.

later, Juan.

Now some comments about the patch:

+#if defined(CONFIG_SUPERMOUNT) || defined(CONFIG_SUPERMOUNT_MODULE)
+#define MS_SUPERMOUNTED (129)
+#endif

That is a bad idea, changing it to (1 17) next unused value,
MS_ACTIVE  MS_NOUSER are supposed to be very, very big numbers with
respect to the rest of the flags.


diff -ru -x '*~' -x '*.[oas]' -x '*.[oa].flags' -x .depend -x .config -x modversions.h 
-x '*.ver' -x autoconf.h -x version.h /usr/src/linux-2.4.21-0.pre3.1mdk/fs/inode.c 
linux-2.4.21-0.pre3.1mdk/fs/inode.c
--- /usr/src/linux-2.4.21-0.pre3.1mdk/fs/inode.c2003-01-16 19:18:14.0 
+0300
+++ linux-2.4.21-0.pre3.1mdk/fs/inode.c 2003-01-27 23:04:24.0 +0300
@@ -704,9 +704,6 @@
int res = 0;
 
if (sb) {
-#if defined(CONFIG_SUPERMOUNT) || defined(CONFIG_SUPERMOUNT_MODULE)
-   sb-s_media_changed = 1;
-#endif
res = invalidate_inodes(sb);
drop_super(sb);
}

We lacked here also a shrink_dcache_sb(sb); :p


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




[Cooker] Re: PATCH: 2.4.21-0.pre3.1mdk: supermount - fix ESTALE on mediachange wth busy files

2003-01-28 Thread Chmouel Boudjnah

Juan you take care to integrate them ,





[Cooker] Re: PATCH: 2.4.21-0.pre3.1mdk: supermount - fix ESTALE on mediachange wth busy files

2003-01-28 Thread Juan Quintela
 chmouel == Chmouel Boudjnah [EMAIL PROTECTED] writes:

chmouel Juan you take care to integrate them ,

will be there, integrating them in the kernel for updates.

Later, Juan.

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