Bug 413 - read-only mount attempts write on umount
: read-only mount attempts write on umount
Status: RESOLVED WONTFIX
: XFS
XFS kernel code
: unspecified
: PC Linux
: P2 normal
: ---
Assigned To:
:
:
:
:
:
:
  Show dependency treegraph
 
Reported: 2005-05-16 05:16 CST by
Modified: 2008-12-25 03:42 CST (History)


Attachments


Note

You need to log in before you can comment on or make changes to this bug.


Description From 2005-05-16 05:16:28 CST
it appears that even when mounted -o ro xfs will attempt a write when a umount
is performed.

in this particular case the underlying device is an lvm snapshot (lvm 1.0.8). 
the kernel is 2.4.30 with linux-2.4.22-VFS-lock.patch.

when i umount i get the following kernel messages:

lvm - lvm_map: ll_rw_blk write for readonly LV /dev/vg1/var-snap
xfs_force_shutdown(lvm(58,0),0x1) called from line 353 of file xfs_rw.c.  Return
address = 0xc01f241b
Filesystem "lvm(58,0)": I/O Error Detected.  Shutting down filesystem: lvm(58,0)
Please umount the filesystem, and rectify the problem(s)

-dean
------- Comment #1 From 2005-06-30 16:46:06 CST -------
I have reproduced this bug with a 2.4.21 kernel (on SuSE 9.0) on a box that
shares a readonly mount with another box (2.6 kernel) via fiber channel.  The
2.4 box will write to the filesystem on umount and corrupt it for the other box.

-Dave
------- Comment #2 From 2005-09-08 02:42:42 CST -------
I am using kernel-2.4.21-27.0.2.EL.sgi9.src.rpm that is downloaded from sgi 
site for our system and also accounted this bug. From the source, I find the 
bug dues to the XFS file system tries to write to the readonly mounted file 
system, I made the below patch and find it seems the patch fixes this bug, can 
anyone give the confirmation if this patch really works?


diff -U 8 -rN --exclude='*.o' --exclude='*.orig' xfs-kern.old/linux/xfs_super.c 
xfs-kern.new/linux/xfs_super.c
--- xfs-kern.old/linux/xfs_super.c      2005-09-08 17:02:33.000000000 +0800
+++ xfs-kern.new/linux/xfs_super.c      2005-09-08 16:30:46.000000000 +0800
@@ -580,16 +580,20 @@
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,21)
 STATIC int
 linvfs_sync_super(
        struct super_block      *sb)
 {
        vfs_t           *vfsp = LINVFS_GET_VFS(sb);
        int             error;

+       if (sb->s_flags & MS_RDONLY) {
+               sb->s_dirt = 0; /* paranoia */
+               return;
+       }
        VFS_SYNC(vfsp, SYNC_FSDATA|SYNC_WAIT, NULL, error);
        return -error;
 }
 #endif

 STATIC int
 linvfs_statfs(
        struct super_block      *sb,
------- Comment #3 From 2005-09-08 07:15:14 CST -------
I think that looks reasonable... given that we have the same thing in 
linvfs_write_super.   I don't remember now why we immediately dirty
the superblock in linvfs_read_super - perhaps it'd make more sense to just do
the

if (sb->s_flags & MS_RDONLY) {

test in linvfs_read_super, and never mark the sb dirty on a readonly mount.
------- Comment #4 From 2008-12-25 03:42:51 CST -------
Closing all 2.4 kernel bugs with WONTFIX as XFS in Linux 2.4 hasn't been
maintained for a long time.  Please open a new bug if you see something similar
with a recent Linux 2.6 kernel.