lkml.org 
[lkml]   [1997]   [Sep]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: Bug in caching of mount options
Jim Nance wrote:
> I have found a bug in the kernel, which I believe is related to the
> caching of mount options. It shows up under both 2.0.31-pre10 and
> 2.1.57.
>
> If I mount a filesystem with the noexec option, then I (of cousre)
> cant run any binaries on it. If I remount it with:
>
> mount -o remount,exec /mnt/zip
>
> I can still not run binaries which I tried to run before the remount,
> but I CAN run new binaries which I copy into the file system.

Hi Jim,
Could you give the attached patch a try? It shrinks, syncs, and
invalidates before remounting, which should take care of the problem you
noted. (But note that a file still open can't be invalidated ...
shouldn't apply to binaries though.)

If you aren't using the dcache patch I posted a couple of days ago, just
replace the shrink_dcache_sb(sb) with shrink_dcache().

Regards,
Bill--- fs/super.c.old Fri Sep 26 08:10:51 1997
+++ fs/super.c Tue Sep 30 15:28:14 1997
@@ -847,6 +847,13 @@
int retval;
struct vfsmount *vfsmnt;

+ /*
+ * Invalidate the inodes, as some mount options may be changed.
+ * N.B. If we are changing media, we should check the return
+ * from invalidate_inodes ... can't allow _any_ open files.
+ */
+ invalidate_inodes(sb);
+
if (!(flags & MS_RDONLY) && sb->s_dev && is_read_only(sb->s_dev))
return -EACCES;
/*flags |= MS_RDONLY;*/
@@ -877,8 +884,14 @@
struct super_block * sb = dentry->d_inode->i_sb;

retval = -EINVAL;
- if (dentry == sb->s_root)
+ if (dentry == sb->s_root) {
+ /*
+ * Shrink the dcache and sync the device.
+ */
+ shrink_dcache_sb(sb);
+ fsync_dev(sb->s_dev);
retval = do_remount_sb(sb, flags, data);
+ }
dput(dentry);
}
return retval;
\
 
 \ /
  Last update: 2005-03-22 13:40    [W:0.039 / U:0.052 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site