xfs
[Top] [All Lists]

Re: oops when creating an lvm-snapshot

To: Steve Lord <lord@xxxxxxx>
Subject: Re: oops when creating an lvm-snapshot
From: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Date: Wed, 14 Aug 2002 18:36:31 +0100
Cc: Erik Tews <erik@xxxxxxxxxxxxxxxxx>, linux-xfs@xxxxxxxxxxx, lvm-devel@xxxxxxxxxxx
In-reply-to: <1029344832.15672.90.camel@jen.americas.sgi.com>; from lord@sgi.com on Wed, Aug 14, 2002 at 12:07:12PM -0500
References: <20020814170120.GA23422@no-maam.dyndns.org> <1029344832.15672.90.camel@jen.americas.sgi.com>
Sender: owner-linux-xfs@xxxxxxxxxxx
User-agent: Mutt/1.2.5.1i
On Wed, Aug 14, 2002 at 12:07:12PM -0500, Steve Lord wrote:
> I think this is regression introduced yesterday, we changed some
> structures around. Try editing fs/xfs/xfs_fsops.c
> 
> Look for this code around line 580:
> 
>         if (mp->m_rtdev != 0) {
>                 xfs_binval(mp->m_rtdev_targp);
>         }
> 
> Change it to:
> 
>       if (mp->m_rtdev_targp) {
>               xfs_binval(mp->m_rtdev_targp);
>       }
> 
> and see if that fixes it for you.

There are a few more of those.  Having the basically unused m_rtdev beeing
an pointer to nothing in some situation was a rather bad design by me.

The patch below kills m_rtdev and m_logdev entirely.  m_dev stays for now
as it must always be a valid pointer and we use it a lot.


