tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: panic: ffs_snapshot_mount: already on list



On Wed, Sep 12, 2018 at 09:48:21AM +0200, Manuel Bouyer wrote:
> Yes, IHMO it should not panic but complains and ignore the invalid snapshots.
> In your case you had to mount the FS read/write to fix the problem
> (I guess you could have fixed it with fsdb+fsck too, but we should not have
> to go there to go back to a mountable filesystem).

Something like this? (I retained the #ifndef FFS_NO_SNAPSHOT which 
saved my day)

--- sys/ufs/ffs/ffs_snapshot.c.orig
+++ sys/ufs/ffs/ffs_snapshot.c
@@ -1734,8 +1734,9 @@
  */
 void
 ffs_snapshot_mount(struct mount *mp)
 {
+#ifndef FFS_NO_SNAPSHOT
        struct vnode *devvp = VFSTOUFS(mp)->um_devvp;
        struct fs *fs = VFSTOUFS(mp)->um_fs;
        struct lwp *l = curlwp;
        struct vnode *vp;
@@ -1823,14 +1824,15 @@
 
                /*
                 * Link it onto the active snapshot list.
                 */
-               if (is_active_snapshot(si, ip))
-                       panic("ffs_snapshot_mount: %"PRIu64" already on list",
+               if (is_active_snapshot(si, ip)) {
+                       printf("ffs_snapshot_mount: %"PRIu64" already on list",
                            ip->i_number);
-               else
+               } else {
                        TAILQ_INSERT_TAIL(&si->si_snapshots, ip, i_nextsnap);
-               vp->v_vflag |= VV_SYSTEM;
+                       vp->v_vflag |= VV_SYSTEM;
+               }
                VOP_UNLOCK(vp);
        }
        /*
         * No usable snapshots found.
@@ -1847,8 +1849,10 @@
        si->si_snapblklist = xp->i_snapblklist;
        fscow_establish(mp, ffs_copyonwrite, devvp);
        si->si_gen++;
        mutex_exit(&si->si_lock);
+#endif /* FFS_NO_SNAPSHOT */
+       return;
 }
 
 /*
  * Disassociate snapshot files when unmounting.


-- 
Emmanuel Dreyfus
manu%netbsd.org@localhost


Home | Main Index | Thread Index | Old Index