diff --git a/sys/ufs/ffs/ffs_snapshot.c b/sys/ufs/ffs/ffs_snapshot.c index 0dc07e9dd254..98a1f232ed5a 100644 --- a/sys/ufs/ffs/ffs_snapshot.c +++ b/sys/ufs/ffs/ffs_snapshot.c @@ -681,6 +681,17 @@ ffs_snapshot(mp, snapfile) VI_UNLOCK(devvp); if (space != NULL) FREE(space, M_UFSMNT); + /* + * If another process is currently writing the buffer containing + * the inode for this snapshot then a deadlock can occur. Drop + * the snapshot lock until the buffer has been written. + */ + VOP_UNLOCK(vp, 0, td); + (void) bread(ip->i_devvp, + fsbtodb(fs, ino_to_fsba(fs, ip->i_number)), + (int) fs->fs_bsize, NOCRED, &nbp); + brelse(nbp); + vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td); done: FREE(copy_fs->fs_csp, M_UFSMNT); bawrite(sbp);