Index: fs/xfs/xfs_fsops.c
===================================================================
RCS file: /cvs/linux-2.4-xfs/linux/fs/xfs/xfs_fsops.c,v
retrieving revision 1.84
diff -u -p -r1.84 xfs_fsops.c
--- fs/xfs/xfs_fsops.c  2002/08/13 16:09:38     1.84
+++ fs/xfs/xfs_fsops.c  2002/08/14 17:29:48
@@ -577,7 +577,7 @@ xfs_fs_freeze(
 
        /* Push all buffers out to disk */
        xfs_binval(mp->m_ddev_targp);
-       if (mp->m_rtdev != 0) {
+       if (mp->m_rtdev_targp) {
                xfs_binval(mp->m_rtdev_targp);
        }
 
Index: fs/xfs/xfs_mount.c
===================================================================
RCS file: /cvs/linux-2.4-xfs/linux/fs/xfs/xfs_mount.c,v
retrieving revision 1.295
diff -u -p -r1.295 xfs_mount.c
--- fs/xfs/xfs_mount.c  2002/08/13 16:09:38     1.295
+++ fs/xfs/xfs_mount.c  2002/08/14 17:29:49
@@ -203,12 +203,12 @@ xfs_mount_validate_sb(
                return XFS_ERROR(EWRONGFS);
        }
 
-       if (sbp->sb_logstart == 0 && mp->m_logdev == mp->m_dev) {
+       if (sbp->sb_logstart == 0 && mp->m_logdev_targp == mp->m_ddev_targp) {
                cmn_err(CE_WARN, "XFS: filesystem is marked as having an 
external log; specify logdev on the\nmount command line.");
                return XFS_ERROR(EFSCORRUPTED);
        }
 
-       if (sbp->sb_logstart != 0 && mp->m_logdev && mp->m_logdev != mp->m_dev) 
{
+       if (sbp->sb_logstart != 0 && mp->m_logdev_targp != mp->m_ddev_targp) {
                cmn_err(CE_WARN, "XFS: filesystem is marked as having an 
internal log; don't specify logdev on\nthe mount command line.");
                return XFS_ERROR(EFSCORRUPTED);
        }
@@ -764,7 +764,7 @@ xfs_mountfs(
        }
 
        if (!noio && ((mfsi_flags & XFS_MFSI_CLIENT) == 0) &&
-           mp->m_logdev && mp->m_logdev != mp->m_dev) {
+           mp->m_logdev_targp != mp->m_ddev_targp) {
                d = (xfs_daddr_t)XFS_FSB_TO_BB(mp, mp->m_sb.sb_logblocks);
                if (XFS_BB_TO_FSB(mp, d) != mp->m_sb.sb_logblocks) {
                        cmn_err(CE_WARN, "XFS: size check 3 failed");
@@ -882,7 +882,7 @@ xfs_mountfs(
         * log's mount-time initialization. Perform 1st part recovery if needed
         */
        if (sbp->sb_logblocks > 0) {            /* check for volume case */
-               error = xfs_log_mount(mp, mp->m_logdev,
+               error = xfs_log_mount(mp, mp->m_logdev_targp->pbr_dev,
                                      XFS_FSB_TO_DADDR(mp, sbp->sb_logstart),
                                      XFS_FSB_TO_BB(mp, sbp->sb_logblocks));
                if (error) {
@@ -935,7 +935,7 @@ xfs_mountfs(
 
        if (((quotaondisk && !XFS_IS_QUOTA_ON(mp)) ||
              (!quotaondisk && XFS_IS_QUOTA_ON(mp))) &&
-           (is_read_only(mp->m_dev) || is_read_only(mp->m_logdev))) {
+           (is_read_only(mp->m_dev) || 
is_read_only(mp->m_logdev_targp->pbr_dev))) {
                cmn_err(CE_WARN,
                        "XFS: device %s is read-only, cannot change "
                        "quota state.  Please mount with%s quota option.",
Index: fs/xfs/xfs_mount.h
===================================================================
RCS file: /cvs/linux-2.4-xfs/linux/fs/xfs/xfs_mount.h,v
retrieving revision 1.154
diff -u -p -r1.154 xfs_mount.h
--- fs/xfs/xfs_mount.h  2002/08/13 16:09:38     1.154
+++ fs/xfs/xfs_mount.h  2002/08/14 17:29:50
@@ -190,8 +190,6 @@ typedef struct xfs_mount {
        xfs_buftarg_t           *m_logdev_targp;/* ptr to log device */
        xfs_buftarg_t           *m_rtdev_targp; /* ptr to rt device */
 #define m_dev          m_ddev_targp->pbr_dev
-#define m_logdev       m_logdev_targp->pbr_dev
-#define m_rtdev                m_rtdev_targp->pbr_dev
        __uint8_t               m_dircook_elog; /* log d-cookie entry bits */
        __uint8_t               m_blkbit_log;   /* blocklog + NBBY */
        __uint8_t               m_blkbb_log;    /* blocklog - BBSHIFT */
Index: fs/xfs/xfs_rtalloc.c
===================================================================
RCS file: /cvs/linux-2.4-xfs/linux/fs/xfs/xfs_rtalloc.c,v
retrieving revision 1.77
diff -u -p -r1.77 xfs_rtalloc.c
--- fs/xfs/xfs_rtalloc.c        2002/08/13 16:09:38     1.77
+++ fs/xfs/xfs_rtalloc.c        2002/08/14 17:29:52
@@ -1917,7 +1917,7 @@ xfs_growfs_rt(
        /*
         * Initial error checking.
         */
-       if (mp->m_rtdev == 0 || mp->m_rbmip == NULL ||
+       if (mp->m_rtdev_targp || mp->m_rbmip == NULL ||
            (nrblocks = in->newblocks) <= sbp->sb_rblocks ||
            (sbp->sb_rblocks && (in->extsize != sbp->sb_rextsize)))
                return XFS_ERROR(EINVAL);
@@ -2264,7 +2264,7 @@ xfs_rtmount_init(
        sbp = &mp->m_sb;
        if (sbp->sb_rblocks == 0)
                return 0;
-       if (mp->m_rtdev != 0) {
+       if (mp->m_rtdev_targp != NULL) {
                printk(KERN_WARNING
                "XFS: This FS has an RT subvol - specify -o rtdev on mount\n");
                return XFS_ERROR(ENODEV);
Index: fs/xfs/xfs_vfsops.c
===================================================================
RCS file: /cvs/linux-2.4-xfs/linux/fs/xfs/xfs_vfsops.c,v
retrieving revision 1.368
diff -u -p -r1.368 xfs_vfsops.c
--- fs/xfs/xfs_vfsops.c 2002/08/13 16:09:38     1.368
+++ fs/xfs/xfs_vfsops.c 2002/08/14 17:29:53
@@ -1616,7 +1616,7 @@ xfs_syncsub(
         */
        if ((flags & (SYNC_CLOSE|SYNC_WAIT)) == (SYNC_CLOSE|SYNC_WAIT)) {
                XFS_bflush(mp->m_ddev_targp);
-               if (mp->m_rtdev != 0) {
+               if (mp->m_rtdev_targp) {
                        XFS_bflush(mp->m_rtdev_targp);
                }
        }
Index: fs/xfs/xfsidbg.c
===================================================================
RCS file: /cvs/linux-2.4-xfs/linux/fs/xfs/xfsidbg.c,v
retrieving revision 1.194
diff -u -p -r1.194 xfsidbg.c
--- fs/xfs/xfsidbg.c    2002/08/09 14:23:41     1.194
+++ fs/xfs/xfsidbg.c    2002/08/14 17:29:57
@@ -4437,8 +4437,10 @@ xfsidbg_xmount(xfs_mount_t *mp)
        kdb_printf("ail_gen 0x%x &sb 0x%p\n",
                mp->m_ail_gen, &mp->m_sb);
        kdb_printf("sb_lock 0x%p sb_bp 0x%p dev 0x%x logdev 0x%x rtdev 0x%x\n",
-               &mp->m_sb_lock, mp->m_sb_bp, mp->m_dev, mp->m_logdev,
-               mp->m_rtdev);
+               &mp->m_sb_lock, mp->m_sb_bp,
+               mp->m_ddev_targp->pbr_dev,
+               mp->m_logdev_targp->pbr_dev,
+               mp->m_rtdev_targp->pbr_dev);
        kdb_printf("bsize %d agfrotor %d agirotor %d ihash 0x%p ihsize %d\n",
                mp->m_bsize, mp->m_agfrotor, mp->m_agirotor,
                mp->m_ihash, mp->m_ihsize);
Index: fs/xfs/linux/xfs_lrw.c
===================================================================
RCS file: /cvs/linux-2.4-xfs/linux/fs/xfs/linux/xfs_lrw.c,v
retrieving revision 1.164
diff -u -p -r1.164 xfs_lrw.c
--- fs/xfs/linux/xfs_lrw.c      2002/08/13 16:09:38     1.164
+++ fs/xfs/linux/xfs_lrw.c      2002/08/14 17:29:59
@@ -1785,7 +1785,7 @@ XFS_log_write_unmount_ro(bhv_desc_t       *bdp
 STATIC int
 xfs_is_read_only(xfs_mount_t *mp)
 {
-       if (is_read_only(mp->m_dev) || is_read_only(mp->m_logdev)) {
+       if (is_read_only(mp->m_dev) || 
is_read_only(mp->m_logdev_targp->pbr_dev)) {
                cmn_err(CE_NOTE,
                        "XFS: write access unavailable, cannot proceed.");
                return EROFS;


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