xfs
[Top] [All Lists]

Re: Remounting read-only forces filesystem shutdown

To: Steve Lord <lord@xxxxxxx>, Onis <onion@xxxxxxxxxxx>
Subject: Re: Remounting read-only forces filesystem shutdown
From: Nathan Scott <nathans@xxxxxxx>
Date: Thu, 13 Apr 2006 12:21:38 +1000
Cc: linux-xfs@xxxxxxxxxxx
In-reply-to: <443DB2D9.7070706@xxxxxxx>; from lord@xxxxxxx on Wed, Apr 12, 2006 at 09:09:29PM -0500
References: <20060412203719.GA22528@xxxxxxxxxxx> <20060413100839.C1334248@xxxxxxxxxxxxxxxxxxxxxxxx> <443DB2D9.7070706@xxxxxxx>
Sender: linux-xfs-bounce@xxxxxxxxxxx
User-agent: Mutt/1.2.5i
On Wed, Apr 12, 2006 at 09:09:29PM -0500, Steve Lord wrote:
> >> To repeat it, just do "mount -o remount,ro /mnt".
> > 
> > Ah, I think I see the problem - looks like we can enable write
> > barriers accidentally during a remount,ro without checking to
> > see if the drive likes that idea.  Ugh.
> > 
> > Just to be sure - when you initially mounted the filesystem (rw), did
> > you get a dmesg message saying "disabling write barriers" or words to
> > that effect?
> 
> I have seen this too, and it is definitely on a system which reports
> no barrier support in the devices. Shutdown ends up with exactly
> this error - running 2.6.17-rc1 from Linus's git tree as of a
> couple of days ago.

Hey Steve, Onion,

This patch to fs/xfs/xfs_vfsops.c should fix that right up... I'll get
it merged in asap.  Looks like the only way to catch some problems is
to switch things on by default. ;)

cheers.

-- 
Nathan


Index: xfs-linux/xfs_vfsops.c
===================================================================
--- xfs-linux.orig/xfs_vfsops.c
+++ xfs-linux/xfs_vfsops.c
@@ -681,32 +681,22 @@ xfs_mntupdate(
        xfs_mount_t     *mp = XFS_BHVTOM(bdp);
        int             error;
 
-       if (args->flags & XFSMNT_BARRIER)
-               mp->m_flags |= XFS_MOUNT_BARRIER;
-       else
-               mp->m_flags &= ~XFS_MOUNT_BARRIER;
-
-       if ((vfsp->vfs_flag & VFS_RDONLY) &&
-           !(*flags & MS_RDONLY)) {
-               vfsp->vfs_flag &= ~VFS_RDONLY;
-
-               if (args->flags & XFSMNT_BARRIER)
+       if (!(*flags & MS_RDONLY)) {                    /* rw/ro -> rw */
+               if (vfsp->vfs_flag & VFS_RDONLY)
+                       vfsp->vfs_flag &= ~VFS_RDONLY;
+               if (args->flags & XFSMNT_BARRIER) {
+                       mp->m_flags |= XFS_MOUNT_BARRIER;
                        xfs_mountfs_check_barriers(mp);
-       }
-
-       if (!(vfsp->vfs_flag & VFS_RDONLY) &&
-           (*flags & MS_RDONLY)) {
+               } else {
+                       mp->m_flags &= ~XFS_MOUNT_BARRIER;
+               }
+       } else if (!(vfsp->vfs_flag & VFS_RDONLY)) {    /* rw -> ro */
                VFS_SYNC(vfsp, SYNC_FSDATA|SYNC_BDFLUSH|SYNC_ATTR, NULL, error);
-
                xfs_quiesce_fs(mp);
-
-               /* Ok now write out an unmount record */
-               xfs_log_sbcount(mp, 1);
                xfs_log_unmount_write(mp);
                xfs_unmountfs_writesb(mp);
                vfsp->vfs_flag |= VFS_RDONLY;
        }
-
        return 0;
 }
 


<Prev in Thread] Current Thread [Next in Thread>