From owner-freebsd-stable@FreeBSD.ORG Wed Dec 14 18:53:26 2011 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 40FFB106566B for ; Wed, 14 Dec 2011 18:53:26 +0000 (UTC) (envelope-from alan.l.cox@gmail.com) Received: from mail-pz0-f54.google.com (mail-pz0-f54.google.com [209.85.210.54]) by mx1.freebsd.org (Postfix) with ESMTP id 167D58FC12 for ; Wed, 14 Dec 2011 18:53:25 +0000 (UTC) Received: by dakp5 with SMTP id p5so1217512dak.13 for ; Wed, 14 Dec 2011 10:53:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:reply-to:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=AdBUXgDs4PJRE/UNIV7mFtxta4pmkCEUELZ/hh8/cTk=; b=lmjrWfpRZqZIpH6gtnCZupsfpPYp9opa/VQa6CwQhvG+dIfwYHe5je+EwvyKb2dEV7 t53rpEkNuNjb8fjbc6JnD8E12TduQIPMeRdpvadw65hO9jixQaHtyGhCN1oy+pAhm1fg RbdQKO6V9f2Xsh8/pYT9Q1/N+XN6dF22LjGyQ= MIME-Version: 1.0 Received: by 10.68.73.228 with SMTP id o4mr4891120pbv.2.1323888805524; Wed, 14 Dec 2011 10:53:25 -0800 (PST) Received: by 10.142.154.16 with HTTP; Wed, 14 Dec 2011 10:53:25 -0800 (PST) In-Reply-To: <20111214182252.GA5176@icarus.home.lan> References: <4EE7BF77.5000504@zonov.org> <20111213221501.GA85563@icarus.home.lan> <4EE8E6E3.7050202@zonov.org> <20111214182252.GA5176@icarus.home.lan> Date: Wed, 14 Dec 2011 12:53:25 -0600 Message-ID: From: Alan Cox To: Jeremy Chadwick Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: Andrey Zonov , freebsd-stable@freebsd.org Subject: Re: directory listing hangs in "ufs" state X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: alc@freebsd.org List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Dec 2011 18:53:26 -0000 On Wed, Dec 14, 2011 at 12:22 PM, Jeremy Chadwick wrote: > On Wed, Dec 14, 2011 at 10:11:47PM +0400, Andrey Zonov wrote: > > Hi Jeremy, > > > > This is not hardware problem, I've already checked that. I also ran > > fsck today and got no errors. > > > > After some more exploration of how mongodb works, I found that then > > listing hangs, one of mongodb thread is in "biowr" state for a long > > time. It periodically calls msync(MS_SYNC) accordingly to ktrace > > out. > > > > If I'll remove msync() calls from mongodb, how often data will be > > sync by OS? > > > > -- > > Andrey Zonov > > > > On 14.12.2011 2:15, Jeremy Chadwick wrote: > > >On Wed, Dec 14, 2011 at 01:11:19AM +0400, Andrey Zonov wrote: > > >> > > >>Have you any ideas what is going on? or how to catch the problem? > > > > > >Assuming this isn't a file on the root filesystem, try booting the > > >machine in single-user mode and using "fsck -f" on the filesystem in > > >question. > > > > > >Can you verify there's no problems with the disk this file lives on as > > >well (smartctl -a /dev/disk)? I'm doubting this is the problem, but > > >thought I'd mention it. > > I have no real answer, I'm sorry. msync(2) indicates it's effectively > deprecated (see BUGS). It looks like this is effectively a mmap-version > of fsync(2). > > Yikes, I just looked at this man page. I'm afraid that the text in the BUGS section is highly misleading. The MS_INVALIDATE option should be obsolete for the reason given there. Under a strict reading of the applicable standard, FreeBSD could implement this option as a NOP. However, we treat it something like madvise(MADV_DONTNEED|FREE). In contrast, MS_SYNC is definitely not obsolete. Alan P.S. If someone wants to take a crack at fixing this man page, contact me off list.