Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 4 Aug 2017 08:16:05 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r322043 - stable/11/sys/ufs/ffs
Message-ID:  <201708040816.v748G5iV016165@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Fri Aug  4 08:16:05 2017
New Revision: 322043
URL: https://svnweb.freebsd.org/changeset/base/322043

Log:
  MFC r321347:
  Account for lock recursion when transfering snaplock to the vnode lock
  in ffs_snapremove().

Modified:
  stable/11/sys/ufs/ffs/ffs_snapshot.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/ufs/ffs/ffs_snapshot.c
==============================================================================
--- stable/11/sys/ufs/ffs/ffs_snapshot.c	Fri Aug  4 08:12:19 2017	(r322042)
+++ stable/11/sys/ufs/ffs/ffs_snapshot.c	Fri Aug  4 08:16:05 2017	(r322043)
@@ -1607,7 +1607,7 @@ ffs_snapremove(vp)
 	struct buf *ibp;
 	struct fs *fs;
 	ufs2_daddr_t numblks, blkno, dblk;
-	int error, loc, last;
+	int error, i, last, loc;
 	struct snapdata *sn;
 
 	ip = VTOI(vp);
@@ -1627,10 +1627,14 @@ ffs_snapremove(vp)
 		ip->i_nextsnap.tqe_prev = 0;
 		VI_UNLOCK(devvp);
 		lockmgr(&vp->v_lock, LK_EXCLUSIVE, NULL);
+		for (i = 0; i < sn->sn_lock.lk_recurse; i++)
+			lockmgr(&vp->v_lock, LK_EXCLUSIVE, NULL);
 		KASSERT(vp->v_vnlock == &sn->sn_lock,
 			("ffs_snapremove: lost lock mutation")); 
 		vp->v_vnlock = &vp->v_lock;
 		VI_LOCK(devvp);
+		while (sn->sn_lock.lk_recurse > 0)
+			lockmgr(&sn->sn_lock, LK_RELEASE, NULL);
 		lockmgr(&sn->sn_lock, LK_RELEASE, NULL);
 		try_free_snapdata(devvp);
 	} else



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201708040816.v748G5iV016165>