Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 21 Aug 2006 16:38:36 +0300
From:      Kostik Belousov <kostikbel@gmail.com>
To:        Tor Egge <Tor.Egge@cvsup.no.freebsd.org>
Cc:        freebsd-fs@freebsd.org, tegge@freebsd.org
Subject:   Re: Deadlock between nfsd and snapshots.
Message-ID:  <20060821133836.GB56637@deviant.kiev.zoral.com.ua>
In-Reply-To: <20060821.132151.41668008.Tor.Egge@cvsup.no.freebsd.org>
References:  <20060817170314.GA17490@peter.osted.lan> <20060818164903.GF20768@deviant.kiev.zoral.com.ua> <20060818.202001.74745664.Tor.Egge@cvsup.no.freebsd.org> <20060821.132151.41668008.Tor.Egge@cvsup.no.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--+pHx0qQiF2pBVqBT
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Mon, Aug 21, 2006 at 01:21:51PM +0000, Tor Egge wrote:
>=20
> I wrote:
>=20
> > The deadlock indicates that one or more of IN_CHANGE, IN_MODIFIED or
> > IN_UPDATE was set on the inode, indicating a write operation
> > (e.g. VOP_WRITE(), VOP_RENAME(), VOP_CREATE(), VOP_REMOVE(), VOP_LINK(),
> > VOP_SYMLINK(), VOP_SETATTR(), VOP_MKDIR(), VOP_RMDIR(), VOP_MKNOD()) th=
at was
> > not protected by vn_start_write() or vn_start_secondary_write().
>=20
> The most common "write" operation was probably VOP_GETATTR().
>=20
> ufs_itimes(), called from ufs_getattr(), might set the IN_MODIFIED inode =
flag
> if IN_ACCESS is set on the inode even if neither IN_CHANGE nor IN_UPDATE =
is
> set, transitioning the inode flags into a state where ufs_inactive() call=
s the
> blocking variant of vn_start_secondary_write().
>=20
> calling ufs_itimes() with only a shared vnode lock might cause unsafe acc=
esses
> to the inode flags.  Setting of IN_ACCESS at the end of ffs_read() and
> ffs_extread() might also be unsafe.  If DIRECTIO is enabled then O_DIRECT=
 reads
> might not even attempt to set the IN_ACCESS flag.

Thanks for analysis !

I already thought about ufs_itimes/GETATTR. I am currently musing about
storing the list of threads that called vm_start_write in the mount struct,
and checking that the current thread is on list during modifying operations,
at least that ops that set the IN_* flags.


--+pHx0qQiF2pBVqBT
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (FreeBSD)

iD8DBQFE6bdcC3+MBN1Mb4gRAjlpAJ484ne6ze8nb1JRq4r3iKgwinU9TQCgpTgl
BqUwy3qBaYwC5XCg3rHlrb8=
=wRsm
-----END PGP SIGNATURE-----

--+pHx0qQiF2pBVqBT--



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