From owner-freebsd-fs@FreeBSD.ORG Wed May 29 17:00:01 2013 Return-Path: Delivered-To: freebsd-fs@smarthost.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 60EA838E for ; Wed, 29 May 2013 17:00:01 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id 530F19C9 for ; Wed, 29 May 2013 17:00:01 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.7/8.14.7) with ESMTP id r4TH01OX081931 for ; Wed, 29 May 2013 17:00:01 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.7/8.14.7/Submit) id r4TH01uG081930; Wed, 29 May 2013 17:00:01 GMT (envelope-from gnats) Date: Wed, 29 May 2013 17:00:01 GMT Message-Id: <201305291700.r4TH01uG081930@freefall.freebsd.org> To: freebsd-fs@FreeBSD.org Cc: From: Jaakko Heinonen Subject: Re: kern/165392: Multiple mkdir/rmdir fails with errno 31 X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: Jaakko Heinonen List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 May 2013 17:00:01 -0000 The following reply was made to PR kern/165392; it has been noted by GNATS. From: Jaakko Heinonen To: Jilles Tjoelker Cc: bug-followup@FreeBSD.org, vvv@colocall.net, mckusick@FreeBSD.org Subject: Re: kern/165392: Multiple mkdir/rmdir fails with errno 31 Date: Wed, 29 May 2013 19:53:11 +0300 On 2013-05-27, Jilles Tjoelker wrote: > > However, VOP_FSYNC(9) with the MNT_WAIT flag seems not to update the > > i_nlink count for a reason unknown to me. I can verify that also by > > taking your reproduction recipe above and adding "fsync ." between > > "rmdir 1" and "mkdir a". > > fsync certainly helps but not as effectively as you'd want. Some > combination of sleeps, fsyncs and mkdir attempts appears to be needed. I have revised the patch and the following version _appears_ to work. http://people.freebsd.org/~jh/patches/ufs-check_linkcnt.2.diff It's still experimental and doesn't handle link(2) or rename(2) at all. In my testing debug.softdep.linkcnt_retries is increased by one with your original reproduction recipe. > I'm also interested in whether it is safe to call VOP_FSYNC at that > point, especially in the case of a rename where a lock on the source > directory vnode may be held at the same time. I think your concern is valid because softdep_fsync() needs to lock parent directories. Possibly you can work around the problem by unlocking the vnodes, doing fsync and then restarting rename. Unfortunately this makes rename even more complex. -- Jaakko